mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Use macroized version of dbaron's fix for >65535 line script parsing bug (229006, r=shaver).
This commit is contained in:
parent
fd5f9867f1
commit
5a06114b4c
@ -1106,7 +1106,7 @@ MatchLabel(JSContext *cx, JSTokenStream *ts, JSParseNode *pn)
|
||||
label = NULL;
|
||||
#endif
|
||||
pn->pn_atom = label;
|
||||
if (pn->pn_pos.end.lineno == ts->lineno)
|
||||
if (ON_CURRENT_LINE(ts, pn->pn_pos))
|
||||
return WellTerminated(cx, ts, TOK_ERROR);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@ -1246,7 +1246,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
} while (js_MatchToken(cx, ts, TOK_COMMA));
|
||||
}
|
||||
pn->pn_pos.end = PN_LAST(pn)->pn_pos.end;
|
||||
if (pn->pn_pos.end.lineno == ts->lineno &&
|
||||
if (ON_CURRENT_LINE(ts, pn->pn_pos) &&
|
||||
!WellTerminated(cx, ts, TOK_ERROR)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1265,7 +1265,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
PN_APPEND(pn, pn2);
|
||||
} while (js_MatchToken(cx, ts, TOK_COMMA));
|
||||
pn->pn_pos.end = PN_LAST(pn)->pn_pos.end;
|
||||
if (pn->pn_pos.end.lineno == ts->lineno &&
|
||||
if (ON_CURRENT_LINE(ts, pn->pn_pos) &&
|
||||
!WellTerminated(cx, ts, TOK_ERROR)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1277,7 +1277,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
pn = FunctionStmt(cx, ts, tc);
|
||||
if (!pn)
|
||||
return NULL;
|
||||
if (pn->pn_pos.end.lineno == ts->lineno &&
|
||||
if (ON_CURRENT_LINE(ts, pn->pn_pos) &&
|
||||
!WellTerminated(cx, ts, TOK_FUNCTION)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1693,7 +1693,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
if (!pn2)
|
||||
return NULL;
|
||||
pn->pn_pos.end = pn2->pn_pos.end;
|
||||
if (pn->pn_pos.end.lineno == ts->lineno &&
|
||||
if (ON_CURRENT_LINE(ts, pn->pn_pos) &&
|
||||
!WellTerminated(cx, ts, TOK_ERROR)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1825,7 +1825,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
pn = Variables(cx, ts, tc);
|
||||
if (!pn)
|
||||
return NULL;
|
||||
if (pn->pn_pos.end.lineno == ts->lineno &&
|
||||
if (ON_CURRENT_LINE(ts, pn->pn_pos) &&
|
||||
!WellTerminated(cx, ts, TOK_ERROR)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1854,7 +1854,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
pn2 = Expr(cx, ts, tc);
|
||||
if (!pn2)
|
||||
return NULL;
|
||||
if (pn2->pn_pos.end.lineno == ts->lineno &&
|
||||
if (ON_CURRENT_LINE(ts, pn2->pn_pos) &&
|
||||
!WellTerminated(cx, ts, TOK_ERROR)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1950,7 +1950,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
}
|
||||
|
||||
/* Check termination of (possibly multi-line) function expression. */
|
||||
if (pn2->pn_pos.end.lineno == ts->lineno &&
|
||||
if (ON_CURRENT_LINE(ts, pn2->pn_pos) &&
|
||||
!WellTerminated(cx, ts, lastExprType)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -2626,7 +2626,7 @@ UnaryExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
return NULL;
|
||||
|
||||
/* Don't look across a newline boundary for a postfix incop. */
|
||||
if (pn->pn_pos.end.lineno == ts->lineno) {
|
||||
if (ON_CURRENT_LINE(ts, pn->pn_pos)) {
|
||||
tt = js_PeekTokenSameLine(cx, ts);
|
||||
if (tt == TOK_INC || tt == TOK_DEC) {
|
||||
(void) js_GetToken(cx, ts);
|
||||
|
@ -656,7 +656,7 @@ js_PeekTokenSameLine(JSContext *cx, JSTokenStream *ts)
|
||||
JSTokenType tt;
|
||||
|
||||
JS_ASSERT(ts->lookahead == 0 ||
|
||||
CURRENT_TOKEN(ts).pos.end.lineno == ts->lineno);
|
||||
ON_CURRENT_LINE(ts, CURRENT_TOKEN(ts).pos));
|
||||
ts->flags |= TSF_NEWLINES;
|
||||
tt = js_PeekToken(cx, ts);
|
||||
ts->flags &= ~TSF_NEWLINES;
|
||||
@ -775,7 +775,7 @@ retry:
|
||||
tp = &CURRENT_TOKEN(ts);
|
||||
tp->ptr = ts->linebuf.ptr - 1;
|
||||
tp->pos.begin.index = ts->linepos + (tp->ptr - ts->linebuf.base);
|
||||
tp->pos.begin.lineno = tp->pos.end.lineno = ts->lineno;
|
||||
tp->pos.begin.lineno = tp->pos.end.lineno = (uint16)ts->lineno;
|
||||
|
||||
if (c == EOF)
|
||||
RETURN(TOK_EOF);
|
||||
@ -994,7 +994,7 @@ retry:
|
||||
0);
|
||||
if (!atom)
|
||||
RETURN(TOK_ERROR);
|
||||
tp->pos.end.lineno = ts->lineno;
|
||||
tp->pos.end.lineno = (uint16)ts->lineno;
|
||||
tp->t_op = JSOP_STRING;
|
||||
tp->t_atom = atom;
|
||||
RETURN(TOK_STRING);
|
||||
|
@ -173,7 +173,8 @@ struct JSTokenStream {
|
||||
void *listenerTSData;/* listener data for this TokenStream */
|
||||
};
|
||||
|
||||
#define CURRENT_TOKEN(ts) ((ts)->tokens[(ts)->cursor])
|
||||
#define CURRENT_TOKEN(ts) ((ts)->tokens[(ts)->cursor])
|
||||
#define ON_CURRENT_LINE(ts,pos) ((uint16)(ts)->lineno == (pos).end.lineno)
|
||||
|
||||
/* JSTokenStream flags */
|
||||
#define TSF_ERROR 0x01 /* fatal error while compiling */
|
||||
|
Loading…
Reference in New Issue
Block a user