зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1089038 - Do not call peekToken after matchToken failed. r=Waldo
This commit is contained in:
Родитель
fa5e379e1e
Коммит
a26d44cfc3
|
@ -709,13 +709,10 @@ Parser<ParseHandler>::parse(JSObject *chain)
|
||||||
|
|
||||||
Node pn = statements();
|
Node pn = statements();
|
||||||
if (pn) {
|
if (pn) {
|
||||||
bool matched;
|
TokenKind tt;
|
||||||
if (!tokenStream.matchToken(&matched, TOK_EOF))
|
if (!tokenStream.getToken(&tt))
|
||||||
return null();
|
return null();
|
||||||
if (!matched) {
|
if (tt != TOK_EOF) {
|
||||||
TokenKind tt;
|
|
||||||
if (!tokenStream.peekToken(&tt))
|
|
||||||
return null();
|
|
||||||
report(ParseError, false, null(), JSMSG_GARBAGE_AFTER_INPUT,
|
report(ParseError, false, null(), JSMSG_GARBAGE_AFTER_INPUT,
|
||||||
"script", TokenKindToDesc(tt));
|
"script", TokenKindToDesc(tt));
|
||||||
return null();
|
return null();
|
||||||
|
@ -834,13 +831,10 @@ Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun, const AutoN
|
||||||
if (!pn)
|
if (!pn)
|
||||||
return null();
|
return null();
|
||||||
|
|
||||||
bool matched;
|
TokenKind tt;
|
||||||
if (!tokenStream.matchToken(&matched, TOK_EOF))
|
if (!tokenStream.getToken(&tt))
|
||||||
return null();
|
return null();
|
||||||
if (!matched) {
|
if (tt != TOK_EOF) {
|
||||||
TokenKind tt;
|
|
||||||
if (!tokenStream.peekToken(&tt))
|
|
||||||
return null();
|
|
||||||
report(ParseError, false, null(), JSMSG_GARBAGE_AFTER_INPUT,
|
report(ParseError, false, null(), JSMSG_GARBAGE_AFTER_INPUT,
|
||||||
"function body", TokenKindToDesc(tt));
|
"function body", TokenKindToDesc(tt));
|
||||||
return null();
|
return null();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче