Index: pkg/dart_parser/lib/src/parser.dart |
diff --git a/pkg/dart_parser/lib/src/parser.dart b/pkg/dart_parser/lib/src/parser.dart |
index 38f63376eda8ec5f3a4395f49b9d200c21dcd052..13e8d410ced9c00e88afaaaa81d24492b57f0c57 100644 |
--- a/pkg/dart_parser/lib/src/parser.dart |
+++ b/pkg/dart_parser/lib/src/parser.dart |
@@ -467,12 +467,12 @@ class Parser { |
listener.beginFunctionTypedFormalParameter(token); |
listener.handleNoTypeVariables(token); |
token = parseFormalParameters(token); |
- listener.handleFunctionTypedFormalParameter(token); |
+ listener.endFunctionTypedFormalParameter(token); |
} else if (optional('<', token)) { |
listener.beginFunctionTypedFormalParameter(token); |
token = parseTypeVariablesOpt(token); |
token = parseFormalParameters(token); |
- listener.handleFunctionTypedFormalParameter(token); |
+ listener.endFunctionTypedFormalParameter(token); |
} |
String value = token.stringValue; |
if ((identical('=', value)) || (identical(':', value))) { |
@@ -1067,10 +1067,10 @@ class Parser { |
Token token = parseIdentifier(name); |
int fieldCount = 1; |
- token = parseVariableInitializerOpt(token); |
+ token = parseFieldInitializerOpt(token); |
while (optional(',', token)) { |
token = parseIdentifier(token.next); |
- token = parseVariableInitializerOpt(token); |
+ token = parseFieldInitializerOpt(token); |
++fieldCount; |
} |
Token semicolon = token; |
@@ -1211,14 +1211,22 @@ class Parser { |
return const Link<Token>(); |
} |
+ Token parseFieldInitializerOpt(Token token) { |
+ if (optional('=', token)) { |
+ Token assignment = token; |
+ listener.beginFieldInitializer(token); |
+ token = parseExpression(token.next); |
+ listener.endFieldInitializer(assignment); |
+ } |
+ return token; |
+ } |
+ |
Token parseVariableInitializerOpt(Token token) { |
if (optional('=', token)) { |
Token assignment = token; |
- // TODO(ahe): Rename this to beginVariableInitializer. |
- listener.beginInitializer(token); |
+ listener.beginVariableInitializer(token); |
token = parseExpression(token.next); |
- // TODO(ahe): Rename this to endVariableInitializer. |
- listener.endInitializer(assignment); |
+ listener.endVariableInitializer(assignment); |
} |
return token; |
} |
@@ -1241,9 +1249,9 @@ class Parser { |
mayParseFunctionExpressions = false; |
do { |
token = token.next; |
- listener.beginConstructorInitializer(token); |
+ listener.beginInitializer(token); |
token = parseExpression(token); |
- listener.endConstructorInitializer(token); |
+ listener.endInitializer(token); |
++count; |
} while (optional(',', token)); |
mayParseFunctionExpressions = old; |
@@ -1730,7 +1738,7 @@ class Parser { |
} else { |
token = skipBlock(token); |
} |
- listener.skippedFunctionBody(token); |
+ listener.handleFunctionBodySkipped(token); |
} |
return token; |
} |