Loose: yield support.
This commit is contained in:
parent
80f8d527ff
commit
1589a959fa
@ -271,7 +271,7 @@
|
||||
return (token.type === tt.eof || token.type === tt.braceR || newline.test(input.slice(lastEnd, token.start)));
|
||||
}
|
||||
function semicolon() {
|
||||
eat(tt.semi);
|
||||
return eat(tt.semi);
|
||||
}
|
||||
|
||||
function expect(type) {
|
||||
@ -734,6 +734,18 @@
|
||||
case tt._new:
|
||||
return parseNew();
|
||||
|
||||
case tt._yield:
|
||||
var node = startNode();
|
||||
next();
|
||||
if (semicolon() || canInsertSemicolon()) {
|
||||
node.delegate = false;
|
||||
node.argument = null;
|
||||
} else {
|
||||
node.delegate = eat(tt.star);
|
||||
node.argument = parseExpression(true);
|
||||
}
|
||||
return finishNode(node, "YieldExpression");
|
||||
|
||||
default:
|
||||
return dummyIdent();
|
||||
}
|
||||
|
||||
@ -13,8 +13,9 @@ var stats, modes = {
|
||||
parse: (typeof require === "undefined") ? window.acorn_loose : require("../acorn_loose").parse_dammit,
|
||||
loose: true,
|
||||
filter: function (test) {
|
||||
var ecmaVersion = (test.options || {}).ecmaVersion || 5;
|
||||
return ecmaVersion <= 6;
|
||||
var opts = test.options || {};
|
||||
if (opts.loose === false) return false;
|
||||
return (opts.ecmaVersion || 5) <= 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13714,6 +13714,7 @@ test("yield* 10", {
|
||||
}
|
||||
}, {
|
||||
ecmaVersion: 6,
|
||||
loose: false,
|
||||
ranges: true,
|
||||
locations: true
|
||||
});
|
||||
@ -13778,6 +13779,7 @@ test("e => yield* 10", {
|
||||
}
|
||||
}, {
|
||||
ecmaVersion: 6,
|
||||
loose: false,
|
||||
ranges: true,
|
||||
locations: true
|
||||
});
|
||||
@ -13851,6 +13853,7 @@ test("(function () { yield* 10 })", {
|
||||
}
|
||||
}, {
|
||||
ecmaVersion: 6,
|
||||
loose: false,
|
||||
ranges: true,
|
||||
locations: true
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user