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

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

Issue 2728773002: Fix parsing [a]sync[*] function body modifiers with Fasta. (Closed)
Patch Set: Use endExpressionFunctionBody() instead of endReturnStatement(). 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 'package:front_end/src/fasta/parser/parser.dart' 7 import 'package:front_end/src/fasta/parser/parser.dart'
8 show FormalParameterType, optional; 8 show FormalParameterType, optional;
9 9
10 import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind; 10 import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind;
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 push(new StringConcatenation(expressions ?? parts)); 834 push(new StringConcatenation(expressions ?? parts));
835 } 835 }
836 836
837 @override 837 @override
838 void handleLiteralInt(Token token) { 838 void handleLiteralInt(Token token) {
839 debugEvent("LiteralInt"); 839 debugEvent("LiteralInt");
840 push(new IntLiteral(int.parse(token.value))); 840 push(new IntLiteral(int.parse(token.value)));
841 } 841 }
842 842
843 @override 843 @override
844 void endExpressionFunctionBody(Token arrowToken, Token endToken) {
845 debugEvent("ExpressionFunctionBody");
846 endReturnStatement(true, arrowToken, endToken);
847 }
848
849 @override
844 void endReturnStatement( 850 void endReturnStatement(
845 bool hasExpression, Token beginToken, Token endToken) { 851 bool hasExpression, Token beginToken, Token endToken) {
846 debugEvent("ReturnStatement"); 852 debugEvent("ReturnStatement");
847 Expression expression = hasExpression ? popForValue() : null; 853 Expression expression = hasExpression ? popForValue() : null;
848 if (expression != null && inConstructor) { 854 if (expression != null && inConstructor) {
849 push(buildCompileTimeErrorStatement( 855 push(buildCompileTimeErrorStatement(
850 "Can't return from a constructor.", beginToken.charOffset)); 856 "Can't return from a constructor.", beginToken.charOffset));
851 } else { 857 } else {
852 push(new ReturnStatement(expression)); 858 push(new ReturnStatement(expression));
853 } 859 }
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after
2672 } else if (node is TypeDeclarationBuilder) { 2678 } else if (node is TypeDeclarationBuilder) {
2673 return node.name; 2679 return node.name;
2674 } else if (node is PrefixBuilder) { 2680 } else if (node is PrefixBuilder) {
2675 return node.name; 2681 return node.name;
2676 } else if (node is ThisPropertyAccessor) { 2682 } else if (node is ThisPropertyAccessor) {
2677 return node.name.name; 2683 return node.name.name;
2678 } else { 2684 } else {
2679 return internalError("Unhandled: ${node.runtimeType}"); 2685 return internalError("Unhandled: ${node.runtimeType}");
2680 } 2686 }
2681 } 2687 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart ('k') | pkg/front_end/lib/src/fasta/parser/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698