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

@@ -1292,12 +1292,15 @@ TreeWalker.prototype = {
this.directives = Object.create(this.directives);
} else if (node instanceof AST_Directive) {
this.directives[node.value] = this.directives[node.value] ? "up" : true;
} else if (node instanceof AST_Class) {
this.directives = Object.create(this.directives);
this.directives["use strict"] = this.directives["use strict"] ? "up" : true;
}
this.stack.push(node);
},
pop: function(node) {
this.stack.pop();
if (node instanceof AST_Lambda) {
if (node instanceof AST_Lambda || node instanceof AST_Class) {
this.directives = Object.getPrototypeOf(this.directives);
}
},