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

Side by Side Diff: pkg/analyzer/tool/summary/mini_ast.dart

Issue 2933753002: Run the sorter to reduce code churn (Closed)
Patch Set: Created 3 years, 6 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:front_end/src/fasta/errors.dart' show internalError; 5 import 'package:front_end/src/fasta/errors.dart' show internalError;
6 import 'package:front_end/src/fasta/fasta_codes.dart' show FastaMessage; 6 import 'package:front_end/src/fasta/fasta_codes.dart' show FastaMessage;
7 import 'package:front_end/src/fasta/parser/identifier_context.dart'; 7 import 'package:front_end/src/fasta/parser/identifier_context.dart';
8 import 'package:front_end/src/fasta/parser/parser.dart'; 8 import 'package:front_end/src/fasta/parser/parser.dart';
9 import 'package:front_end/src/fasta/source/stack_listener.dart'; 9 import 'package:front_end/src/fasta/source/stack_listener.dart';
10 import 'package:front_end/src/scanner/token.dart'; 10 import 'package:front_end/src/scanner/token.dart';
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 /// code. This representation is just sufficient for summary code generation. 149 /// code. This representation is just sufficient for summary code generation.
150 class MiniAstBuilder extends StackListener { 150 class MiniAstBuilder extends StackListener {
151 bool inMetadata = false; 151 bool inMetadata = false;
152 152
153 final compilationUnit = new CompilationUnit(); 153 final compilationUnit = new CompilationUnit();
154 154
155 @override 155 @override
156 Uri get uri => null; 156 Uri get uri => null;
157 157
158 @override 158 @override
159 void addCompileTimeErrorFromMessage(FastaMessage message) {
160 internalError(message.message);
161 }
162
163 @override
159 void beginMetadata(Token token) { 164 void beginMetadata(Token token) {
160 inMetadata = true; 165 inMetadata = true;
161 } 166 }
162 167
163 @override 168 @override
164 void beginMetadataStar(Token token) { 169 void beginMetadataStar(Token token) {
165 debugEvent("beginMetadataStar"); 170 debugEvent("beginMetadataStar");
166 if (token.precedingComments != null) { 171 if (token.precedingComments != null) {
167 push(new Comment(token.precedingComments)); 172 push(new Comment(token.precedingComments));
168 } else { 173 } else {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 push('$prefix.$suffix'); 431 push('$prefix.$suffix');
427 } 432 }
428 433
429 @override 434 @override
430 void handleType(Token beginToken, Token endToken) { 435 void handleType(Token beginToken, Token endToken) {
431 debugEvent("Type"); 436 debugEvent("Type");
432 List<TypeName> typeArguments = pop(); 437 List<TypeName> typeArguments = pop();
433 String name = pop(); 438 String name = pop();
434 push(new TypeName(name, typeArguments)); 439 push(new TypeName(name, typeArguments));
435 } 440 }
436
437 @override
438 void addCompileTimeErrorFromMessage(FastaMessage message) {
439 internalError(message.message);
440 }
441 } 441 }
442 442
443 /// Parser intended for use with [MiniAstBuilder]. 443 /// Parser intended for use with [MiniAstBuilder].
444 class MiniAstParser extends Parser { 444 class MiniAstParser extends Parser {
445 MiniAstParser(MiniAstBuilder listener) : super(listener); 445 MiniAstParser(MiniAstBuilder listener) : super(listener);
446 446
447 Token parseArgumentsOpt(Token token) { 447 Token parseArgumentsOpt(Token token) {
448 MiniAstBuilder listener = this.listener; 448 MiniAstBuilder listener = this.listener;
449 if (listener.inMetadata) { 449 if (listener.inMetadata) {
450 return super.parseArgumentsOpt(token); 450 return super.parseArgumentsOpt(token);
(...skipping 19 matching lines...) Expand all
470 final String name; 470 final String name;
471 471
472 final List<TypeName> typeArguments; 472 final List<TypeName> typeArguments;
473 473
474 TypeName(this.name, this.typeArguments); 474 TypeName(this.name, this.typeArguments);
475 } 475 }
476 476
477 /// "Mini AST" representation of an expression which summary code generation 477 /// "Mini AST" representation of an expression which summary code generation
478 /// need not be concerned about. 478 /// need not be concerned about.
479 class UnknownExpression extends Expression {} 479 class UnknownExpression extends Expression {}
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/task/strong/checker_test.dart ('k') | pkg/analyzer_cli/lib/src/analyzer_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698