summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/FullParseHandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/frontend/FullParseHandler.h')
-rw-r--r--js/src/frontend/FullParseHandler.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h
index 6ab93f3f9..44694298b 100644
--- a/js/src/frontend/FullParseHandler.h
+++ b/js/src/frontend/FullParseHandler.h
@@ -440,20 +440,24 @@ class FullParseHandler
return true;
}
- ParseNode* newYieldExpression(uint32_t begin, ParseNode* value, ParseNode* gen,
- JSOp op = JSOP_YIELD) {
+ ParseNode* newInitialYieldExpression(uint32_t begin, ParseNode* gen) {
+ TokenPos pos(begin, begin + 1);
+ return new_<UnaryNode>(PNK_INITIALYIELD, JSOP_INITIALYIELD, pos, gen);
+ }
+
+ ParseNode* newYieldExpression(uint32_t begin, ParseNode* value) {
TokenPos pos(begin, value ? value->pn_pos.end : begin + 1);
- return new_<BinaryNode>(PNK_YIELD, op, pos, value, gen);
+ return new_<UnaryNode>(PNK_YIELD, JSOP_YIELD, pos, value);
}
- ParseNode* newYieldStarExpression(uint32_t begin, ParseNode* value, ParseNode* gen) {
+ ParseNode* newYieldStarExpression(uint32_t begin, ParseNode* value) {
TokenPos pos(begin, value->pn_pos.end);
- return new_<BinaryNode>(PNK_YIELD_STAR, JSOP_NOP, pos, value, gen);
+ return new_<UnaryNode>(PNK_YIELD_STAR, JSOP_NOP, pos, value);
}
- ParseNode* newAwaitExpression(uint32_t begin, ParseNode* value, ParseNode* gen) {
+ ParseNode* newAwaitExpression(uint32_t begin, ParseNode* value) {
TokenPos pos(begin, value ? value->pn_pos.end : begin + 1);
- return new_<BinaryNode>(PNK_AWAIT, JSOP_AWAIT, pos, value, gen);
+ return new_<UnaryNode>(PNK_AWAIT, JSOP_AWAIT, pos, value);
}
// Statements
@@ -506,8 +510,7 @@ class FullParseHandler
if (!genInit)
return false;
- ParseNode* initialYield = newYieldExpression(yieldPos.begin, nullptr, genInit,
- JSOP_INITIALYIELD);
+ ParseNode* initialYield = newInitialYieldExpression(yieldPos.begin, genInit);
if (!initialYield)
return false;