Skip to content

Commit

Permalink
Bug 1297706 - Syntax parse with statements. r=jandem
Browse files Browse the repository at this point in the history
  • Loading branch information
syg committed Sep 1, 2016
1 parent 85437be commit c915299
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
22 changes: 3 additions & 19 deletions js/src/frontend/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5786,18 +5786,10 @@ Parser<ParseHandler>::yieldExpression(InHandling inHandling)
MOZ_CRASH("yieldExpr");
}

template <>
ParseNode*
Parser<FullParseHandler>::withStatement(YieldHandling yieldHandling)
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::withStatement(YieldHandling yieldHandling)
{
// test262/ch12/12.10/12.10-0-1.js fails if we try to parse with-statements
// in syntax-parse mode. See bug 892583.
if (handler.syntaxParser) {
handler.disableSyntaxParser();
abortedSyntaxParse = true;
return null();
}

MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_WITH));
uint32_t begin = pos().begin;

Expand Down Expand Up @@ -5831,14 +5823,6 @@ Parser<FullParseHandler>::withStatement(YieldHandling yieldHandling)
return handler.newWithStatement(begin, objectExpr, innerBlock);
}

template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::withStatement(YieldHandling yieldHandling)
{
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return null();
}

template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::labeledItem(YieldHandling yieldHandling)
Expand Down
1 change: 1 addition & 0 deletions js/src/frontend/SyntaxParseHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ class SyntaxParseHandler
Node newContinueStatement(PropertyName* label, const TokenPos& pos) { return NodeGeneric; }
Node newBreakStatement(PropertyName* label, const TokenPos& pos) { return NodeBreak; }
Node newReturnStatement(Node expr, const TokenPos& pos) { return NodeReturn; }
Node newWithStatement(uint32_t begin, Node expr, Node body) { return NodeGeneric; }

Node newLabeledStatement(PropertyName* label, Node stmt, uint32_t begin) {
return NodeGeneric;
Expand Down

0 comments on commit c915299

Please sign in to comment.