summaryrefslogtreecommitdiff
path: root/js/src/frontend/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/frontend/Parser.cpp')
-rw-r--r--js/src/frontend/Parser.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index b6f834c876..4a6a629d28 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -5369,16 +5369,15 @@ Parser<SyntaxParseHandler>::checkExportedNameForFunction(Node node)
template<>
bool
-Parser<FullParseHandler>::checkExportedNameForClass(ParseNode* node)
+Parser<FullParseHandler>::checkExportedNameForClass(ClassNode* classNode)
{
- const ClassNode& cls = node->as<ClassNode>();
- MOZ_ASSERT(cls.names());
- return checkExportedName(cls.names()->innerBinding()->pn_atom);
+ MOZ_ASSERT(classNode->names());
+ return checkExportedName(classNode->names()->innerBinding()->pn_atom);
}
template<>
bool
-Parser<SyntaxParseHandler>::checkExportedNameForClass(Node node)
+Parser<SyntaxParseHandler>::checkExportedNameForClass(ClassNodeType classNode)
{
MOZ_ALWAYS_FALSE(abortIfSyntaxParser());
return false;
@@ -5658,7 +5657,7 @@ Parser<ParseHandler>::exportClassDeclaration(uint32_t begin)
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_CLASS));
- Node kid = classDefinition(YieldIsKeyword, ClassStatement, NameRequired);
+ ClassNodeType kid = classDefinition(YieldIsName, ClassStatement, NameRequired);
if (!kid)
return null();
@@ -5736,7 +5735,7 @@ Parser<ParseHandler>::exportDefaultClassDeclaration(uint32_t begin)
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_CLASS));
- Node kid = classDefinition(YieldIsKeyword, ClassStatement, AllowDefaultName);
+ ClassNodeType kid = classDefinition(YieldIsName, ClassStatement, AllowDefaultName);
if (!kid)
return null();
@@ -5966,7 +5965,7 @@ Parser<ParseHandler>::consequentOrAlternative(YieldHandling yieldHandling)
}
template <typename ParseHandler>
-typename ParseHandler::Node
+typename ParseHandler::TernaryNodeType
Parser<ParseHandler>::ifStatement(YieldHandling yieldHandling)
{
Vector<Node, 4> condList(context), thenList(context);
@@ -6015,13 +6014,16 @@ Parser<ParseHandler>::ifStatement(YieldHandling yieldHandling)
break;
}
+ TernaryNodeType ifNode;
for (int i = condList.length() - 1; i >= 0; i--) {
- elseBranch = handler.newIfStatement(posList[i], condList[i], thenList[i], elseBranch);
- if (!elseBranch)
+ ifNode = handler.newIfStatement(posList[i], condList[i], thenList[i], elseBranch);
+ if (!ifNode) {
return null();
+ }
+ elseBranch = ifNode;
}
- return elseBranch;
+ return ifNode;
}
template <typename ParseHandler>
@@ -6325,7 +6327,7 @@ Parser<ParseHandler>::forStatement(YieldHandling yieldHandling)
MOZ_ASSERT(headKind == PNK_FORIN || headKind == PNK_FOROF || headKind == PNK_FORHEAD);
- Node forHead;
+ TernaryNodeType forHead;
if (headKind == PNK_FORHEAD) {
Node init = startNode;
@@ -6947,7 +6949,7 @@ Parser<ParseHandler>::throwStatement(YieldHandling yieldHandling)
}
template <typename ParseHandler>
-typename ParseHandler::Node
+typename ParseHandler::TernaryNodeType
Parser<ParseHandler>::tryStatement(YieldHandling yieldHandling)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_TRY));
@@ -7219,7 +7221,7 @@ JSOpFromPropertyType(PropertyType propType)
}
template <typename ParseHandler>
-typename ParseHandler::Node
+typename ParseHandler::ClassNodeType
Parser<ParseHandler>::classDefinition(YieldHandling yieldHandling,
ClassContext classContext,
DefaultHandling defaultHandling)
@@ -8929,7 +8931,7 @@ Parser<ParseHandler>::comprehensionFor(GeneratorKind comprehensionKind)
if (!lexicalScope)
return null();
- Node head = handler.newForInOrOfHead(PNK_FOROF, lexicalScope, rhs, headPos);
+ TernaryNodeType head = handler.newForInOrOfHead(PNK_FOROF, lexicalScope, rhs, headPos);
if (!head)
return null();