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
With #4811 merged we've decoupled ES6 module emit from the ES6 language level, allowing us to emit other module forms when targeting ES6. This brings up another interesting question - we parse all external modules in strict mode, ES6 or not, when this is only a requirement for ES6 modules. Should we fix this and make the parse dependent on the module selection? Or should we emit "use strict"; in non-ES6 forms so reality matches the parser? Even before #4811 we've actually had this wrong:
import*asfoofrom"./foo";with(foo){}
We forbid the with as per strict mode, but we're emitting an amd module without a "use strict"; indicator. To be correct, when not targeting es6 modules, we should either disable strict mode when parsing or emit a "use strict";.
The text was updated successfully, but these errors were encountered:
If in fact you are parsing all modules in strict mode, irrespective of the target, then it makes sense in my mind to emit the prolog in other module targets. My comment in #3576 was of a worry that it might cause breakage or surprises, but since essentially if external modules have always been parsed in strict mode, if there is breakage, then it was in theory a bad emit and should break so it can be addressed.
With #4811 merged we've decoupled ES6 module emit from the ES6 language level, allowing us to emit other module forms when targeting ES6. This brings up another interesting question - we parse all external modules in strict mode, ES6 or not, when this is only a requirement for ES6 modules. Should we fix this and make the parse dependent on the module selection? Or should we emit
"use strict";
in non-ES6 forms so reality matches the parser? Even before #4811 we've actually had this wrong:We forbid the
with
as per strict mode, but we're emitting an amd module without a"use strict";
indicator. To be correct, when not targeting es6 modules, we should either disable strict mode when parsing or emit a"use strict";
.The text was updated successfully, but these errors were encountered: