Skip to content

Commit

Permalink
Add 'use strict' to generated JS when -s STRICT is used (#9265)
Browse files Browse the repository at this point in the history
See #8317
  • Loading branch information
sbc100 authored Aug 21, 2019
1 parent 43b2d41 commit 2fe944f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,7 @@ def check(input_file):

if shared.Settings.STRICT:
shared.Settings.DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR = 1
shared.Settings.STRICT_JS = 1

if AUTODEBUG:
shared.Settings.AUTODEBUG = 1
Expand Down
4 changes: 4 additions & 0 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -813,8 +813,12 @@ var LINKABLE = 0;
// * DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR is enabled
// * The C define EMSCRIPTEN is not defined (__EMSCRIPTEN__ always is, and
// is the correct thing to use).
// * STRICT_JS is enabled
var STRICT = 0;

// Add "use strict;" to generated JS
var STRICT_JS = 0;

// If set to 1, we will warn on any undefined symbols that are not resolved by
// the library_*.js files. Note that it is common in large projects to not
// implement everything, when you know what is not going to actually be called
Expand Down
4 changes: 4 additions & 0 deletions src/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.

#if STRICT_JS
"use strict;"

#endif
#if SIDE_MODULE == 0
// The Module object: Our interface to the outside world. We import
// and export values on it. There are various ways Module can be used:
Expand Down

0 comments on commit 2fe944f

Please sign in to comment.