diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 1153b0896f..3d3f5ce670 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -1060,7 +1060,7 @@ BytecodeEmitter::checkSideEffects(ParseNode* pn, bool* answer) case PNK_RAW_UNDEFINED: case PNK_ELISION: case PNK_GENERATOR: - MOZ_ASSERT(pn->isArity(PN_NULLARY)); + MOZ_ASSERT(pn->is()); *answer = false; return true; @@ -1096,9 +1096,17 @@ BytecodeEmitter::checkSideEffects(ParseNode* pn, bool* answer) return true; case PNK_BREAK: + MOZ_ASSERT(pn->is()); + *answer = true; + return true; + case PNK_CONTINUE: + MOZ_ASSERT(pn->is()); + *answer = true; + return true; + case PNK_DEBUGGER: - MOZ_ASSERT(pn->isArity(PN_NULLARY)); + MOZ_ASSERT(pn->is()); *answer = true; return true; diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.cpp index fcc94c34fa..a5383c1c7c 100644 --- a/js/src/frontend/FoldConstants.cpp +++ b/js/src/frontend/FoldConstants.cpp @@ -101,8 +101,12 @@ ContainsHoistedDeclaration(ExclusiveContext* cx, ParseNode* node, bool* result) // Statements with no sub-components at all. case PNK_NOP: // induced by function f() {} function f() {} + MOZ_ASSERT(node->is()); + *result = false; + return true; + case PNK_DEBUGGER: - MOZ_ASSERT(node->isArity(PN_NULLARY)); + MOZ_ASSERT(node->is()); *result = false; return true; @@ -1655,13 +1659,22 @@ Fold(ExclusiveContext* cx, ParseNode** pnp, Parser& parser, bo case PNK_NULL: case PNK_RAW_UNDEFINED: case PNK_ELISION: - case PNK_DEBUGGER: - case PNK_BREAK: - case PNK_CONTINUE: case PNK_GENERATOR: case PNK_EXPORT_BATCH_SPEC: case PNK_POSHOLDER: - MOZ_ASSERT(pn->isArity(PN_NULLARY)); + MOZ_ASSERT(pn->is()); + return true; + + case PNK_DEBUGGER: + MOZ_ASSERT(pn->is()); + return true; + + case PNK_BREAK: + MOZ_ASSERT(pn->is()); + return true; + + case PNK_CONTINUE: + MOZ_ASSERT(pn->is()); return true; case PNK_OBJECT_PROPERTY_NAME: diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h index dca7a69cf2..6b81d153ab 100644 --- a/js/src/frontend/FullParseHandler.h +++ b/js/src/frontend/FullParseHandler.h @@ -151,7 +151,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) return new_(value, decimalPoint, pos); } - ParseNode* newBooleanLiteral(bool cond, const TokenPos& pos) { + BooleanLiteralType newBooleanLiteral(bool cond, const TokenPos& pos) { return new_(cond, pos); } @@ -195,11 +195,11 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) return new_(pos, thisName); } - ParseNode* newNullLiteral(const TokenPos& pos) { + NullLiteralType newNullLiteral(const TokenPos& pos) { return new_(pos); } - ParseNode* newRawUndefinedLiteral(const TokenPos& pos) { + RawUndefinedLiteralType newRawUndefinedLiteral(const TokenPos& pos) { return new_(pos); } @@ -251,7 +251,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) return new_(kind, JSOP_NOP, pos, kid); } - ParseNode* newNullary(ParseNodeKind kind, JSOp op, const TokenPos& pos) { + NullaryNodeType newNullary(ParseNodeKind kind, JSOp op, const TokenPos& pos) { return new_(kind, op, pos); } @@ -311,7 +311,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) } MOZ_MUST_USE bool addElision(ListNodeType literal, const TokenPos& pos) { - ParseNode* elision = new_(PNK_ELISION, pos); + NullaryNode* elision = new_(PNK_ELISION, pos); if (!elision) return false; literal->append(elision); @@ -377,10 +377,10 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) ClassNamesType newClassNames(ParseNode* outer, ParseNode* inner, const TokenPos& pos) { return new_(outer, inner, pos); } - BinaryNodeType newNewTarget(ParseNode* newHolder, ParseNode* targetHolder) { + BinaryNodeType newNewTarget(NullaryNodeType newHolder, NullaryNodeType targetHolder) { return new_(PNK_NEWTARGET, JSOP_NOP, newHolder, targetHolder); } - ParseNode* newPosHolder(const TokenPos& pos) { + NullaryNodeType newPosHolder(const TokenPos& pos) { return new_(PNK_POSHOLDER, pos); } UnaryNodeType newSuperBase(Node thisName, const TokenPos& pos) { @@ -536,7 +536,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) MOZ_ASSERT(stmtList->isKind(PNK_STATEMENTLIST)); TokenPos yieldPos(stmtList->pn_pos.begin, stmtList->pn_pos.begin + 1); - ParseNode* makeGen = new_(PNK_GENERATOR, yieldPos); + NullaryNode* makeGen = new_(PNK_GENERATOR, yieldPos); if (!makeGen) return false; @@ -560,7 +560,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) return newBinary(PNK_SETTHIS, thisName, val); } - ParseNode* newEmptyStatement(const TokenPos& pos) { + UnaryNodeType newEmptyStatement(const TokenPos& pos) { return new_(PNK_SEMI, JSOP_NOP, pos, (ParseNode*) nullptr); } @@ -657,11 +657,11 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) return new_(expr, body, begin); } - ParseNode* newContinueStatement(PropertyName* label, const TokenPos& pos) { + ContinueStatementType newContinueStatement(PropertyName* label, const TokenPos& pos) { return new_(label, pos); } - ParseNode* newBreakStatement(PropertyName* label, const TokenPos& pos) { + BreakStatementType newBreakStatement(PropertyName* label, const TokenPos& pos) { return new_(label, pos); } @@ -690,7 +690,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) return new_(PNK_TRY, JSOP_NOP, body, catchList, finallyBlock, pos); } - ParseNode* newDebuggerStatement(const TokenPos& pos) { + DebuggerStatementType newDebuggerStatement(const TokenPos& pos) { return new_(pos); } diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.cpp index 92a97ae8b7..affad7a239 100644 --- a/js/src/frontend/NameFunctions.cpp +++ b/js/src/frontend/NameFunctions.cpp @@ -388,12 +388,21 @@ class NameResolver case PNK_RAW_UNDEFINED: case PNK_ELISION: case PNK_GENERATOR: - case PNK_BREAK: - case PNK_CONTINUE: - case PNK_DEBUGGER: case PNK_EXPORT_BATCH_SPEC: case PNK_POSHOLDER: - MOZ_ASSERT(cur->isArity(PN_NULLARY)); + MOZ_ASSERT(cur->is()); + break; + + case PNK_DEBUGGER: + MOZ_ASSERT(cur->is()); + break; + + case PNK_BREAK: + MOZ_ASSERT(cur->is()); + break; + + case PNK_CONTINUE: + MOZ_ASSERT(cur->is()); break; case PNK_OBJECT_PROPERTY_NAME: @@ -801,7 +810,7 @@ class NameResolver ListNode* list = &cur->as(); ParseNode* item = list->head(); if (!isImport && item && item->isKind(PNK_EXPORT_BATCH_SPEC)) { - MOZ_ASSERT(item->isArity(PN_NULLARY)); + MOZ_ASSERT(item->is()); break; } for (ParseNode* item : list->contents()) { diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index 5b1a838c47..0e1492f0eb 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -183,14 +183,23 @@ PushNodeChildren(ParseNode* pn, NodeStack* stack) case PNK_RAW_UNDEFINED: case PNK_ELISION: case PNK_GENERATOR: - case PNK_BREAK: - case PNK_CONTINUE: - case PNK_DEBUGGER: case PNK_EXPORT_BATCH_SPEC: case PNK_POSHOLDER: - MOZ_ASSERT(pn->isArity(PN_NULLARY)); + MOZ_ASSERT(pn->is()); return PushResult::Recyclable; + case PNK_DEBUGGER: + MOZ_ASSERT(pn->is()); + return PushResult::Recyclable; + + case PNK_BREAK: + MOZ_ASSERT(pn->is()); + return PushResult::Recyclable; + + case PNK_CONTINUE: + MOZ_ASSERT(pn->is()); + return PushResult::Recyclable; + case PNK_OBJECT_PROPERTY_NAME: case PNK_STRING: case PNK_TEMPLATE_STRING: @@ -662,7 +671,7 @@ ParseNode::dump(int indent) { switch (pn_arity) { case PN_NULLARY: - ((NullaryNode*) this)->dump(); + as().dump(); return; case PN_UNARY: as().dump(indent); @@ -688,6 +697,9 @@ ParseNode::dump(int indent) case PN_REGEXP: as().dump(indent); return; + case PN_LOOP: + as().dump(indent); + return; case PN_SCOPE: ((LexicalScopeNode*) this)->dump(indent); return; @@ -731,6 +743,18 @@ RegExpLiteral::dump(int indent) fprintf(stderr, "(%s)", parseNodeNames[size_t(getKind())]); } +void +LoopControlStatement::dump(int indent) +{ + const char* name = parseNodeNames[size_t(getKind())]; + fprintf(stderr, "(%s", name); + if (label()) { + fprintf(stderr, " "); + label()->dumpCharsNoNewline(); + } + fprintf(stderr, ")"); +} + void UnaryNode::dump(int indent) { diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h index f00e370e6f..12d79ab4f8 100644 --- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -321,9 +321,9 @@ IsTypeofKind(ParseNodeKind kind) * kid2: null or the catch guard expression * kid3: catch block statements * PNK_BREAK (BreakStatement) - * atom: label or null + * label: label or null * PNK_CONTINUE (ContinueStatement) - * atom: label or null + * label: label or null * PNK_WITH (BinaryNode) * left: head expr * right: body @@ -506,10 +506,12 @@ IsTypeofKind(ParseNodeKind kind) * regexp: RegExp model object * PNK_NUMBER (NumericLiteral) * value: double value of numeric literal - * PNK_TRUE, nullary pn_op: JSOp bytecode - * PNK_FALSE, - * PNK_NULL, - * PNK_RAW_UNDEFINED + * PNK_TRUE, PNK_FALSE (BooleanLiteral) + * pn_op: JSOp bytecode + * PNK_NULL (NullLiteral) + * pn_op: JSOp bytecode + * PNK_RAW_UNDEFINED (RawUndefinedLiteral) + * pn_op: JSOp bytecode * * PNK_THIS (UnaryNode) * kid: '.this' Name if function `this`, else nullptr @@ -524,7 +526,7 @@ IsTypeofKind(ParseNodeKind kind) * right: SuperCall * PNK_LEXICALSCOPE scope pn_u.scope.bindings: scope bindings * pn_u.scope.body: scope body - * PNK_GENERATOR nullary + * PNK_GENERATOR (NullaryNode) * PNK_INITIALYIELD (UnaryNode) * kid: generator object * PNK_YIELD, PNK_YIELD_STAR, PNK_AWAIT (UnaryNode) @@ -535,7 +537,7 @@ IsTypeofKind(ParseNodeKind kind) * if-guarded PNK_ARRAYPUSH * PNK_ARRAYPUSH unary pn_op: JSOP_ARRAYCOMP * pn_kid: array comprehension expression - * PNK_NOP nullary + * PNK_NOP (NullaryNode) */ enum ParseNodeArity { @@ -548,6 +550,7 @@ enum ParseNodeArity PN_NAME, /* name, label, string */ PN_NUMBER, /* numeric literal */ PN_REGEXP, /* regexp literal */ + PN_LOOP, /* loop control (break/continue) */ PN_SCOPE /* lexical scope */ }; @@ -567,9 +570,19 @@ enum ParseNodeArity macro(ListNode, ListNodeType, asList) \ macro(CallSiteNode, CallSiteNodeType, asCallSite) \ \ + macro(LoopControlStatement, LoopControlStatementType, asLoopControlStatement) \ + macro(BreakStatement, BreakStatementType, asBreakStatement) \ + macro(ContinueStatement, ContinueStatementType, asContinueStatement) \ + \ macro(NameNode, NameNodeType, asName) \ macro(LabeledStatement, LabeledStatementType, asLabeledStatement) \ \ + macro(NullaryNode, NullaryNodeType, asNullary) \ + macro(BooleanLiteral, BooleanLiteralType, asBooleanLiteral) \ + macro(DebuggerStatement, DebuggerStatementType, asDebuggerStatement) \ + macro(NullLiteral, NullLiteralType, asNullLiteral) \ + macro(RawUndefinedLiteral, RawUndefinedLiteralType, asRawUndefinedLiteral) \ + \ macro(NumericLiteral, NumericLiteralType, asNumericLiteral) \ \ macro(RegExpLiteral, RegExpLiteralType, asRegExpLiteral) \ @@ -580,10 +593,6 @@ enum ParseNodeArity macro(UnaryNode, UnaryNodeType, asUnary) \ macro(ThisLiteral, ThisLiteralType, asThisLiteral) -class LoopControlStatement; -class BreakStatement; -class ContinueStatement; - #define DECLARE_CLASS(typeName, longTypeName, asMethodName) \ class typeName; FOR_EACH_PARSENODE_SUBCLASS(DECLARE_CLASS) @@ -733,6 +742,7 @@ class ParseNode DecimalPoint decimalPoint; /* Whether the number has a decimal point */ } number; class { + private: friend class LoopControlStatement; PropertyName* label; /* target of break/continue statement */ } loopControl; @@ -819,13 +829,18 @@ class ParseNode #endif }; -struct NullaryNode : public ParseNode +class NullaryNode : public ParseNode { + public: NullaryNode(ParseNodeKind kind, const TokenPos& pos) : ParseNode(kind, JSOP_NOP, PN_NULLARY, pos) {} NullaryNode(ParseNodeKind kind, JSOp op, const TokenPos& pos) : ParseNode(kind, op, PN_NULLARY, pos) {} + static bool test(const ParseNode& node) { + return node.isArity(PN_NULLARY); + } + #ifdef DEBUG void dump(); #endif @@ -1587,7 +1602,7 @@ class LoopControlStatement : public ParseNode { protected: LoopControlStatement(ParseNodeKind kind, PropertyName* label, const TokenPos& pos) - : ParseNode(kind, JSOP_NOP, PN_NULLARY, pos) + : ParseNode(kind, JSOP_NOP, PN_LOOP, pos) { MOZ_ASSERT(kind == PNK_BREAK || kind == PNK_CONTINUE); pn_u.loopControl.label = label; @@ -1599,9 +1614,13 @@ class LoopControlStatement : public ParseNode return pn_u.loopControl.label; } +#ifdef DEBUG + void dump(int indent); +#endif + static bool test(const ParseNode& node) { bool match = node.isKind(PNK_BREAK) || node.isKind(PNK_CONTINUE); - MOZ_ASSERT_IF(match, node.isArity(PN_NULLARY)); + MOZ_ASSERT_IF(match, node.isArity(PN_LOOP)); MOZ_ASSERT_IF(match, node.isOp(JSOP_NOP)); return match; } @@ -1616,7 +1635,7 @@ class BreakStatement : public LoopControlStatement static bool test(const ParseNode& node) { bool match = node.isKind(PNK_BREAK); - MOZ_ASSERT_IF(match, node.isArity(PN_NULLARY)); + MOZ_ASSERT_IF(match, node.is()); MOZ_ASSERT_IF(match, node.isOp(JSOP_NOP)); return match; } @@ -1631,18 +1650,24 @@ class ContinueStatement : public LoopControlStatement static bool test(const ParseNode& node) { bool match = node.isKind(PNK_CONTINUE); - MOZ_ASSERT_IF(match, node.isArity(PN_NULLARY)); + MOZ_ASSERT_IF(match, node.is()); MOZ_ASSERT_IF(match, node.isOp(JSOP_NOP)); return match; } }; -class DebuggerStatement : public ParseNode +class DebuggerStatement : public NullaryNode { public: explicit DebuggerStatement(const TokenPos& pos) - : ParseNode(PNK_DEBUGGER, JSOP_NOP, PN_NULLARY, pos) + : NullaryNode(PNK_DEBUGGER, JSOP_NOP, pos) { } + + static bool test(const ParseNode& node) { + bool match = node.isKind(PNK_DEBUGGER); + MOZ_ASSERT_IF(match, node.is()); + return match; + } }; class ConditionalExpression : public TernaryNode @@ -1697,6 +1722,12 @@ class NullLiteral : public NullaryNode explicit NullLiteral(const TokenPos& pos) : NullaryNode(PNK_NULL, JSOP_NULL, pos) { } + + static bool test(const ParseNode& node) { + bool match = node.isKind(PNK_NULL); + MOZ_ASSERT_IF(match, node.is()); + return match; + } }; // This is only used internally, currently just for tagged templates. @@ -1707,6 +1738,12 @@ class RawUndefinedLiteral : public NullaryNode public: explicit RawUndefinedLiteral(const TokenPos& pos) : NullaryNode(PNK_RAW_UNDEFINED, JSOP_UNDEFINED, pos) { } + + static bool test(const ParseNode& node) { + bool match = node.isKind(PNK_RAW_UNDEFINED); + MOZ_ASSERT_IF(match, node.is()); + return match; + } }; class BooleanLiteral : public NullaryNode @@ -1715,6 +1752,12 @@ class BooleanLiteral : public NullaryNode BooleanLiteral(bool b, const TokenPos& pos) : NullaryNode(b ? PNK_TRUE : PNK_FALSE, b ? JSOP_TRUE : JSOP_FALSE, pos) { } + + static bool test(const ParseNode& node) { + bool match = node.isKind(PNK_TRUE) || node.isKind(PNK_FALSE); + MOZ_ASSERT_IF(match, node.is()); + return match; + } }; class RegExpLiteral : public ParseNode diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 974cbae36c..528d57adb2 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -5469,7 +5469,7 @@ Parser::exportBatch(uint32_t begin) // Handle the form |export *| by adding a special export batch // specifier to the list. - Node exportSpec = handler.newNullary(PNK_EXPORT_BATCH_SPEC, JSOP_NOP, pos()); + NullaryNodeType exportSpec = handler.newNullary(PNK_EXPORT_BATCH_SPEC, JSOP_NOP, pos()); if (!exportSpec) return null(); @@ -6542,7 +6542,7 @@ Parser::switchStatement(YieldHandling yieldHandling) } template -typename ParseHandler::Node +typename ParseHandler::ContinueStatementType Parser::continueStatement(YieldHandling yieldHandling) { MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_CONTINUE)); @@ -6600,7 +6600,7 @@ Parser::continueStatement(YieldHandling yieldHandling) } template -typename ParseHandler::Node +typename ParseHandler::BreakStatementType Parser::breakStatement(YieldHandling yieldHandling) { MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_BREAK)); @@ -7192,7 +7192,7 @@ Parser::catchBlockStatement(YieldHandling yieldHandling, } template -typename ParseHandler::Node +typename ParseHandler::DebuggerStatementType Parser::debuggerStatement() { TokenPos p; @@ -10378,7 +10378,7 @@ Parser::tryNewTarget(BinaryNodeType* newTarget) *newTarget = null(); - Node newHolder = handler.newPosHolder(pos()); + NullaryNodeType newHolder = handler.newPosHolder(pos()); if (!newHolder) return false; @@ -10406,7 +10406,7 @@ Parser::tryNewTarget(BinaryNodeType* newTarget) return false; } - Node targetHolder = handler.newPosHolder(pos()); + NullaryNodeType targetHolder = handler.newPosHolder(pos()); if (!targetHolder) return false; diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index 0ab23ef578..0a52c18701 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -1211,14 +1211,14 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_TYPE) Node expressionAfterForInOrOf(ParseNodeKind forHeadKind, YieldHandling yieldHandling); SwitchStatementType switchStatement(YieldHandling yieldHandling); - Node continueStatement(YieldHandling yieldHandling); - Node breakStatement(YieldHandling yieldHandling); + ContinueStatementType continueStatement(YieldHandling yieldHandling); + BreakStatementType breakStatement(YieldHandling yieldHandling); UnaryNodeType returnStatement(YieldHandling yieldHandling); BinaryNodeType withStatement(YieldHandling yieldHandling); UnaryNodeType throwStatement(YieldHandling yieldHandling); TernaryNodeType tryStatement(YieldHandling yieldHandling); Node catchBlockStatement(YieldHandling yieldHandling, ParseContext::Scope& catchParamScope); - Node debuggerStatement(); + DebuggerStatementType debuggerStatement(); Node variableStatement(YieldHandling yieldHandling); diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseHandler.h index fd7753c581..dc59e7da93 100644 --- a/js/src/frontend/SyntaxParseHandler.h +++ b/js/src/frontend/SyntaxParseHandler.h @@ -224,7 +224,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) } NumericLiteralType newNumber(double value, DecimalPoint decimalPoint, const TokenPos& pos) { return NodeGeneric; } - Node newBooleanLiteral(bool cond, const TokenPos& pos) { return NodeGeneric; } + BooleanLiteralType newBooleanLiteral(bool cond, const TokenPos& pos) { return NodeGeneric; } NameNodeType newStringLiteral(JSAtom* atom, const TokenPos& pos) { lastAtom = atom; @@ -243,8 +243,8 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) void addToCallSiteObject(CallSiteNodeType callSiteObj, Node rawNode, Node cookedNode) {} UnaryNodeType newThisLiteral(const TokenPos& pos, Node thisName) { return NodeGeneric; } - Node newNullLiteral(const TokenPos& pos) { return NodeGeneric; } - Node newRawUndefinedLiteral(const TokenPos& pos) { return NodeGeneric; } + NullLiteralType newNullLiteral(const TokenPos& pos) { return NodeGeneric; } + RawUndefinedLiteralType newRawUndefinedLiteral(const TokenPos& pos) { return NodeGeneric; } template RegExpLiteralType newRegExp(RegExpObject* reobj, const TokenPos& pos, Boxer& boxer) { return NodeGeneric; } @@ -263,7 +263,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) return NodeUnparenthesizedUnary; } - Node newNullary(ParseNodeKind kind, JSOp op, const TokenPos& pos) { + NullaryNodeType newNullary(ParseNodeKind kind, JSOp op, const TokenPos& pos) { return NodeGeneric; } @@ -316,8 +316,10 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) ClassNamesType newClassNames(Node outer, Node inner, const TokenPos& pos) { return NodeGeneric; } ClassNodeType newClass(Node name, Node heritage, Node methodBlock, const TokenPos& pos) { return NodeGeneric; } - BinaryNodeType newNewTarget(Node newHolder, Node targetHolder) { return NodeGeneric; } - Node newPosHolder(const TokenPos& pos) { return NodeGeneric; } + BinaryNodeType newNewTarget(NullaryNodeType newHolder, NullaryNodeType targetHolder) { + return NodeGeneric; + } + NullaryNodeType newPosHolder(const TokenPos& pos) { return NodeGeneric; } UnaryNodeType newSuperBase(Node thisName, const TokenPos& pos) { return NodeSuperBase; } MOZ_MUST_USE bool addPrototypeMutation(ListNodeType literal, uint32_t begin, Node expr) { return true; } @@ -337,7 +339,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) void addStatementToList(ListNodeType list, Node stmt) {} void addCaseStatementToList(ListNodeType list, CaseClauseType caseClause) {} MOZ_MUST_USE bool prependInitialYield(ListNodeType stmtList, Node genName) { return true; } - Node newEmptyStatement(const TokenPos& pos) { return NodeEmptyStatement; } + UnaryNodeType newEmptyStatement(const TokenPos& pos) { return NodeEmptyStatement; } UnaryNodeType newExportDeclaration(Node kid, const TokenPos& pos) { return NodeGeneric; @@ -365,8 +367,8 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) return NodeGeneric; } CaseClauseType newCaseOrDefault(uint32_t begin, Node expr, Node body) { return NodeGeneric; } - Node newContinueStatement(PropertyName* label, const TokenPos& pos) { return NodeGeneric; } - Node newBreakStatement(PropertyName* label, const TokenPos& pos) { return NodeBreak; } + ContinueStatementType newContinueStatement(PropertyName* label, const TokenPos& pos) { return NodeGeneric; } + BreakStatementType newBreakStatement(PropertyName* label, const TokenPos& pos) { return NodeBreak; } UnaryNodeType newReturnStatement(Node expr, const TokenPos& pos) { return NodeReturn; } BinaryNodeType newWithStatement(uint32_t begin, Node expr, Node body) { return NodeGeneric; } @@ -378,7 +380,7 @@ FOR_EACH_PARSENODE_SUBCLASS(DECLARE_AS) Node newTryStatement(uint32_t begin, Node body, ListNodeType catchList, Node finallyBlock) { return NodeGeneric; } - Node newDebuggerStatement(const TokenPos& pos) { return NodeGeneric; } + DebuggerStatementType newDebuggerStatement(const TokenPos& pos) { return NodeGeneric; } NameNodeType newPropertyName(PropertyName* name, const TokenPos& pos) { lastAtom = name; diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp index 739bf3e01c..ff943aed40 100644 --- a/js/src/wasm/AsmJS.cpp +++ b/js/src/wasm/AsmJS.cpp @@ -598,7 +598,6 @@ static inline PropertyName* LoopControlMaybeLabel(ParseNode* pn) { MOZ_ASSERT(pn->isKind(PNK_BREAK) || pn->isKind(PNK_CONTINUE)); - MOZ_ASSERT(pn->isArity(PN_NULLARY)); return pn->as().label(); }