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

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

Issue 2985703002: new handleInvalidTopLevelDeclaration event in fasta parser (Closed)
Patch Set: cleanup forwarding listener - enclosingEvent Created 3 years, 4 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/problems.dart' 5 import 'package:front_end/src/fasta/problems.dart'
6 show internalProblem, unsupported; 6 show internalProblem, unsupported;
7 import 'package:front_end/src/fasta/messages.dart' show Message; 7 import 'package:front_end/src/fasta/messages.dart' show Message;
8 import 'package:front_end/src/fasta/parser.dart'; 8 import 'package:front_end/src/fasta/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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 396
397 void handleIdentifier(Token token, IdentifierContext context) { 397 void handleIdentifier(Token token, IdentifierContext context) {
398 if (context == IdentifierContext.enumValueDeclaration) { 398 if (context == IdentifierContext.enumValueDeclaration) {
399 var comment = new Comment(token.precedingComments); 399 var comment = new Comment(token.precedingComments);
400 push(new EnumConstantDeclaration(comment, null, token.lexeme)); 400 push(new EnumConstantDeclaration(comment, null, token.lexeme));
401 } else { 401 } else {
402 push(token.lexeme); 402 push(token.lexeme);
403 } 403 }
404 } 404 }
405 405
406 @override
407 void handleInvalidTopLevelDeclaration(Token beginToken, Token endToken) {
408 debugEvent("InvalidTopLevelDeclaration");
409 pop(); // metadata star
410 }
411
406 void handleLiteralInt(Token token) { 412 void handleLiteralInt(Token token) {
407 debugEvent("LiteralInt"); 413 debugEvent("LiteralInt");
408 push(new IntegerLiteral(int.parse(token.lexeme))); 414 push(new IntegerLiteral(int.parse(token.lexeme)));
409 } 415 }
410 416
411 void handleLiteralNull(Token token) { 417 void handleLiteralNull(Token token) {
412 debugEvent("LiteralNull"); 418 debugEvent("LiteralNull");
413 push(new UnknownExpression()); 419 push(new UnknownExpression());
414 } 420 }
415 421
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 final String name; 476 final String name;
471 477
472 final List<TypeName> typeArguments; 478 final List<TypeName> typeArguments;
473 479
474 TypeName(this.name, this.typeArguments); 480 TypeName(this.name, this.typeArguments);
475 } 481 }
476 482
477 /// "Mini AST" representation of an expression which summary code generation 483 /// "Mini AST" representation of an expression which summary code generation
478 /// need not be concerned about. 484 /// need not be concerned about.
479 class UnknownExpression extends Expression {} 485 class UnknownExpression extends Expression {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698