Bug 697795 - Replace TOK_DIVOP with TOK_DIV and TOK_MOD. r=cdleary

--HG--
extra : rebase_source : 17f89d9f41b9bab4ed12060d52b99aec3619ab15
This commit is contained in:
Jeff Walden 2011-10-25 23:51:52 -07:00
parent e28581fa2e
commit 263394f07b
7 changed files with 20 additions and 11 deletions

View File

@ -6558,7 +6558,8 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
case TOK_RSH:
case TOK_URSH:
case TOK_STAR:
case TOK_DIVOP:
case TOK_DIV:
case TOK_MOD:
if (pn->isArity(PN_LIST)) {
/* Left-associative operator chain: avoid too much recursion. */
pn2 = pn->pn_head;

View File

@ -777,7 +777,8 @@ js::FoldConstants(JSContext *cx, ParseNode *pn, TreeContext *tc, bool inCond)
case TOK_LSH:
case TOK_RSH:
case TOK_URSH:
case TOK_DIVOP:
case TOK_DIV:
case TOK_MOD:
do_binary_op:
if (pn->isArity(PN_LIST)) {
JS_ASSERT(pn->pn_count > 2);

View File

@ -182,7 +182,8 @@ namespace js {
* pn_
* TOK_MINUS pn_op: JSOP_ADD, JSOP_SUB
* TOK_STAR, binary pn_left: left-assoc MUL expr, pn_right: UNARY expr
* TOK_DIVOP pn_op: JSOP_MUL, JSOP_DIV, JSOP_MOD
* TOK_DIV, pn_op: JSOP_MUL, JSOP_DIV, JSOP_MOD
* TOK_MOD
* TOK_TYPEOF, unary pn_kid: UNARY expr
* TOK_VOID,
* TOK_NOT,

View File

@ -4372,7 +4372,7 @@ BEGIN_EXPR_PARSER(mulExpr1)
* isCurrentTokenType() because unaryExpr() doesn't leave the TokenStream
* state one past the end of the unary expression.
*/
while (pn && ((tt = tokenStream.getToken()) == TOK_STAR || tt == TOK_DIVOP)) {
while (pn && ((tt = tokenStream.getToken()) == TOK_STAR || tt == TOK_DIV || tt == TOK_MOD)) {
tt = tokenStream.currentToken().type;
JSOp op = tokenStream.currentToken().t_op;
pn = ParseNode::newBinaryOrAppend(tt, op, pn, unaryExpr(), tc);

View File

@ -2063,12 +2063,12 @@ TokenStream::getTokenInternal()
}
tp->t_op = JSOP_DIV;
tt = matchChar('=') ? TOK_ASSIGN : TOK_DIVOP;
tt = matchChar('=') ? TOK_ASSIGN : TOK_DIV;
break;
case '%':
tp->t_op = JSOP_MOD;
tt = matchChar('=') ? TOK_ASSIGN : TOK_DIVOP;
tt = matchChar('=') ? TOK_ASSIGN : TOK_MOD;
break;
case '~':
@ -2220,7 +2220,8 @@ TokenKindToString(TokenKind tt)
case TOK_PLUS: return "TOK_PLUS";
case TOK_MINUS: return "TOK_MINUS";
case TOK_STAR: return "TOK_STAR";
case TOK_DIVOP: return "TOK_DIVOP";
case TOK_DIV: return "TOK_DIV";
case TOK_MOD: return "TOK_MOD";
case TOK_INC: return "TOK_INC";
case TOK_DEC: return "TOK_DEC";
case TOK_DOT: return "TOK_DOT";

View File

@ -77,7 +77,9 @@ enum TokenKind {
TOK_BITAND, /* bitwise-and (&) */
TOK_PLUS, /* plus */
TOK_MINUS, /* minus */
TOK_STAR, TOK_DIVOP, /* multiply/divide ops (* / %) */
TOK_STAR, /* multiply */
TOK_DIV, /* divide */
TOK_MOD, /* modulus */
TOK_INC, TOK_DEC, /* increment/decrement (++ --) */
TOK_DOT, /* member operator (.) */
TOK_LB, TOK_RB, /* left and right brackets */

View File

@ -1786,8 +1786,10 @@ ASTSerializer::binop(TokenKind tk, JSOp op)
return BINOP_MINUS;
case TOK_STAR:
return BINOP_STAR;
case TOK_DIVOP:
return (op == JSOP_MOD) ? BINOP_MOD : BINOP_DIV;
case TOK_DIV:
return BINOP_DIV;
case TOK_MOD:
return BINOP_MOD;
case TOK_BITOR:
return BINOP_BITOR;
case TOK_BITXOR:
@ -2458,7 +2460,8 @@ ASTSerializer::expression(ParseNode *pn, Value *dst)
case TOK_RSH:
case TOK_URSH:
case TOK_STAR:
case TOK_DIVOP:
case TOK_DIV:
case TOK_MOD:
case TOK_BITOR:
case TOK_BITXOR:
case TOK_BITAND: