mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
JS and Dart generator tests pass
This commit is contained in:
@@ -102,13 +102,25 @@ Blockly.Dart.init = function(workspace) {
|
||||
Blockly.Dart.variableDB_.reset();
|
||||
}
|
||||
|
||||
Blockly.Dart.variableDB_.setVariableMap(workspace.getVariableMap());
|
||||
|
||||
var defvars = [];
|
||||
// Add user variables.
|
||||
var variables = workspace.getAllVariables();
|
||||
if (variables.length) {
|
||||
for (var i = 0; i < variables.length; i++) {
|
||||
defvars[i] = Blockly.Dart.variableDB_.getName(variables[i].name,
|
||||
Blockly.Variables.NAME_TYPE);
|
||||
}
|
||||
for (var i = 0; i < variables.length; i++) {
|
||||
defvars[i] = Blockly.Dart.variableDB_.getName(variables[i].name,
|
||||
Blockly.Variables.NAME_TYPE);
|
||||
}
|
||||
|
||||
// Add developer variables (not created or named by the user).
|
||||
var devVarList = Blockly.Variables.allDeveloperVariables(workspace);
|
||||
for (var i = 0; i < devVarList.length; i++) {
|
||||
defvars.push(Blockly.Dart.variableDB_.getName(devVarList[i],
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE));
|
||||
}
|
||||
|
||||
// Declare all of the variables.
|
||||
if (defvars.length) {
|
||||
Blockly.Dart.definitions_['variables'] =
|
||||
'var ' + defvars.join(', ') + ';';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user