You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
This is similar to another issue that I fixed, but not quite the same.
I've reproduced the problem with the latest version of the compiler code by following the example here.
RemoveUnusedCode sees only one reference to MyClass, and it's an instanceof check, so it believes no objects of MyClass get created and replaces the instanceof check with false.
Then RemoveUnusedCode removes the MyClass name from the class definition.
Using Closure Compiler v20200517
in.js:
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:
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.The text was updated successfully, but these errors were encountered: