Headless workspaces and blocks.

This commit is contained in:
Neil Fraser
2014-12-23 11:22:02 -08:00
parent 9a605e90e7
commit 0f8d01209c
40 changed files with 1894 additions and 1520 deletions

View File

@@ -73,8 +73,10 @@ Blockly.Dart.ORDER_NONE = 99; // (...)
/**
* Initialise the database of variable names.
* @param {Blockly.Workspace=} opt_workspace Workspace to generate code from.
* Defaults to main workspace.
*/
Blockly.Dart.init = function() {
Blockly.Dart.init = function(opt_workspace) {
// Create a dictionary of definitions to be printed before the code.
Blockly.Dart.definitions_ = Object.create(null);
// Create a dictionary mapping desired function names in definitions_
@@ -89,7 +91,7 @@ Blockly.Dart.init = function() {
}
var defvars = [];
var variables = Blockly.Variables.allVariables();
var variables = Blockly.Variables.allVariables(opt_workspace);
for (var x = 0; x < variables.length; x++) {
defvars[x] = 'var ' +
Blockly.Dart.variableDB_.getName(variables[x],