Use null-prototype objects for maps

A {} has a bunch of names already defined on it (like ‘toString’).  When using an object as a map with arbitrary keys, it should not inherit from Object.prototype.
This commit is contained in:
Neil Fraser
2021-06-08 06:03:14 -07:00
committed by Neil Fraser
parent 53d8754ee9
commit 76b5517008
20 changed files with 46 additions and 60 deletions

View File

@@ -14,12 +14,12 @@ goog.provide('Blockly.PHP.procedures');
goog.require('Blockly.PHP');
Blockly.PHP['procedures_defreturn'] = function(block) {
// Define a procedure with a return value.
// First, add a 'global' statement for every variable that is not shadowed by
// a local parameter.
var globals = [];
var varName;
var workspace = block.workspace;
var variables = Blockly.Variables.allUsedVarModels(workspace) || [];
for (var i = 0, variable; variable = variables[i]; i++) {