Assume a regular JS file with no macros involved at all:
var test = { someField: 10 };
console.log(`test.someField = ${test.someField}`);
One would expect that the compilation of regular JS code containing no macros yields equivalent code.
However, this is the resulting code after compilation:
var test_0 = { someField: 10 };
console.log(`test.someField = ${test.someField}`);
Notice how the variable test has been renamed to test_0 for hygiene, but test in the interpolation within the template literal is unchanged.
This bug does not occur when avoiding template literals and writing it as
console.log('test.someField = ' + test.someField);
this bit me today. is it possible to disable hygiene to prevent renaming? this would be useful for simple cases where we are not inserting any new variables.
Assume a regular JS file with no macros involved at all:
One would expect that the compilation of regular JS code containing no macros yields equivalent code. However, this is the resulting code after compilation:
Notice how the variable
test
has been renamed totest_0
for hygiene, buttest
in the interpolation within the template literal is unchanged.This bug does not occur when avoiding template literals and writing it as
console.log('test.someField = ' + test.someField);