| 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 201c536ad7267b186f5358db686f94d9110c4baa..001de940344aa08579c56cd88a2d71f253c69358 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
|
| @@ -2778,6 +2778,7 @@ public class Parser {
|
| boolean reportedMuliplePositionalGroups = false;
|
| boolean reportedMulipleNamedGroups = false;
|
| boolean reportedMixedGroups = false;
|
| + boolean wasOptionalParameter = false;
|
| Token initialToken = null;
|
| do {
|
| if (firstParameter) {
|
| @@ -2796,6 +2797,7 @@ public class Parser {
|
| // Handle the beginning of parameter groups.
|
| //
|
| if (matches(TokenType.OPEN_SQUARE_BRACKET)) {
|
| + wasOptionalParameter = true;
|
| if (leftSquareBracket != null && !reportedMuliplePositionalGroups) {
|
| reportError(ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS);
|
| reportedMuliplePositionalGroups = true;
|
| @@ -2808,6 +2810,7 @@ public class Parser {
|
| currentParameters = positionalParameters;
|
| kind = ParameterKind.POSITIONAL;
|
| } else if (matches(TokenType.OPEN_CURLY_BRACKET)) {
|
| + wasOptionalParameter = true;
|
| if (leftCurlyBracket != null && !reportedMulipleNamedGroups) {
|
| reportError(ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS);
|
| reportedMulipleNamedGroups = true;
|
| @@ -2826,6 +2829,9 @@ public class Parser {
|
| FormalParameter parameter = parseFormalParameter(kind);
|
| parameters.add(parameter);
|
| currentParameters.add(parameter);
|
| + if (kind == ParameterKind.REQUIRED && wasOptionalParameter) {
|
| + reportError(ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, parameter);
|
| + }
|
| //
|
| // Handle the end of parameter groups.
|
| //
|
|
|