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

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

Issue 772423004: Fix for issue 18244 (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 ac0ebd3ee5644a37bd296c494213a620fcab5663..e6387dee6a7a87469c25ad885c7065e2a463b150 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -7294,7 +7294,19 @@ class Parser {
_parseMethodDeclarationAfterReturnType(CommentAndMetadata commentAndMetadata,
Token externalKeyword, Token staticKeyword, TypeName returnType) {
SimpleIdentifier methodName = parseSimpleIdentifier();
- FormalParameterList parameters = parseFormalParameterList();
+ FormalParameterList parameters;
+ if (!_matches(TokenType.OPEN_PAREN) &&
+ (_matches(TokenType.OPEN_CURLY_BRACKET) || _matches(TokenType.FUNCTION))) {
+ _reportErrorForToken(ParserErrorCode.MISSING_METHOD_PARAMETERS, _currentToken.previous);
+ parameters = new FormalParameterList(
+ _createSyntheticToken(TokenType.OPEN_PAREN),
+ null,
+ null,
+ null,
+ _createSyntheticToken(TokenType.CLOSE_PAREN));
+ } else {
+ parameters = parseFormalParameterList();
+ }
_validateFormalParameterList(parameters);
return _parseMethodDeclarationAfterParameters(
commentAndMetadata,
@@ -10402,6 +10414,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_GET = const ParserErrorCode(
'MISSING_GET',
"Getters must have the keyword 'get' before the getter name");
« 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