implement AST_Yield spidermonkey AST
This commit is contained in:
parent
a69b51e25d
commit
2655e84f0d
|
|
@ -464,6 +464,7 @@
|
||||||
map("ForInStatement", AST_ForIn, "left>init, right>object, body>body");
|
map("ForInStatement", AST_ForIn, "left>init, right>object, body>body");
|
||||||
map("ForOfStatement", AST_ForOf, "left>init, right>object, body>body");
|
map("ForOfStatement", AST_ForOf, "left>init, right>object, body>body");
|
||||||
map("AwaitExpression", AST_Await, "argument>expression");
|
map("AwaitExpression", AST_Await, "argument>expression");
|
||||||
|
map("YieldExpression", AST_Yield, "argument>expression, delegate=is_star");
|
||||||
map("DebuggerStatement", AST_Debugger);
|
map("DebuggerStatement", AST_Debugger);
|
||||||
map("VariableDeclarator", AST_VarDef, "id>name, init>value");
|
map("VariableDeclarator", AST_VarDef, "id>name, init>value");
|
||||||
map("CatchClause", AST_Catch, "param>argname, body%body");
|
map("CatchClause", AST_Catch, "param>argname, body%body");
|
||||||
|
|
|
||||||
|
|
@ -1726,6 +1726,7 @@ function parse($TEXT, options) {
|
||||||
croak("Unexpected yield expression outside generator function",
|
croak("Unexpected yield expression outside generator function",
|
||||||
S.prev.line, S.prev.col, S.prev.pos);
|
S.prev.line, S.prev.col, S.prev.pos);
|
||||||
}
|
}
|
||||||
|
var start = S.token;
|
||||||
var star = false;
|
var star = false;
|
||||||
var has_expression = true;
|
var has_expression = true;
|
||||||
|
|
||||||
|
|
@ -1749,8 +1750,10 @@ function parse($TEXT, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AST_Yield({
|
return new AST_Yield({
|
||||||
|
start : start,
|
||||||
is_star : star,
|
is_star : star,
|
||||||
expression : has_expression ? expression() : null
|
expression : has_expression ? expression() : null,
|
||||||
|
end : prev()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,13 @@ export {A1, B1} from "a.js";
|
||||||
export {C};
|
export {C};
|
||||||
|
|
||||||
(a, [b], {c:foo = 3}, ...d) => null;
|
(a, [b], {c:foo = 3}, ...d) => null;
|
||||||
() => {}
|
() => {};
|
||||||
|
|
||||||
async function f() { }
|
async function f() { }
|
||||||
function*gen() { }
|
function*gen() {
|
||||||
|
yield 1;
|
||||||
|
yield* 2;
|
||||||
|
}
|
||||||
|
|
||||||
class Class extends Object {
|
class Class extends Object {
|
||||||
constructor(...args) {
|
constructor(...args) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user