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

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

Issue 2948383002: Remove peeking from parseTypedef and parseClassOrNamedMixinApplication. (Closed)
Patch Set: Addressed comments and then some. 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/parser/identifier_context.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 push(ast.enumConstantDeclaration(comment, metadata, identifier)); 220 push(ast.enumConstantDeclaration(comment, metadata, identifier));
221 } else { 221 } else {
222 if (context.isScopeReference) { 222 if (context.isScopeReference) {
223 String name = token.lexeme; 223 String name = token.lexeme;
224 Builder builder = scope.lookup(name, token.charOffset, uri); 224 Builder builder = scope.lookup(name, token.charOffset, uri);
225 if (builder != null) { 225 if (builder != null) {
226 Element element = elementStore[builder]; 226 Element element = elementStore[builder];
227 assert(element != null); 227 assert(element != null);
228 identifier.staticElement = element; 228 identifier.staticElement = element;
229 } 229 }
230 } else if (context == IdentifierContext.classDeclaration) {
231 className = identifier.name;
232 } 230 }
233 push(identifier); 231 push(identifier);
234 } 232 }
235 } 233 }
236 234
237 void endSend(Token beginToken, Token endToken) { 235 void endSend(Token beginToken, Token endToken) {
238 debugEvent("Send"); 236 debugEvent("Send");
239 MethodInvocation arguments = pop(); 237 MethodInvocation arguments = pop();
240 TypeArgumentList typeArguments = pop(); 238 TypeArgumentList typeArguments = pop();
241 if (arguments != null) { 239 if (arguments != null) {
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 } 1329 }
1332 1330
1333 @override 1331 @override
1334 void endClassBody(int memberCount, Token beginToken, Token endToken) { 1332 void endClassBody(int memberCount, Token beginToken, Token endToken) {
1335 debugEvent("ClassBody"); 1333 debugEvent("ClassBody");
1336 push(new _ClassBody( 1334 push(new _ClassBody(
1337 beginToken, popList(memberCount) ?? <ClassMember>[], endToken)); 1335 beginToken, popList(memberCount) ?? <ClassMember>[], endToken));
1338 } 1336 }
1339 1337
1340 @override 1338 @override
1339 void beginClassDeclaration(Token beginToken, Token name) {
1340 assert(className == null);
1341 className = name.lexeme;
1342 }
1343
1344 @override
1341 void endClassDeclaration( 1345 void endClassDeclaration(
1342 int interfacesCount, 1346 int interfacesCount,
1343 Token beginToken, 1347 Token beginToken,
1344 Token classKeyword, 1348 Token classKeyword,
1345 Token extendsKeyword, 1349 Token extendsKeyword,
1346 Token implementsKeyword, 1350 Token implementsKeyword,
1347 Token endToken) { 1351 Token endToken) {
1348 debugEvent("ClassDeclaration"); 1352 debugEvent("ClassDeclaration");
1349 _ClassBody body = pop(); 1353 _ClassBody body = pop();
1350 ImplementsClause implementsClause; 1354 ImplementsClause implementsClause;
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 } else if (identical('var', s)) { 2038 } else if (identical('var', s)) {
2035 finalConstOrVarKeyword = token; 2039 finalConstOrVarKeyword = token;
2036 } else if (identical('covariant', s)) { 2040 } else if (identical('covariant', s)) {
2037 covariantKeyword = token; 2041 covariantKeyword = token;
2038 } else { 2042 } else {
2039 internalError('Unhandled modifier: $s'); 2043 internalError('Unhandled modifier: $s');
2040 } 2044 }
2041 } 2045 }
2042 } 2046 }
2043 } 2047 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/parser/identifier_context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698