Add error; python and php tests pass.

This commit is contained in:
Rachel Fenichel
2017-12-20 16:28:14 -08:00
parent fced496d28
commit 0a0b6f3848
5 changed files with 33 additions and 6 deletions

View File

@@ -160,12 +160,21 @@ Blockly.Python.init = function(workspace) {
Blockly.Python.variableDB_.reset();
}
Blockly.Python.variableDB_.setVariableMap(workspace.getVariableMap());
var defvars = [];
var variables = workspace.getAllVariables();
for (var i = 0; i < variables.length; i++) {
defvars[i] = Blockly.Python.variableDB_.getName(variables[i].name,
Blockly.Variables.NAME_TYPE) + ' = None';
}
// 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.Python.variableDB_.getName(devVarList[i],
Blockly.Names.DEVELOPER_VARIABLE_TYPE) + ' = None');
}
Blockly.Python.definitions_['variables'] = defvars.join('\n');
};