File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -553,7 +553,7 @@ public Label visit(Program nd, Context c) {
553553 if (sourceType .hasLocalScope ()) {
554554 Label moduleScopeKey = trapwriter .globalID ("module;{" + locationManager .getFileLabel () + "}," + locationManager .getStartLine () + "," + locationManager .getStartColumn ());
555555 scopeManager .enterScope (3 , moduleScopeKey , toplevelLabel );
556- scopeManager .addVariables (sourceType .getPredefinedLocals ());
556+ scopeManager .addVariables (sourceType .getPredefinedLocals (platform ));
557557 trapwriter .addTuple ("isModule" , toplevelLabel );
558558 }
559559
Original file line number Diff line number Diff line change @@ -107,12 +107,19 @@ public boolean isStrictMode() {
107107 * <p/>
108108 * If this source type has no local scope, the empty set is returned.
109109 */
110- public Set <String > getPredefinedLocals () {
110+ public Set <String > getPredefinedLocals (Platform platform ) {
111111 switch (this ) {
112112 case CLOSURE_MODULE :
113113 return closureLocals ;
114114 case COMMONJS_MODULE :
115115 return commonJsLocals ;
116+ case MODULE :
117+ if (platform == Platform .NODE ) {
118+ // An ES2015 module that is compiled to a Node.js module effectively has the locals
119+ // from Node.js even if they are not part of the ES2015 standard.
120+ return commonJsLocals ;
121+ }
122+ return Collections .emptySet ();
116123 default :
117124 return Collections .emptySet ();
118125 }
You can’t perform that action at this time.
0 commit comments