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 'package:dart_parser/src/parser.dart' show | 7 import 'package:dart_parser/src/parser.dart' show |
8 FormalParameterType, | 8 FormalParameterType, |
9 optional; | 9 optional; |
10 | 10 |
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 continueTarget.resolveContinues(body); | 1671 continueTarget.resolveContinues(body); |
1672 } | 1672 } |
1673 Statement result = new DoStatement(body, condition); | 1673 Statement result = new DoStatement(body, condition); |
1674 if (breakTarget.hasUsers) { | 1674 if (breakTarget.hasUsers) { |
1675 result = new LabeledStatement(result); | 1675 result = new LabeledStatement(result); |
1676 breakTarget.resolveBreaks(result); | 1676 breakTarget.resolveBreaks(result); |
1677 } | 1677 } |
1678 exitLoopOrSwitch(result); | 1678 exitLoopOrSwitch(result); |
1679 } | 1679 } |
1680 | 1680 |
| 1681 void beginForInExpression(Token token) { |
| 1682 enterLocalScope(scope.parent); |
| 1683 } |
| 1684 |
| 1685 void endForInExpression(Token token) { |
| 1686 debugEvent("ForInExpression"); |
| 1687 Expression expression = popForValue(); |
| 1688 exitLocalScope(); |
| 1689 push(expression ?? NullValue.Expression); |
| 1690 } |
| 1691 |
1681 void endForIn( | 1692 void endForIn( |
1682 Token awaitToken, Token forToken, Token inKeyword, Token endToken) { | 1693 Token awaitToken, Token forToken, Token inKeyword, Token endToken) { |
1683 debugEvent("ForIn"); | 1694 debugEvent("ForIn"); |
1684 Statement body = popStatement(); | 1695 Statement body = popStatement(); |
1685 Expression expression = popForValue(); | 1696 Expression expression = popForValue(); |
1686 var lvalue = pop(); | 1697 var lvalue = pop(); |
1687 exitLocalScope(); | 1698 exitLocalScope(); |
1688 JumpTarget continueTarget = exitContinueTarget(); | 1699 JumpTarget continueTarget = exitContinueTarget(); |
1689 JumpTarget breakTarget = exitBreakTarget(); | 1700 JumpTarget breakTarget = exitBreakTarget(); |
1690 if (continueTarget.hasUsers) { | 1701 if (continueTarget.hasUsers) { |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2505 } else if (node is TypeDeclarationBuilder) { | 2516 } else if (node is TypeDeclarationBuilder) { |
2506 return node.name; | 2517 return node.name; |
2507 } else if (node is PrefixBuilder) { | 2518 } else if (node is PrefixBuilder) { |
2508 return node.name; | 2519 return node.name; |
2509 } else if (node is ThisPropertyAccessor) { | 2520 } else if (node is ThisPropertyAccessor) { |
2510 return node.name.name; | 2521 return node.name.name; |
2511 } else { | 2522 } else { |
2512 return internalError("Unhandled: ${node.runtimeType}"); | 2523 return internalError("Unhandled: ${node.runtimeType}"); |
2513 } | 2524 } |
2514 } | 2525 } |
OLD | NEW |