Beautify syntax error for unterminated argument list
BUG=chromium:339474 LOG=Y Review URL: https://codereview.chromium.org/1002263004 Cr-Commit-Position: refs/heads/master@{#27205}
This commit is contained in:
parent
b74b0a8b16
commit
cb50b0dfe7
@ -25,6 +25,7 @@ var kMessages = {
|
||||
unterminated_regexp: ["Invalid regular expression: missing /"],
|
||||
unterminated_template: ["Unterminated template literal"],
|
||||
unterminated_template_expr: ["Missing } in template expression"],
|
||||
unterminated_arg_list: ["missing ) after argument list"],
|
||||
regexp_flags: ["Cannot supply flags when constructing one RegExp from another"],
|
||||
incompatible_method_receiver: ["Method ", "%0", " called on incompatible receiver ", "%1"],
|
||||
multiple_defaults_in_switch: ["More than one default clause in switch statement"],
|
||||
|
@ -2324,13 +2324,17 @@ typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments(
|
||||
*ok = false;
|
||||
return this->NullExpressionList();
|
||||
}
|
||||
done = (peek() == Token::RPAREN);
|
||||
done = (peek() != Token::COMMA);
|
||||
if (!done) {
|
||||
// Need {} because of the CHECK_OK_CUSTOM macro.
|
||||
Expect(Token::COMMA, CHECK_OK_CUSTOM(NullExpressionList));
|
||||
Next();
|
||||
}
|
||||
}
|
||||
Expect(Token::RPAREN, CHECK_OK_CUSTOM(NullExpressionList));
|
||||
Scanner::Location location = scanner_->location();
|
||||
if (Token::RPAREN != Next()) {
|
||||
ReportMessageAt(location, "unterminated_arg_list");
|
||||
*ok = false;
|
||||
return this->NullExpressionList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
7
test/message/unterminated-arg-list.js
Normal file
7
test/message/unterminated-arg-list.js
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
$(document).ready(function() {
|
||||
$("html").load( "https://localhost" );
|
||||
}
|
8
test/message/unterminated-arg-list.out
Normal file
8
test/message/unterminated-arg-list.out
Normal file
@ -0,0 +1,8 @@
|
||||
# Copyright 2015 the V8 project authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
*%(basename)s:7: SyntaxError: missing ) after argument list
|
||||
}
|
||||
^
|
||||
SyntaxError: missing ) after argument list
|
Loading…
Reference in New Issue
Block a user