From bce24fef6b90f77a33756a64a7f57e64766491b3 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Fri, 26 Jan 2018 17:10:45 -0800 Subject: [PATCH] Add generators for dynamic variable blocks. --- generators/dart/variables_dynamic.js | 35 ++++++++++++++++++++ generators/javascript/variables_dynamic.js | 37 ++++++++++++++++++++++ generators/lua/variables_dynamic.js | 35 ++++++++++++++++++++ generators/php/variables_dynamic.js | 35 ++++++++++++++++++++ generators/python/variables_dynamic.js | 35 ++++++++++++++++++++ tests/playground.html | 5 +++ 6 files changed, 182 insertions(+) create mode 100644 generators/dart/variables_dynamic.js create mode 100644 generators/javascript/variables_dynamic.js create mode 100644 generators/lua/variables_dynamic.js create mode 100644 generators/php/variables_dynamic.js create mode 100644 generators/python/variables_dynamic.js diff --git a/generators/dart/variables_dynamic.js b/generators/dart/variables_dynamic.js new file mode 100644 index 000000000..4f724623c --- /dev/null +++ b/generators/dart/variables_dynamic.js @@ -0,0 +1,35 @@ +/** + * @license + * Visual Blocks Language + * + * Copyright 2018 Google Inc. + * https://developers.google.com/blockly/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Generating Dart for dynamic variable blocks. + * @author fenichel@google.com (Rachel Fenichel) + */ +'use strict'; + +goog.provide('Blockly.Dart.variablesDynamic'); + +goog.require('Blockly.Dart'); +goog.require('Blockly.Dart.variables'); + + +// Dart is dynamically typed. +Blockly.Dart['variables_get_dynamic'] = Blockly.Dart['variables_get']; +Blockly.Dart['variables_set_dynamic'] = Blockly.Dart['variables_set']; diff --git a/generators/javascript/variables_dynamic.js b/generators/javascript/variables_dynamic.js new file mode 100644 index 000000000..fd3297b8d --- /dev/null +++ b/generators/javascript/variables_dynamic.js @@ -0,0 +1,37 @@ +/** + * @license + * Visual Blocks Language + * + * Copyright 2018 Google Inc. + * https://developers.google.com/blockly/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Generating JavaScript for dynamic variable blocks. + * @author fenichel@google.com (Rachel Fenichel) + */ +'use strict'; + +goog.provide('Blockly.JavaScript.variablesDynamic'); + +goog.require('Blockly.JavaScript'); +goog.require('Blockly.JavaScript.variables'); + + +// JavaScript is dynamically typed. +Blockly.JavaScript['variables_get_dynamic'] = + Blockly.JavaScript['variables_get']; +Blockly.JavaScript['variables_set_dynamic'] = + Blockly.JavaScript['variables_set']; diff --git a/generators/lua/variables_dynamic.js b/generators/lua/variables_dynamic.js new file mode 100644 index 000000000..60b07ef5e --- /dev/null +++ b/generators/lua/variables_dynamic.js @@ -0,0 +1,35 @@ +/** + * @license + * Visual Blocks Language + * + * Copyright 2018 Google Inc. + * https://developers.google.com/blockly/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Generating Lua for dynamic variable blocks. + * @author fenichel@google.com (Rachel Fenichel) + */ +'use strict'; + +goog.provide('Blockly.Lua.variablesDynamic'); + +goog.require('Blockly.Lua'); +goog.require('Blockly.Lua.variables'); + + +// Lua is dynamically typed. +Blockly.Lua['variables_get_dynamic'] = Blockly.Lua['variables_get']; +Blockly.Lua['variables_set_dynamic'] = Blockly.Lua['variables_set']; diff --git a/generators/php/variables_dynamic.js b/generators/php/variables_dynamic.js new file mode 100644 index 000000000..9ccc41465 --- /dev/null +++ b/generators/php/variables_dynamic.js @@ -0,0 +1,35 @@ +/** + * @license + * Visual Blocks Language + * + * Copyright 2018 Google Inc. + * https://developers.google.com/blockly/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Generating PHP for dynamic variable blocks. + * @author fenichel@google.com (Rachel Fenichel) + */ +'use strict'; + +goog.provide('Blockly.PHP.variablesDynamic'); + +goog.require('Blockly.PHP'); +goog.require('Blockly.PHP.variables'); + + +// PHP is dynamically typed. +Blockly.PHP['variables_get_dynamic'] = Blockly.PHP['variables_get']; +Blockly.PHP['variables_set_dynamic'] = Blockly.PHP['variables_set']; diff --git a/generators/python/variables_dynamic.js b/generators/python/variables_dynamic.js new file mode 100644 index 000000000..928421aee --- /dev/null +++ b/generators/python/variables_dynamic.js @@ -0,0 +1,35 @@ +/** + * @license + * Visual Blocks Language + * + * Copyright 2018 Google Inc. + * https://developers.google.com/blockly/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Generating Python for dynamic variable blocks. + * @author fenichel@google.com (Rachel Fenichel) + */ +'use strict'; + +goog.provide('Blockly.Python.variablesDynamic'); + +goog.require('Blockly.Python'); +goog.require('Blockly.Python.variables'); + + +// Python is dynamically typed. +Blockly.Python['variables_get_dynamic'] = Blockly.Python['variables_get']; +Blockly.Python['variables_set_dynamic'] = Blockly.Python['variables_set']; diff --git a/tests/playground.html b/tests/playground.html index 15379f20a..8e63815ea 100644 --- a/tests/playground.html +++ b/tests/playground.html @@ -12,6 +12,7 @@ + @@ -21,6 +22,7 @@ + @@ -30,6 +32,7 @@ + @@ -39,6 +42,7 @@ + @@ -48,6 +52,7 @@ +