loop over all directives to check for use strict

This commit is contained in:
Sebastian McKenzie 2015-09-15 06:16:57 +01:00
parent 8a13465f80
commit eae82799e6

View File

@ -793,9 +793,14 @@ pp.parseFunctionBody = function (node, allowExpression) {
if (allowExpression) checkLVal = true; if (allowExpression) checkLVal = true;
// normal function // normal function
if (!isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) { if (!isExpression && node.body.directives.length) {
checkLVal = true; for (var directive of (node.body.directives: Array)) {
checkLValStrict = true; if (directive.value === "use strict") {
checkLVal = true;
checkLValStrict = true;
break;
}
}
} }
if (checkLVal) { if (checkLVal) {