зеркало из 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();
|
||||
if (pn) {
|
||||
bool matched;
|
||||
if (!tokenStream.matchToken(&matched, TOK_EOF))
|
||||
return null();
|
||||
if (!matched) {
|
||||
TokenKind tt;
|
||||
if (!tokenStream.peekToken(&tt))
|
||||
if (!tokenStream.getToken(&tt))
|
||||
return null();
|
||||
if (tt != TOK_EOF) {
|
||||
report(ParseError, false, null(), JSMSG_GARBAGE_AFTER_INPUT,
|
||||
"script", TokenKindToDesc(tt));
|
||||
return null();
|
||||
|
@ -834,13 +831,10 @@ Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun, const AutoN
|
|||
if (!pn)
|
||||
return null();
|
||||
|
||||
bool matched;
|
||||
if (!tokenStream.matchToken(&matched, TOK_EOF))
|
||||
return null();
|
||||
if (!matched) {
|
||||
TokenKind tt;
|
||||
if (!tokenStream.peekToken(&tt))
|
||||
if (!tokenStream.getToken(&tt))
|
||||
return null();
|
||||
if (tt != TOK_EOF) {
|
||||
report(ParseError, false, null(), JSMSG_GARBAGE_AFTER_INPUT,
|
||||
"function body", TokenKindToDesc(tt));
|
||||
return null();
|
||||
|
|
Загрузка…
Ссылка в новой задаче