Hygiene broken in template literals that use interpolation
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);