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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java

Issue 15063006: Report ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months 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 | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/ErrorParserTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
index fb393f76983445c4f3f92a48f6012aa0bcc3ac12..3a8fc167458a0f4e980d2451465c463530ca6911 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
@@ -1606,12 +1606,29 @@ public class Parser {
reportError(ParserErrorCode.EXPECTED_CLASS_MEMBER, currentToken);
return null;
} else if (matches(peek(), TokenType.OPEN_PAREN)) {
+ SimpleIdentifier methodName = parseSimpleIdentifier();
Brian Wilkerson 2013/05/16 18:03:54 This doesn't appear to allow for named constructor
+ FormalParameterList parameters = parseFormalParameterList();
+ if (methodName.getName().equals(className)) {
+ reportError(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, type);
+ return parseConstructor(
+ commentAndMetadata,
+ modifiers.getExternalKeyword(),
+ validateModifiersForConstructor(modifiers),
+ modifiers.getFactoryKeyword(),
+ methodName,
+ null,
+ null,
+ parameters);
+ }
validateModifiersForGetterOrSetterOrMethod(modifiers);
+ validateFormalParameterList(parameters);
return parseMethodDeclaration(
commentAndMetadata,
modifiers.getExternalKeyword(),
modifiers.getStaticKeyword(),
- type);
+ type,
+ methodName,
+ parameters);
}
return parseInitializedIdentifierList(
commentAndMetadata,
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/ErrorParserTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698