Skip to content

Commit 9a4c54d

Browse files
committed
specify es6 in the parser
1 parent 5bd10d6 commit 9a4c54d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎lib/Parser.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ Parser.prototype.parseCalculatedString = function parseCalculatedString(expressi
853853
});
854854

855855
Parser.prototype.parse = function parse(source, initialState) {
856-
var ast = acorn.parse(source, {ranges: true, locations: true});
856+
var ast = acorn.parse(source, {ranges: true, locations: true, ecmaVersion: 6});
857857
if(!ast || typeof ast !== "object")
858858
throw new Error("Source couldn't be parsed");
859859
var oldScope = this.scope;
@@ -872,7 +872,7 @@ Parser.prototype.parse = function parse(source, initialState) {
872872
};
873873

874874
Parser.prototype.evaluate = function evaluate(source) {
875-
var ast = acorn.parse("("+source+")", {ranges: true, locations: true});
875+
var ast = acorn.parse("("+source+")", {ranges: true, locations: true, ecmaVersion: 6});
876876
if(!ast || typeof ast !== "object" || ast.type !== "Program")
877877
throw new Error("evaluate: Source couldn't be parsed");
878878
if(ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement")

0 commit comments

Comments
 (0)