summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/ParseNode.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-12-13 20:55:24 -0500
committerGaming4JC <g4jc@hyperbola.info>2019-12-17 06:25:25 -0500
commit79b5eb14bc5f8495d20147957cda5f4e5fc8186a (patch)
tree9a87a9dc31037cc09d2d84bdd0850048595dba64 /js/src/frontend/ParseNode.cpp
parentcba3f6142704ce228aaf54b5c98c6ef5b3f871be (diff)
downloadUXP-79b5eb14bc5f8495d20147957cda5f4e5fc8186a.tar
UXP-79b5eb14bc5f8495d20147957cda5f4e5fc8186a.tar.gz
UXP-79b5eb14bc5f8495d20147957cda5f4e5fc8186a.tar.lz
UXP-79b5eb14bc5f8495d20147957cda5f4e5fc8186a.tar.xz
UXP-79b5eb14bc5f8495d20147957cda5f4e5fc8186a.zip
Bug 1343481 - Part 7: Add BytecodeEmitter::emitDotGenerator and make yield/await nodes unary.
Tag #1287
Diffstat (limited to 'js/src/frontend/ParseNode.cpp')
-rw-r--r--js/src/frontend/ParseNode.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp
index 5fe64e3d3..42ae9451a 100644
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -286,22 +286,24 @@ PushNodeChildren(ParseNode* pn, NodeStack* stack)
return PushResult::Recyclable;
}
- // The left half is the expression being yielded. The right half is
- // internal goop: a name reference to the invisible '.generator' local
- // variable, or an assignment of a PNK_GENERATOR node to the '.generator'
- // local, for a synthesized, prepended initial yield. Yum!
+ // The child is an assignment of a PNK_GENERATOR node to the
+ // '.generator' local, for a synthesized, prepended initial yield.
+ case PNK_INITIALYIELD: {
+ MOZ_ASSERT(pn->isArity(PN_UNARY));
+ MOZ_ASSERT(pn->pn_kid->isKind(PNK_ASSIGN) &&
+ pn->pn_kid->pn_left->isKind(PNK_NAME) &&
+ pn->pn_kid->pn_right->isKind(PNK_GENERATOR));
+ stack->push(pn->pn_kid);
+ return PushResult::Recyclable;
+ }
+
+ // The child is the expression being yielded.
case PNK_YIELD_STAR:
case PNK_YIELD:
case PNK_AWAIT: {
- MOZ_ASSERT(pn->isArity(PN_BINARY));
- MOZ_ASSERT(pn->pn_right);
- MOZ_ASSERT(pn->pn_right->isKind(PNK_NAME) ||
- (pn->pn_right->isKind(PNK_ASSIGN) &&
- pn->pn_right->pn_left->isKind(PNK_NAME) &&
- pn->pn_right->pn_right->isKind(PNK_GENERATOR)));
- if (pn->pn_left)
- stack->push(pn->pn_left);
- stack->push(pn->pn_right);
+ MOZ_ASSERT(pn->isArity(PN_UNARY));
+ if (pn->pn_kid)
+ stack->push(pn->pn_kid);
return PushResult::Recyclable;
}