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

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

Issue 2710973002: Revert "Add support for the new function-type syntax." (Closed)
Patch Set: Created 3 years, 10 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 f533629100912f6ebaac2d97afc7e48bbf40482d..b5cbad61da0b334b0f4874726239afca58218d09 100644
--- a/pkg/compiler/lib/src/parser/node_listener.dart
+++ b/pkg/compiler/lib/src/parser/node_listener.dart
@@ -126,60 +126,13 @@ class NodeListener extends ElementListener {
}
@override
- void endFunctionTypeAlias(
- Token typedefKeyword, Token equals, Token endToken) {
- bool isGeneralizedTypeAlias;
- NodeList templateParameters;
- TypeAnnotation returnType;
- Identifier name;
- NodeList typeParameters;
- NodeList formals;
- if (equals == null) {
- isGeneralizedTypeAlias = false;
- formals = popNode();
- templateParameters = popNode();
- name = popNode();
- returnType = popNode();
- } else {
- // TODO(floitsch): keep using the `FunctionTypeAnnotation' node.
- isGeneralizedTypeAlias = true;
- Node type = popNode();
- if (type.asFunctionTypeAnnotation() == null) {
- // TODO(floitsch): The parser should diagnose this problem, not
- // this listener.
- // However, this problem goes away, when we allow aliases for
- // non-function types too.
- reportFatalError(type, 'Expected a function type.');
- }
- FunctionTypeAnnotation functionType = type;
- templateParameters = popNode();
- name = popNode();
- returnType = functionType.returnType;
- typeParameters = functionType.typeParameters;
- formals = functionType.formals;
- }
- pushNode(new Typedef(
- isGeneralizedTypeAlias,
- templateParameters,
- returnType,
- name,
- typeParameters,
- formals,
- typedefKeyword,
- endToken));
- }
-
- void handleNoName(Token token) {
- pushNode(null);
- }
-
- @override
- void handleFunctionType(Token functionToken, Token endToken) {
+ void endFunctionTypeAlias(Token typedefKeyword, Token endToken) {
NodeList formals = popNode();
NodeList typeParameters = popNode();
+ Identifier name = popNode();
TypeAnnotation returnType = popNode();
- pushNode(new FunctionTypeAnnotation(
- returnType, functionToken, typeParameters, formals));
+ pushNode(new Typedef(
+ returnType, name, typeParameters, formals, typedefKeyword, endToken));
}
@override
@@ -276,7 +229,7 @@ class NodeListener extends ElementListener {
NodeList typeArguments = popNode();
Node classReference = popNode();
if (typeArguments != null) {
- classReference = new NominalTypeAnnotation(classReference, typeArguments);
+ classReference = new TypeAnnotation(classReference, typeArguments);
} else {
Identifier identifier = classReference.asIdentifier();
Send send = classReference.asSend();
@@ -914,7 +867,7 @@ class NodeListener extends ElementListener {
NodeList typeArguments = popNode();
Node receiver = popNode();
if (typeArguments != null) {
- receiver = new NominalTypeAnnotation(receiver, typeArguments);
+ receiver = new TypeAnnotation(receiver, typeArguments);
recoverableError(typeArguments, 'Type arguments are not allowed here.');
} else {
Identifier identifier = receiver.asIdentifier();
« no previous file with comments | « pkg/compiler/lib/src/parser/element_listener.dart ('k') | pkg/compiler/lib/src/parser/partial_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698