Skip to content

Commit

Permalink
Limit the use of use strict in JS output
Browse files Browse the repository at this point in the history
`use strict` is not supported in function that take default parameters:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Strict_Non_Simple_Params

This is the case when `MODULARIZE` is set.

`use strict` is redundant when building a ES6 module.

Fixes: #18610
  • Loading branch information
sbc100 committed Jan 27, 2023
1 parent 3c0c0b9 commit a6e7d91
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1916,8 +1916,12 @@ def phase_linker_setup(options, state, newargs):
# Require explicit -lfoo.js flags to link with JS libraries.
default_setting('AUTO_JS_LIBRARIES', 0)

if settings.STRICT_JS and (settings.MODULARIZE or settings.EXPORT_ES6):
exit_with_error("STRICT_JS doesn't work with MODULARIZE or EXPORT_ES6")

if settings.STRICT:
default_setting('STRICT_JS', 1)
if not settings.MODULARIZE and not settings.EXPORT_ES6:
default_setting('STRICT_JS', 1)
default_setting('AUTO_JS_LIBRARIES', 0)
default_setting('AUTO_NATIVE_LIBRARIES', 0)
default_setting('AUTO_ARCHIVE_INDEXES', 0)
Expand Down

0 comments on commit a6e7d91

Please sign in to comment.