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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2742233002: Fix for parsing EmptyFunctionBody 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.body_builder; 5 library fasta.body_builder;
6 6
7 import '../parser/parser.dart' show FormalParameterType, optional; 7 import '../parser/parser.dart' show FormalParameterType, optional;
8 8
9 import '../parser/error_kind.dart' show ErrorKind; 9 import '../parser/error_kind.dart' show ErrorKind;
10 10
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 push(new StringConcatenation(expressions ?? parts)); 851 push(new StringConcatenation(expressions ?? parts));
852 } 852 }
853 853
854 @override 854 @override
855 void handleLiteralInt(Token token) { 855 void handleLiteralInt(Token token) {
856 debugEvent("LiteralInt"); 856 debugEvent("LiteralInt");
857 push(new IntLiteral(int.parse(token.value))); 857 push(new IntLiteral(int.parse(token.value)));
858 } 858 }
859 859
860 @override 860 @override
861 void endEmptyFunctionBody(Token semicolon) {
862 debugEvent("ExpressionFunctionBody");
863 endFunctionBody(0, null, semicolon);
864 }
865
866 @override
861 void endExpressionFunctionBody(Token arrowToken, Token endToken) { 867 void endExpressionFunctionBody(Token arrowToken, Token endToken) {
862 debugEvent("ExpressionFunctionBody"); 868 debugEvent("ExpressionFunctionBody");
863 endReturnStatement(true, arrowToken, endToken); 869 endReturnStatement(true, arrowToken, endToken);
864 } 870 }
865 871
866 @override 872 @override
867 void endReturnStatement( 873 void endReturnStatement(
868 bool hasExpression, Token beginToken, Token endToken) { 874 bool hasExpression, Token beginToken, Token endToken) {
869 debugEvent("ReturnStatement"); 875 debugEvent("ReturnStatement");
870 Expression expression = hasExpression ? popForValue() : null; 876 Expression expression = hasExpression ? popForValue() : null;
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2721 } else if (node is PrefixBuilder) { 2727 } else if (node is PrefixBuilder) {
2722 return node.name; 2728 return node.name;
2723 } else if (node is ThisAccessor) { 2729 } else if (node is ThisAccessor) {
2724 return node.isSuper ? "super" : "this"; 2730 return node.isSuper ? "super" : "this";
2725 } else if (node is BuilderAccessor) { 2731 } else if (node is BuilderAccessor) {
2726 return node.plainNameForRead; 2732 return node.plainNameForRead;
2727 } else { 2733 } else {
2728 return internalError("Unhandled: ${node.runtimeType}"); 2734 return internalError("Unhandled: ${node.runtimeType}");
2729 } 2735 }
2730 } 2736 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698