OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'dart:collection'; | 5 import 'dart:collection'; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
8 | 8 |
9 import '../closure.dart'; | 9 import '../closure.dart'; |
10 import '../common.dart'; | 10 import '../common.dart'; |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 // Add the parameter as the last instruction of the entry block. | 1746 // Add the parameter as the last instruction of the entry block. |
1747 // If the method is intercepted, we want the actual receiver | 1747 // If the method is intercepted, we want the actual receiver |
1748 // to be the first parameter. | 1748 // to be the first parameter. |
1749 graph.entry.addBefore(graph.entry.last, parameter); | 1749 graph.entry.addBefore(graph.entry.last, parameter); |
1750 HInstruction value = potentiallyCheckOrTrustType(parameter, field.type); | 1750 HInstruction value = potentiallyCheckOrTrustType(parameter, field.type); |
1751 add(new HFieldSet(field, thisInstruction, value)); | 1751 add(new HFieldSet(field, thisInstruction, value)); |
1752 return closeFunction(); | 1752 return closeFunction(); |
1753 } | 1753 } |
1754 | 1754 |
1755 HGraph buildLazyInitializer(VariableElement variable) { | 1755 HGraph buildLazyInitializer(VariableElement variable) { |
| 1756 assert(invariant(variable, resolvedAst.element == variable, |
| 1757 message: "Unexpected variable $variable for $resolvedAst.")); |
1756 inLazyInitializerExpression = true; | 1758 inLazyInitializerExpression = true; |
1757 assert(invariant(variable, variable.initializer != null, | 1759 ast.VariableDefinitions node = resolvedAst.node; |
| 1760 ast.Node initializer = resolvedAst.body; |
| 1761 assert(invariant(variable, initializer != null, |
1758 message: "Non-constant variable $variable has no initializer.")); | 1762 message: "Non-constant variable $variable has no initializer.")); |
1759 ast.VariableDefinitions node = variable.node; | |
1760 openFunction(variable, node); | 1763 openFunction(variable, node); |
1761 visit(variable.initializer); | 1764 visit(initializer); |
1762 HInstruction value = pop(); | 1765 HInstruction value = pop(); |
1763 value = potentiallyCheckOrTrustType(value, variable.type); | 1766 value = potentiallyCheckOrTrustType(value, variable.type); |
1764 ast.SendSet sendSet = node.definitions.nodes.head; | 1767 ast.SendSet sendSet = node.definitions.nodes.head; |
1765 closeAndGotoExit(new HReturn(value, | 1768 closeAndGotoExit(new HReturn(value, |
1766 sourceInformationBuilder.buildReturn(sendSet.assignmentOperator))); | 1769 sourceInformationBuilder.buildReturn(sendSet.assignmentOperator))); |
1767 return closeFunction(); | 1770 return closeFunction(); |
1768 } | 1771 } |
1769 | 1772 |
1770 /** | 1773 /** |
1771 * Returns the constructor body associated with the given constructor or | 1774 * Returns the constructor body associated with the given constructor or |
(...skipping 6824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8596 const _LoopTypeVisitor(); | 8599 const _LoopTypeVisitor(); |
8597 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; | 8600 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; |
8598 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; | 8601 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; |
8599 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; | 8602 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; |
8600 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; | 8603 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; |
8601 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; | 8604 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; |
8602 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; | 8605 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; |
8603 int visitSwitchStatement(ast.SwitchStatement node) => | 8606 int visitSwitchStatement(ast.SwitchStatement node) => |
8604 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; | 8607 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; |
8605 } | 8608 } |
OLD | NEW |