Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(838)

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 785573002: Fix for issue 4482 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/parser.dart
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index e6387dee6a7a87469c25ad885c7065e2a463b150..013ff4603e0d59aa41c2281ac52dc456858b9c1c 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -4143,12 +4143,14 @@ class Parser {
}
/**
- * If the current token has the expected type, return it after advancing to the next token.
- * Otherwise report an error and return the current token without advancing. Note that the method
- * [_expectGt] should be used if the argument to this method would be [TokenType.GT].
+ * If the current token has the expected type, return it after advancing to
+ * the next token. Otherwise report an error and return the current token
+ * without advancing.
*
- * @param type the type of token that is expected
- * @return the token that matched the given type
+ * Note that the method [_expectGt] should be used if the argument to this
+ * method would be [TokenType.GT].
+ *
+ * The [type] is the type of token that is expected.
*/
Token _expect(TokenType type) {
if (_matches(type)) {
@@ -4157,6 +4159,13 @@ class Parser {
// Remove uses of this method in favor of matches?
// Pass in the error code to use to report the error?
if (type == TokenType.SEMICOLON) {
+ if (_tokenMatches(_currentToken.next, TokenType.SEMICOLON)) {
+ _reportErrorForCurrentToken(
+ ParserErrorCode.UNEXPECTED_TOKEN,
+ [_currentToken.lexeme]);
+ _advance();
+ return andAdvance;
+ }
_reportErrorForToken(
ParserErrorCode.EXPECTED_TOKEN,
_currentToken.previous,
@@ -7297,13 +7306,15 @@ class Parser {
FormalParameterList parameters;
if (!_matches(TokenType.OPEN_PAREN) &&
(_matches(TokenType.OPEN_CURLY_BRACKET) || _matches(TokenType.FUNCTION))) {
- _reportErrorForToken(ParserErrorCode.MISSING_METHOD_PARAMETERS, _currentToken.previous);
+ _reportErrorForToken(
+ ParserErrorCode.MISSING_METHOD_PARAMETERS,
+ _currentToken.previous);
parameters = new FormalParameterList(
_createSyntheticToken(TokenType.OPEN_PAREN),
- null,
- null,
- null,
- _createSyntheticToken(TokenType.CLOSE_PAREN));
+ null,
+ null,
+ null,
+ _createSyntheticToken(TokenType.CLOSE_PAREN));
} else {
parameters = parseFormalParameterList();
}
@@ -10414,9 +10425,10 @@ class ParserErrorCode extends ErrorCode {
'MISSING_FUNCTION_PARAMETERS',
"Functions must have an explicit list of parameters");
- static const ParserErrorCode MISSING_METHOD_PARAMETERS = const ParserErrorCode(
- 'MISSING_METHOD_PARAMETERS',
- "Methods must have an explicit list of parameters");
+ static const ParserErrorCode MISSING_METHOD_PARAMETERS =
+ const ParserErrorCode(
+ 'MISSING_METHOD_PARAMETERS',
+ "Methods must have an explicit list of parameters");
static const ParserErrorCode MISSING_GET = const ParserErrorCode(
'MISSING_GET',
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698