Closed moniika closed 3 years ago
The Closure Compiler renames all sorts of things to make the code shorter. In this case, Blockly.Block.prototype.getFieldValue
is being renamed to x
(and y
is some other function I don't immediately recognize). The result is that x
and y
are global variables when compiled.
Blockly's JS generator scans the current environment for globals, and renames any conflicts. That deals with stuff like Math
, or encodeURIComponent
that would cause a conflict in any environment. In this case renaming x
and y
is not needed since those two globals only exist in the browser's environment, not the JS-Interpreter's sandbox.
To summarize, the renaming is not required, but it is harmless, and it is the expected behaviour of Blockly's code generators.
In any event, if this were to be addressed, it would be on Blockly's side, not Blockly Games.
Describe the bug
Generated code with variables x and y, renames them to x2 and y2, unlike running on uncompressed which does not rename these variables.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Compressed should not rename variables x and y.
Desktop (please complete the following information):
Additional context
Can be repro'd on blockly.games or locally using code on master. Does not repro on Blockly developer playground.