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

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

Issue 2747803004: Parse assert 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
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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 void handleType(Token beginToken, Token endToken) { 572 void handleType(Token beginToken, Token endToken) {
573 debugEvent("Type"); 573 debugEvent("Type");
574 TypeArgumentList arguments = pop(); 574 TypeArgumentList arguments = pop();
575 Identifier name = pop(); 575 Identifier name = pop();
576 // TODO(paulberry,ahe): what if the type doesn't resolve to a class 576 // TODO(paulberry,ahe): what if the type doesn't resolve to a class
577 // element? Try to share code with BodyBuilder.builderToFirstExpression. 577 // element? Try to share code with BodyBuilder.builderToFirstExpression.
578 KernelClassElement cls = name.staticElement; 578 KernelClassElement cls = name.staticElement;
579 push(ast.typeName(name, arguments)..type = cls?.rawType); 579 push(ast.typeName(name, arguments)..type = cls?.rawType);
580 } 580 }
581 581
582 @override
583 void handleAssertStatement(Token assertKeyword, Token leftParenthesis,
584 Token comma, Token rightParenthesis, Token semicolon) {
585 debugEvent("AssertStatement");
586 Expression message = popIfNotNull(comma);
587 Expression condition = pop();
588 push(ast.assertStatement(
589 toAnalyzerToken(assertKeyword),
590 toAnalyzerToken(leftParenthesis),
591 condition,
592 toAnalyzerToken(comma),
593 message,
594 toAnalyzerToken(rightParenthesis),
595 toAnalyzerToken(semicolon)));
596 }
597
582 void handleAsOperator(Token operator, Token endToken) { 598 void handleAsOperator(Token operator, Token endToken) {
583 debugEvent("AsOperator"); 599 debugEvent("AsOperator");
584 TypeAnnotation type = pop(); 600 TypeAnnotation type = pop();
585 Expression expression = pop(); 601 Expression expression = pop();
586 push(ast.asExpression(expression, toAnalyzerToken(operator), type)); 602 push(ast.asExpression(expression, toAnalyzerToken(operator), type));
587 } 603 }
588 604
589 void handleIsOperator(Token operator, Token not, Token endToken) { 605 void handleIsOperator(Token operator, Token not, Token endToken) {
590 debugEvent("IsOperator"); 606 debugEvent("IsOperator");
591 TypeAnnotation type = pop(); 607 TypeAnnotation type = pop();
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 } else if (identical('static', s)) { 1662 } else if (identical('static', s)) {
1647 staticKeyword = token; 1663 staticKeyword = token;
1648 } else if (identical('var', s)) { 1664 } else if (identical('var', s)) {
1649 finalConstOrVarKeyword = token; 1665 finalConstOrVarKeyword = token;
1650 } else { 1666 } else {
1651 internalError('Unhandled modifier: $s'); 1667 internalError('Unhandled modifier: $s');
1652 } 1668 }
1653 } 1669 }
1654 } 1670 }
1655 } 1671 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/parser/node_listener.dart ('k') | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698