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

Unified Diff: compiler/java/com/google/dart/compiler/parser/DartParser.java

Issue 11305007: Getter with parameters is error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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
Index: compiler/java/com/google/dart/compiler/parser/DartParser.java
diff --git a/compiler/java/com/google/dart/compiler/parser/DartParser.java b/compiler/java/com/google/dart/compiler/parser/DartParser.java
index 4b51d39f83f3ade150d3b54369d9ab355149b112..e6991477d572364f50998da1e078e47c0856ef91 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -103,6 +103,7 @@ import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.compiler.ast.Modifiers;
import com.google.dart.compiler.metrics.CompilerMetrics;
import com.google.dart.compiler.parser.DartScanner.Location;
+import com.google.dart.compiler.resolver.Elements;
import com.google.dart.compiler.util.Lists;
import com.google.dart.compiler.util.apache.StringUtils;
@@ -1692,12 +1693,16 @@ public class DartParser extends CompletionHooksParserBase {
// Parse the parameters definitions.
FormalParameters parametersInfo;
- if (modifiers.isGetter() && peek(0) != Token.LPAREN) {
- // TODO: For now the parameters are optional so that both the old and new style will be
- // accepted, but eventually parameters should be disallowed.
+ if (modifiers.isGetter()) {
parametersInfo = new FormalParameters(new ArrayList<DartParameter>(), -1, -1);
+ if (peek(0) == Token.LPAREN) {
+ // TODO(scheglov) remove after http://code.google.com/p/dart/issues/detail?id=6297
+ if (!Elements.isHtmlLibrarySource(source)) {
+ reportError(position(), ParserErrorCode.DEPRECATED_GETTER);
+ }
+ parametersInfo = parseFormalParameterList();
+ }
} else {
- //reportError(position(), ParserErrorCode.DEPRECATED_GETTER);
parametersInfo = parseFormalParameterList();
}
List<DartParameter> parameters = parametersInfo.val;

Powered by Google App Engine
This is Rietveld 408576698