| OLD | NEW |
| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 pop(); // Modifiers. | 343 pop(); // Modifiers. |
| 344 } | 344 } |
| 345 | 345 |
| 346 @override | 346 @override |
| 347 void endMember() { | 347 void endMember() { |
| 348 debugEvent("Member"); | 348 debugEvent("Member"); |
| 349 checkEmpty(-1); | 349 checkEmpty(-1); |
| 350 } | 350 } |
| 351 | 351 |
| 352 @override | 352 @override |
| 353 void endFunctionBody(int count, Token beginToken, Token endToken) { | 353 void endBlockFunctionBody(int count, Token beginToken, Token endToken) { |
| 354 debugEvent("FunctionBody"); | 354 debugEvent("BlockFunctionBody"); |
| 355 if (beginToken == null) { | 355 if (beginToken == null) { |
| 356 assert(count == 0); | 356 assert(count == 0); |
| 357 push(NullValue.Block); | 357 push(NullValue.Block); |
| 358 } else { | 358 } else { |
| 359 Block block = popBlock(count); | 359 Block block = popBlock(count); |
| 360 exitLocalScope(); | 360 exitLocalScope(); |
| 361 push(block); | 361 push(block); |
| 362 } | 362 } |
| 363 } | 363 } |
| 364 | 364 |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 push(new StringConcatenation(expressions ?? parts)); | 862 push(new StringConcatenation(expressions ?? parts)); |
| 863 } | 863 } |
| 864 | 864 |
| 865 @override | 865 @override |
| 866 void handleLiteralInt(Token token) { | 866 void handleLiteralInt(Token token) { |
| 867 debugEvent("LiteralInt"); | 867 debugEvent("LiteralInt"); |
| 868 push(new IntLiteral(int.parse(token.lexeme))); | 868 push(new IntLiteral(int.parse(token.lexeme))); |
| 869 } | 869 } |
| 870 | 870 |
| 871 @override | 871 @override |
| 872 void endEmptyFunctionBody(Token semicolon) { | 872 void handleEmptyFunctionBody(Token semicolon) { |
| 873 debugEvent("ExpressionFunctionBody"); | 873 debugEvent("ExpressionFunctionBody"); |
| 874 endFunctionBody(0, null, semicolon); | 874 endBlockFunctionBody(0, null, semicolon); |
| 875 } | 875 } |
| 876 | 876 |
| 877 @override | 877 @override |
| 878 void endExpressionFunctionBody(Token arrowToken, Token endToken) { | 878 void handleExpressionFunctionBody(Token arrowToken, Token endToken) { |
| 879 debugEvent("ExpressionFunctionBody"); | 879 debugEvent("ExpressionFunctionBody"); |
| 880 endReturnStatement(true, arrowToken, endToken); | 880 endReturnStatement(true, arrowToken, endToken); |
| 881 } | 881 } |
| 882 | 882 |
| 883 @override | 883 @override |
| 884 void endReturnStatement( | 884 void endReturnStatement( |
| 885 bool hasExpression, Token beginToken, Token endToken) { | 885 bool hasExpression, Token beginToken, Token endToken) { |
| 886 debugEvent("ReturnStatement"); | 886 debugEvent("ReturnStatement"); |
| 887 Expression expression = hasExpression ? popForValue() : null; | 887 Expression expression = hasExpression ? popForValue() : null; |
| 888 if (expression != null && inConstructor) { | 888 if (expression != null && inConstructor) { |
| (...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 } else if (node is PrefixBuilder) { | 2769 } else if (node is PrefixBuilder) { |
| 2770 return node.name; | 2770 return node.name; |
| 2771 } else if (node is ThisAccessor) { | 2771 } else if (node is ThisAccessor) { |
| 2772 return node.isSuper ? "super" : "this"; | 2772 return node.isSuper ? "super" : "this"; |
| 2773 } else if (node is BuilderAccessor) { | 2773 } else if (node is BuilderAccessor) { |
| 2774 return node.plainNameForRead; | 2774 return node.plainNameForRead; |
| 2775 } else { | 2775 } else { |
| 2776 return internalError("Unhandled: ${node.runtimeType}"); | 2776 return internalError("Unhandled: ${node.runtimeType}"); |
| 2777 } | 2777 } |
| 2778 } | 2778 } |
| OLD | NEW |