language_in=ECMASCRIPT5_STRICT no longer adds "use strict"

159 views
Skip to first unread message

Erik Neumann

unread,
Jun 23, 2016, 2:03:25 PM6/23/16
to Closure Compiler Discuss
Using the compiler option
    --language_in=ECMASCRIPT5_STRICT
no longer adds "use strict" to the resulting code.

This was working recently. See for example this discussion from Feb 14, 2016.

I'm guessing that all the recent changes for modules have affected this feature?  Or am I just doing something wrong?  I didn't see anything about this in a quick scan of the release notes, but maybe I missed it?  Should I file an issue on this?

Here is the complete command & compiler version

Version: v20160315-213-g4787bb5

java -jar ../javascript/closure-compiler/build/compiler.jar --entry_point=goog:myphysicslab.sims.pendulum.PendulumApp --compilation_level=ADVANCED --define=goog.DEBUG=true '--define=goog.LOCALE='\''en'\''' --define=myphysicslab.lab.util.UtilityCore.ADVANCED=true --generate_exports --js=../closure-library/ --js=src --jscomp_error=accessControls --jscomp_error=ambiguousFunctionDecl --jscomp_error=checkTypes --jscomp_error=checkVars --jscomp_error=const --jscomp_error=constantProperty --jscomp_error=fileoverviewTags --jscomp_error=globalThis --jscomp_error=invalidCasts --jscomp_error=misplacedTypeAnnotation --jscomp_error=missingProperties --jscomp_error=missingProvide --jscomp_error=missingRequire --jscomp_error=missingReturn --jscomp_error=newCheckTypes --jscomp_error=strictModuleDepCheck --jscomp_error=suspiciousCode --jscomp_error=typeInvalidation --jscomp_error=undefinedNames --jscomp_error=undefinedVars --jscomp_error=unknownDefines --jscomp_error=uselessCode --jscomp_error=visibility --language_in=ECMASCRIPT5_STRICT --dependency_mode=STRICT --warning_level=VERBOSE '--output_wrapper=(function(){%output%}).call(window)'

Here is the start of the resulting compiled code, note there is no "use strict".

(function(){var f,ba=this;function n(a){return void 0!==a}

I also need "use strict" to be added when compilation_level=SIMPLE.

I've been unable to find anything about this from web searches, not even anything stating that language_in=ECMASCRIPT5_STRICT should be adding "use strict" to the resulting code.

I've been trying to add the "use strict" to the output_wrapper, but the bash quoting rules and the presence of a space in "use strict" has so far prevented this from succeeding.  I suppose I can write a program to manually insert "use strict" into the code after compilation, but that seems rather ugly -- it's something that the compiler should be able to do.

--ErikN


Chad Killingsworth

unread,
Jun 23, 2016, 2:05:03 PM6/23/16
to Closure Compiler Discuss
Why are you not setting lanugage_out? Does it work if you do?

Chad

Erik Neumann

unread,
Jun 23, 2016, 2:24:46 PM6/23/16
to closure-comp...@googlegroups.com
Doh.  Yes, that does it.
--ErikN

--

---
You received this message because you are subscribed to the Google Groups "Closure Compiler Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to closure-compiler-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/closure-compiler-discuss/e14f3858-d8d8-4022-b5e9-4f4ef25c5dfd%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages