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

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

Issue 2748093004: Parse break and continue statements with Fasta. (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
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | no next file » | 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 push(ast.typeName(name, arguments)..type = cls?.rawType); 579 push(ast.typeName(name, arguments)..type = cls?.rawType);
580 } 580 }
581 581
582 void handleAsOperator(Token operator, Token endToken) { 582 void handleAsOperator(Token operator, Token endToken) {
583 debugEvent("AsOperator"); 583 debugEvent("AsOperator");
584 TypeAnnotation type = pop(); 584 TypeAnnotation type = pop();
585 Expression expression = pop(); 585 Expression expression = pop();
586 push(ast.asExpression(expression, toAnalyzerToken(operator), type)); 586 push(ast.asExpression(expression, toAnalyzerToken(operator), type));
587 } 587 }
588 588
589 @override
590 void handleBreakStatement(
591 bool hasTarget, Token breakKeyword, Token semicolon) {
592 debugEvent("BreakStatement");
593 SimpleIdentifier label = hasTarget ? pop() : null;
594 push(ast.breakStatement(
595 toAnalyzerToken(breakKeyword), label, toAnalyzerToken(semicolon)));
596 }
597
598 @override
599 void handleContinueStatement(
600 bool hasTarget, Token continueKeyword, Token semicolon) {
601 debugEvent("ContinueStatement");
602 SimpleIdentifier label = hasTarget ? pop() : null;
603 push(ast.continueStatement(
604 toAnalyzerToken(continueKeyword), label, toAnalyzerToken(semicolon)));
605 }
606
589 void handleIsOperator(Token operator, Token not, Token endToken) { 607 void handleIsOperator(Token operator, Token not, Token endToken) {
590 debugEvent("IsOperator"); 608 debugEvent("IsOperator");
591 TypeAnnotation type = pop(); 609 TypeAnnotation type = pop();
592 Expression expression = pop(); 610 Expression expression = pop();
593 push(ast.isExpression( 611 push(ast.isExpression(
594 expression, toAnalyzerToken(operator), toAnalyzerToken(not), type)); 612 expression, toAnalyzerToken(operator), toAnalyzerToken(not), type));
595 } 613 }
596 614
597 void handleConditionalExpression(Token question, Token colon) { 615 void handleConditionalExpression(Token question, Token colon) {
598 debugEvent("ConditionalExpression"); 616 debugEvent("ConditionalExpression");
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 } else if (identical('static', s)) { 1664 } else if (identical('static', s)) {
1647 staticKeyword = token; 1665 staticKeyword = token;
1648 } else if (identical('var', s)) { 1666 } else if (identical('var', s)) {
1649 finalConstOrVarKeyword = token; 1667 finalConstOrVarKeyword = token;
1650 } else { 1668 } else {
1651 internalError('Unhandled modifier: $s'); 1669 internalError('Unhandled modifier: $s');
1652 } 1670 }
1653 } 1671 }
1654 } 1672 }
1655 } 1673 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698