| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_nodes; | 4 library dart2js.ir_nodes; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'cps_fragment.dart' show CpsFragment; | 7 import 'cps_fragment.dart' show CpsFragment; |
| 8 import '../constants/values.dart' as values; | 8 import '../constants/values.dart' as values; |
| 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 List<Definition> getList(List<Reference> list) => list.map(getCopy).toList(); | 2456 List<Definition> getList(List<Reference> list) => list.map(getCopy).toList(); |
| 2457 | 2457 |
| 2458 /// Copy a non-[Continuation] [Definition]. | 2458 /// Copy a non-[Continuation] [Definition]. |
| 2459 Definition copy(Definition node) { | 2459 Definition copy(Definition node) { |
| 2460 assert (node is! Continuation); | 2460 assert (node is! Continuation); |
| 2461 return putCopy(node, visit(node)); | 2461 return putCopy(node, visit(node)); |
| 2462 } | 2462 } |
| 2463 | 2463 |
| 2464 Definition visit(Node node) => node.accept(this); | 2464 Definition visit(Node node) => node.accept(this); |
| 2465 | 2465 |
| 2466 Definition visitFunctionDefinition(FunctionDefinition node) {} | 2466 visitFunctionDefinition(FunctionDefinition node) {} |
| 2467 Definition visitLetPrim(LetPrim node) {} | 2467 visitLetPrim(LetPrim node) {} |
| 2468 Definition visitLetCont(LetCont node) {} | 2468 visitLetCont(LetCont node) {} |
| 2469 Definition visitLetHandler(LetHandler node) {} | 2469 visitLetHandler(LetHandler node) {} |
| 2470 Definition visitLetMutable(LetMutable node) {} | 2470 visitLetMutable(LetMutable node) {} |
| 2471 Definition visitInvokeContinuation(InvokeContinuation node) {} | 2471 visitInvokeContinuation(InvokeContinuation node) {} |
| 2472 Definition visitThrow(Throw node) {} | 2472 visitThrow(Throw node) {} |
| 2473 Definition visitRethrow(Rethrow node) {} | 2473 visitRethrow(Rethrow node) {} |
| 2474 Definition visitBranch(Branch node) {} | 2474 visitBranch(Branch node) {} |
| 2475 Definition visitUnreachable(Unreachable node) {} | 2475 visitUnreachable(Unreachable node) {} |
| 2476 Definition visitContinuation(Continuation node) {} | 2476 visitContinuation(Continuation node) {} |
| 2477 | 2477 |
| 2478 Definition visitInvokeStatic(InvokeStatic node) { | 2478 Definition visitInvokeStatic(InvokeStatic node) { |
| 2479 return new InvokeStatic(node.target, node.selector, getList(node.arguments), | 2479 return new InvokeStatic(node.target, node.selector, getList(node.arguments), |
| 2480 node.sourceInformation); | 2480 node.sourceInformation); |
| 2481 } | 2481 } |
| 2482 | 2482 |
| 2483 Definition visitInvokeMethod(InvokeMethod node) { | 2483 Definition visitInvokeMethod(InvokeMethod node) { |
| 2484 return new InvokeMethod(getCopy(node.receiver), node.selector, node.mask, | 2484 return new InvokeMethod(getCopy(node.receiver), node.selector, node.mask, |
| 2485 getList(node.arguments), | 2485 getList(node.arguments), |
| 2486 node.sourceInformation); | 2486 node.sourceInformation); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 // Tail expressions do not have references, so we do not need to map them | 2769 // Tail expressions do not have references, so we do not need to map them |
| 2770 // to their copies. | 2770 // to their copies. |
| 2771 visitInvokeContinuation(InvokeContinuation node) { | 2771 visitInvokeContinuation(InvokeContinuation node) { |
| 2772 plug(new InvokeContinuation(_copies[node.continuation.definition], | 2772 plug(new InvokeContinuation(_copies[node.continuation.definition], |
| 2773 _definitions.getList(node.arguments), | 2773 _definitions.getList(node.arguments), |
| 2774 isRecursive: node.isRecursive, | 2774 isRecursive: node.isRecursive, |
| 2775 isEscapingTry: node.isEscapingTry, | 2775 isEscapingTry: node.isEscapingTry, |
| 2776 sourceInformation: node.sourceInformation)); | 2776 sourceInformation: node.sourceInformation)); |
| 2777 } | 2777 } |
| 2778 | 2778 |
| 2779 Node visitThrow(Throw node) { | 2779 visitThrow(Throw node) { |
| 2780 plug(new Throw(_definitions.getCopy(node.value))); | 2780 plug(new Throw(_definitions.getCopy(node.value))); |
| 2781 } | 2781 } |
| 2782 | 2782 |
| 2783 Node visitRethrow(Rethrow node) { | 2783 visitRethrow(Rethrow node) { |
| 2784 plug(new Rethrow()); | 2784 plug(new Rethrow()); |
| 2785 } | 2785 } |
| 2786 | 2786 |
| 2787 Node visitBranch(Branch node) { | 2787 visitBranch(Branch node) { |
| 2788 plug(new Branch.loose(_definitions.getCopy(node.condition), | 2788 plug(new Branch.loose(_definitions.getCopy(node.condition), |
| 2789 _copies[node.trueContinuation.definition], | 2789 _copies[node.trueContinuation.definition], |
| 2790 _copies[node.falseContinuation.definition]) | 2790 _copies[node.falseContinuation.definition]) |
| 2791 ..isStrictCheck = node.isStrictCheck); | 2791 ..isStrictCheck = node.isStrictCheck); |
| 2792 } | 2792 } |
| 2793 | 2793 |
| 2794 Node visitUnreachable(Unreachable node) { | 2794 visitUnreachable(Unreachable node) { |
| 2795 plug(new Unreachable()); | 2795 plug(new Unreachable()); |
| 2796 } | 2796 } |
| 2797 } | 2797 } |
| OLD | NEW |