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

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

Issue 2749623003: Revert "Add support for metadata on type variables to Fasta parser." (Closed)
Patch Set: Created 3 years, 9 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:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory;
9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard;
10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; 10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 void endArguments(int count, Token beginToken, Token endToken) { 157 void endArguments(int count, Token beginToken, Token endToken) {
158 debugEvent("Arguments"); 158 debugEvent("Arguments");
159 List expressions = popList(count); 159 List expressions = popList(count);
160 ArgumentList arguments = ast.argumentList( 160 ArgumentList arguments = ast.argumentList(
161 toAnalyzerToken(beginToken), expressions, toAnalyzerToken(endToken)); 161 toAnalyzerToken(beginToken), expressions, toAnalyzerToken(endToken));
162 push(ast.methodInvocation(null, null, null, null, arguments)); 162 push(ast.methodInvocation(null, null, null, null, arguments));
163 } 163 }
164 164
165 void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) {
166 debugEvent("Metadata");
167 ArgumentList arguments = pop();
168 SimpleIdentifier constructorName = popIfNotNull(periodBeforeName);
169 var typeArguments = pop();
170 assert(typeArguments == null); // TODO(paulberry)
171 Identifier name = pop();
172 push(ast.annotation(toAnalyzerToken(beginToken), name,
173 toAnalyzerToken(periodBeforeName), constructorName, arguments));
174 }
175
176 void handleIdentifier(Token token, IdentifierContext context) { 165 void handleIdentifier(Token token, IdentifierContext context) {
177 debugEvent("handleIdentifier"); 166 debugEvent("handleIdentifier");
178 analyzer.Token analyzerToken = toAnalyzerToken(token); 167 analyzer.Token analyzerToken = toAnalyzerToken(token);
179 168
180 if (context.inSymbol) { 169 if (context.inSymbol) {
181 push(analyzerToken); 170 push(analyzerToken);
182 return; 171 return;
183 } 172 }
184 173
185 SimpleIdentifier identifier = ast.simpleIdentifier(analyzerToken); 174 SimpleIdentifier identifier = ast.simpleIdentifier(analyzerToken);
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 1258
1270 @override 1259 @override
1271 void endTypeVariable(Token token, Token extendsOrSuper) { 1260 void endTypeVariable(Token token, Token extendsOrSuper) {
1272 // TODO(paulberry): set up scopes properly to resolve parameters and type 1261 // TODO(paulberry): set up scopes properly to resolve parameters and type
1273 // variables. Note that this is tricky due to the handling of initializers 1262 // variables. Note that this is tricky due to the handling of initializers
1274 // in constructors, so the logic should be shared with BodyBuilder as much 1263 // in constructors, so the logic should be shared with BodyBuilder as much
1275 // as possible. 1264 // as possible.
1276 debugEvent("TypeVariable"); 1265 debugEvent("TypeVariable");
1277 TypeAnnotation bound = pop(); 1266 TypeAnnotation bound = pop();
1278 SimpleIdentifier name = pop(); 1267 SimpleIdentifier name = pop();
1279 List<Annotation> metadata = pop(); 1268 List<Annotation> metadata = null; // TODO(paulberry)
1280 Comment comment = pop(); 1269 // TODO(paulberry): capture doc comments. See dartbug.com/28851.
1270 Comment comment = null;
1281 push(ast.typeParameter( 1271 push(ast.typeParameter(
1282 comment, metadata, name, toAnalyzerToken(extendsOrSuper), bound)); 1272 comment, metadata, name, toAnalyzerToken(extendsOrSuper), bound));
1283 } 1273 }
1284 1274
1285 @override 1275 @override
1286 void endTypeVariables(int count, Token beginToken, Token endToken) { 1276 void endTypeVariables(int count, Token beginToken, Token endToken) {
1287 debugEvent("TypeVariables"); 1277 debugEvent("TypeVariables");
1288 List<TypeParameter> typeParameters = popList(count); 1278 List<TypeParameter> typeParameters = popList(count);
1289 push(ast.typeParameterList(toAnalyzerToken(beginToken), typeParameters, 1279 push(ast.typeParameterList(toAnalyzerToken(beginToken), typeParameters,
1290 toAnalyzerToken(endToken))); 1280 toAnalyzerToken(endToken)));
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 } else if (identical('static', s)) { 1588 } else if (identical('static', s)) {
1599 staticKeyword = token; 1589 staticKeyword = token;
1600 } else if (identical('var', s)) { 1590 } else if (identical('var', s)) {
1601 finalConstOrVarKeyword = token; 1591 finalConstOrVarKeyword = token;
1602 } else { 1592 } else {
1603 internalError('Unhandled modifier: $s'); 1593 internalError('Unhandled modifier: $s');
1604 } 1594 }
1605 } 1595 }
1606 } 1596 }
1607 } 1597 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/parser/node_listener.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