mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
Remove useless variable declarations in PHP. (#4849)
This commit is contained in:
@@ -143,23 +143,6 @@ Blockly.PHP.init = function(workspace) {
|
||||
this.nameDB_.populateVariables(workspace);
|
||||
this.nameDB_.populateProcedures(workspace);
|
||||
|
||||
var defvars = [];
|
||||
// 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(this.nameDB_.getName(devVarList[i],
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE) + ';');
|
||||
}
|
||||
|
||||
// Add user variables, but only ones that are being used.
|
||||
var variables = Blockly.Variables.allUsedVarModels(workspace);
|
||||
for (var i = 0, variable; (variable = variables[i]); i++) {
|
||||
defvars.push(this.nameDB_.getName(variable.getId(),
|
||||
Blockly.VARIABLE_CATEGORY_NAME) + ';');
|
||||
}
|
||||
|
||||
// Declare all of the variables.
|
||||
this.definitions_['variables'] = defvars.join('\n');
|
||||
this.isInitialized = true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user