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

Side by Side Diff: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart

Issue 2703393005: Implement FunctionTypeAlias in AstBuilder. (Closed)
Patch Set: Reformat 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.analyzer.ast_builder; 5 library fasta.analyzer.ast_builder;
6 6
7 import 'package:front_end/src/fasta/scanner/token.dart' 7 import 'package:front_end/src/fasta/scanner/token.dart'
8 show BeginGroupToken, Token; 8 show BeginGroupToken, Token;
9 9
10 import 'package:analyzer/analyzer.dart'; 10 import 'package:analyzer/analyzer.dart';
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 1069
1070 @override 1070 @override
1071 void handleVoidKeyword(Token token) { 1071 void handleVoidKeyword(Token token) {
1072 debugEvent("VoidKeyword"); 1072 debugEvent("VoidKeyword");
1073 // TODO(paulberry): is this sufficient, or do we need to hook the "void" 1073 // TODO(paulberry): is this sufficient, or do we need to hook the "void"
1074 // keyword up to an element? 1074 // keyword up to an element?
1075 handleIdentifier(token); 1075 handleIdentifier(token);
1076 handleNoTypeArguments(token); 1076 handleNoTypeArguments(token);
1077 endType(token, token); 1077 endType(token, token);
1078 } 1078 }
1079
1080 @override
1081 void endFunctionTypeAlias(Token typedefKeyword, Token endToken) {
1082 debugEvent("FunctionTypeAlias");
1083 FormalParameterList parameters = pop();
1084 TypeParameterList typeParameters = pop();
1085 SimpleIdentifier name = pop();
1086 TypeAnnotation returnType = pop();
1087 List<Annotation> metadata = pop();
1088 // TODO(paulberry): capture doc comments.
1089 Comment comment = null;
1090 push(ast.functionTypeAlias(
1091 comment,
1092 metadata,
1093 toAnalyzerToken(typedefKeyword),
1094 returnType,
1095 name,
1096 typeParameters,
1097 parameters,
1098 toAnalyzerToken(endToken)));
1099 }
1079 } 1100 }
1080 1101
1081 /// Data structure placed on the stack to represent a class body. 1102 /// Data structure placed on the stack to represent a class body.
1082 /// 1103 ///
1083 /// This is needed because analyzer has no separate AST representation of a 1104 /// This is needed because analyzer has no separate AST representation of a
1084 /// class body; it simply stores all of the relevant data in the 1105 /// class body; it simply stores all of the relevant data in the
1085 /// [ClassDeclaration] object. 1106 /// [ClassDeclaration] object.
1086 class _ClassBody { 1107 class _ClassBody {
1087 final Token beginToken; 1108 final Token beginToken;
1088 1109
(...skipping 12 matching lines...) Expand all
1101 /// [ClassDeclaration] or [ClassTypeAlias] object. 1122 /// [ClassDeclaration] or [ClassTypeAlias] object.
1102 class _MixinApplication { 1123 class _MixinApplication {
1103 final TypeName supertype; 1124 final TypeName supertype;
1104 1125
1105 final Token withKeyword; 1126 final Token withKeyword;
1106 1127
1107 final List<TypeName> mixinTypes; 1128 final List<TypeName> mixinTypes;
1108 1129
1109 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes); 1130 _MixinApplication(this.supertype, this.withKeyword, this.mixinTypes);
1110 } 1131 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | pkg/front_end/lib/src/fasta/parser/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698