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

Unified Diff: pkg/compiler/lib/src/parser/node_listener.dart

Issue 2969053002: Implement type variables on old style function-typed formal parameters. (Closed)
Patch Set: Add comment. Created 3 years, 5 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: pkg/compiler/lib/src/parser/node_listener.dart
diff --git a/pkg/compiler/lib/src/parser/node_listener.dart b/pkg/compiler/lib/src/parser/node_listener.dart
index 2aea11001153f7a3c0e5dae4280a765afbc8922e..aef9278f8381c6195383ac38dec19870faf8b242 100644
--- a/pkg/compiler/lib/src/parser/node_listener.dart
+++ b/pkg/compiler/lib/src/parser/node_listener.dart
@@ -768,14 +768,36 @@ class NodeListener extends ElementListener {
}
@override
- void endFunctionTypedFormalParameter(
- Token thisKeyword, FormalParameterType kind) {
+ void handleIdentifier(Token token, IdentifierContext context) {
+ if (IdentifierContext.formalParameterDeclaration == context ||
+ IdentifierContext.fieldInitializer == context) {
+ var typeAnnotation = popNode();
+ if (typeAnnotation is FunctionExpression) {
+ pushNode(null); // Signal "no type" to endFormalParameter.
+ pushNode(new FunctionExpression(
+ new Identifier(token),
+ typeAnnotation.typeVariables,
+ typeAnnotation.parameters,
+ null,
+ typeAnnotation.returnType,
+ typeAnnotation.modifiers,
+ null,
+ null,
+ null));
+ return;
+ } else {
+ pushNode(typeAnnotation);
+ }
+ }
+ pushNode(new Identifier(token));
+ }
+
+ @override
+ void endFunctionTypedFormalParameter() {
NodeList formals = popNode();
- NodeList typeVariables = popNode();
- Identifier name = popNode();
TypeAnnotation returnType = popNode();
- pushNode(null); // Signal "no type" to endFormalParameter.
- pushNode(new FunctionExpression(name, typeVariables, formals, null,
+ NodeList typeVariables = popNode();
+ pushNode(new FunctionExpression(null, typeVariables, formals, null,
returnType, Modifiers.EMPTY, null, null, null));
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/fasta/summary_builder.dart ('k') | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698