summaryrefslogtreecommitdiffstats
path: root/js/src/builtin
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-07-14 16:37:57 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:47 -0400
commit091d00f1bd22f821d3926c46dd1d6cf7fbc746f4 (patch)
treec68c6e96a4104ed0a78807c79f3601cd6f3eee4e /js/src/builtin
parent638a904d0dbe4bcc5a625ea472c7e65ac75dbc06 (diff)
downloadUXP-091d00f1bd22f821d3926c46dd1d6cf7fbc746f4.tar
UXP-091d00f1bd22f821d3926c46dd1d6cf7fbc746f4.tar.gz
UXP-091d00f1bd22f821d3926c46dd1d6cf7fbc746f4.tar.lz
UXP-091d00f1bd22f821d3926c46dd1d6cf7fbc746f4.tar.xz
UXP-091d00f1bd22f821d3926c46dd1d6cf7fbc746f4.zip
1339395 - Part 2: Add parser support for rest and spread object properties.
Diffstat (limited to 'js/src/builtin')
-rw-r--r--js/src/builtin/ReflectParse.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp
index 3495ede2f..8e8bb2417 100644
--- a/js/src/builtin/ReflectParse.cpp
+++ b/js/src/builtin/ReflectParse.cpp
@@ -3222,6 +3222,8 @@ ASTSerializer::property(ParseNode* pn, MutableHandleValue dst)
return expression(pn->pn_kid, &val) &&
builder.prototypeMutation(val, &pn->pn_pos, dst);
}
+ if (pn->isKind(PNK_SPREAD))
+ return expression(pn, dst);
PropKind kind;
switch (pn->getOp()) {
@@ -3342,6 +3344,16 @@ ASTSerializer::objectPattern(ParseNode* pn, MutableHandleValue dst)
return false;
for (ParseNode* propdef = pn->pn_head; propdef; propdef = propdef->pn_next) {
+ if (propdef->isKind(PNK_SPREAD)) {
+ RootedValue target(cx);
+ RootedValue spread(cx);
+ if (!pattern(propdef->pn_kid, &target))
+ return false;
+ if(!builder.spreadExpression(target, &propdef->pn_pos, &spread))
+ return false;
+ elts.infallibleAppend(spread);
+ continue;
+ }
LOCAL_ASSERT(propdef->isKind(PNK_MUTATEPROTO) != propdef->isOp(JSOP_INITPROP));
RootedValue key(cx);