Closed
Description
Using Closure Compiler v20200517
in.js:
window.Class = class MyClass {
constructor()
{
if (this instanceof MyClass)
console.log("test");
}
}
new window.Class();
Note if you run this in a browser console it logs "test".
Compile with the following options:
java -jar ./closure-compiler.jar --js in.js --js_output_file out.js --compilation_level ADVANCED --language_in ECMASCRIPT_2015 --language_out ECMASCRIPT_2015
out.js looks like this:
window.a=class{
constructor(){}
};
new window.a;
Note it has incorrectly removed the console log. Note the class name has been removed, which may have then caused this instanceof MyClass
to be identified as false and therefore dead code.
Metadata
Metadata
Assignees
Labels
No labels