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

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

Issue 11309011: Issue 4289. Separate optional positional and named parameters (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..9b206f9c869092ee62ae852769976e420628ed96 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -1709,6 +1709,9 @@ public class DartParser extends CompletionHooksParserBase {
}
// In methods with required arity each parameter is required.
for (DartParameter parameter : parameters) {
+ if (parameter.getModifiers().isOptional()) {
+ reportError(parameter, ParserErrorCode.OPTIONAL_POSITIONAL_PARAMETER_NOT_ALLOWED);
+ }
if (parameter.getModifiers().isNamed()) {
reportError(parameter, ParserErrorCode.NAMED_PARAMETER_NOT_ALLOWED);
}
@@ -2139,8 +2142,6 @@ public class DartParser extends CompletionHooksParserBase {
if (isOptional) {
modifiers = modifiers.makeOptional();
- // TODO(brianwilkerson) Remove the line below when we no longer need to support the old syntax.
- modifiers = modifiers.makeNamed();
}
if (isNamed) {
modifiers = modifiers.makeNamed();

Powered by Google App Engine
This is Rietveld 408576698