Skip to content

Commit 9c2cad5

Browse files
committed
Don't recognize directives when ECMAVersion < 5
FIX: Fix an issue where the tree contained `directive` properties in when parsing with a language version that doesn't support them. Closes #1126
1 parent 04bdf9a commit 9c2cad5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

acorn/src/statement.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,7 @@ pp.adaptDirectivePrologue = function(statements) {
10511051
}
10521052
pp.isDirectiveCandidate = function(statement) {
10531053
return (
1054+
this.options.ecmaVersion >= 5 &&
10541055
statement.type === "ExpressionStatement" &&
10551056
statement.expression.type === "Literal" &&
10561057
typeof statement.expression.value === "string" &&

0 commit comments

Comments
 (0)