Make classes implicitly strict mode

This commit is contained in:
Anthony Van de Gejuchte
2016-09-11 15:06:10 +02:00
parent 88f6ff38d1
commit 947b8750e8
5 changed files with 71 additions and 5 deletions

View File

@@ -2039,6 +2039,9 @@ function parse($TEXT, options) {
function class_(KindOfClass) {
var start, method, class_name, extends_, a = [];
S.input.push_directives_stack(); // Push directive stack, but not scope stack
S.input.add_directive("use strict");
if (S.token.type == "name" && S.token.value != "extends") {
class_name = as_symbol(KindOfClass === AST_DefClass ? AST_SymbolDefClass : AST_SymbolClass);
}
@@ -2063,6 +2066,8 @@ function parse($TEXT, options) {
if (is("punc", ";")) { next(); }
}
S.input.pop_directives_stack();
next();
return new KindOfClass({