mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 04:27:37 +00:00
Bug 710932 - Create true/false/this/null parse nodes with a constructor that doesn't examine the token stream. r=jorendorff
--HG-- extra : rebase_source : 29dc590794dd36409a5a171f8043aad1546b7b9a
This commit is contained in:
parent
5aa792830d
commit
c1446d6b7f
@ -1198,6 +1198,23 @@ ParseNode::asUseSharpExpression()
|
||||
return *static_cast<UseSharpExpression *>(this);
|
||||
}
|
||||
|
||||
class ThisLiteral : public ParseNode {
|
||||
public:
|
||||
ThisLiteral(const TokenPos &pos) : ParseNode(PNK_THIS, JSOP_THIS, PN_NULLARY, pos) { }
|
||||
};
|
||||
|
||||
class NullLiteral : public ParseNode {
|
||||
public:
|
||||
NullLiteral(const TokenPos &pos) : ParseNode(PNK_NULL, JSOP_NULL, PN_NULLARY, pos) { }
|
||||
};
|
||||
|
||||
class BooleanLiteral : public ParseNode {
|
||||
public:
|
||||
BooleanLiteral(bool b, const TokenPos &pos)
|
||||
: ParseNode(b ? PNK_TRUE : PNK_FALSE, b ? JSOP_TRUE : JSOP_FALSE, PN_NULLARY, pos)
|
||||
{ }
|
||||
};
|
||||
|
||||
ParseNode *
|
||||
CloneLeftHandSide(ParseNode *opn, TreeContext *tc);
|
||||
|
||||
|
@ -6565,16 +6565,6 @@ Parser::parseXMLText(JSObject *chain, bool allowList)
|
||||
|
||||
#endif /* JS_HAS_XMLSUPPORT */
|
||||
|
||||
static ParseNode *
|
||||
PrimaryExprNode(ParseNodeKind kind, JSOp op, TreeContext *tc)
|
||||
{
|
||||
ParseNode *pn = NullaryNode::create(kind, tc);
|
||||
if (!pn)
|
||||
return NULL;
|
||||
pn->setOp(op);
|
||||
return pn;
|
||||
}
|
||||
|
||||
ParseNode *
|
||||
Parser::primaryExpr(TokenKind tt, JSBool afterDot)
|
||||
{
|
||||
@ -7217,13 +7207,13 @@ Parser::primaryExpr(TokenKind tt, JSBool afterDot)
|
||||
break;
|
||||
|
||||
case TOK_TRUE:
|
||||
return PrimaryExprNode(PNK_TRUE, JSOP_TRUE, tc);
|
||||
return new_<BooleanLiteral>(true, tokenStream.currentToken().pos);
|
||||
case TOK_FALSE:
|
||||
return PrimaryExprNode(PNK_FALSE, JSOP_FALSE, tc);
|
||||
return new_<BooleanLiteral>(false, tokenStream.currentToken().pos);
|
||||
case TOK_THIS:
|
||||
return PrimaryExprNode(PNK_THIS, JSOP_THIS, tc);
|
||||
return new_<ThisLiteral>(tokenStream.currentToken().pos);
|
||||
case TOK_NULL:
|
||||
return PrimaryExprNode(PNK_NULL, JSOP_NULL, tc);
|
||||
return new_<NullLiteral>(tokenStream.currentToken().pos);
|
||||
|
||||
case TOK_ERROR:
|
||||
/* The scanner or one of its subroutines reported the error. */
|
||||
|
Loading…
Reference in New Issue
Block a user