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 '../constants/values.dart' as values show ConstantValue; | 6 import '../constants/values.dart' as values show ConstantValue; |
7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
9 import '../io/source_information.dart' show SourceInformation; | 9 import '../io/source_information.dart' show SourceInformation; |
10 import '../types/types.dart' show TypeMask; | 10 import '../types/types.dart' show TypeMask; |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 // side effects. | 709 // side effects. |
710 bool objectIsNotNull = false; | 710 bool objectIsNotNull = false; |
711 | 711 |
712 GetField(Primitive object, this.field) | 712 GetField(Primitive object, this.field) |
713 : this.object = new Reference<Primitive>(object); | 713 : this.object = new Reference<Primitive>(object); |
714 | 714 |
715 accept(Visitor visitor) => visitor.visitGetField(this); | 715 accept(Visitor visitor) => visitor.visitGetField(this); |
716 | 716 |
717 bool get isSafeForElimination => objectIsNotNull; | 717 bool get isSafeForElimination => objectIsNotNull; |
718 bool get isSafeForReordering => false; | 718 bool get isSafeForReordering => false; |
| 719 |
| 720 toString() => 'GetField($field)'; |
719 } | 721 } |
720 | 722 |
721 /// Get the length of a string or native list. | 723 /// Get the length of a string or native list. |
722 class GetLength extends Primitive { | 724 class GetLength extends Primitive { |
723 final Reference<Primitive> object; | 725 final Reference<Primitive> object; |
724 | 726 |
725 /// True if the object is known not to be null. | 727 /// True if the object is known not to be null. |
726 bool objectIsNotNull = false; | 728 bool objectIsNotNull = false; |
727 | 729 |
728 GetLength(Primitive object) : this.object = new Reference<Primitive>(object); | 730 GetLength(Primitive object) : this.object = new Reference<Primitive>(object); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 CreateInstance(this.classElement, List<Primitive> arguments, | 860 CreateInstance(this.classElement, List<Primitive> arguments, |
859 List<Primitive> typeInformation, | 861 List<Primitive> typeInformation, |
860 this.sourceInformation) | 862 this.sourceInformation) |
861 : this.arguments = _referenceList(arguments), | 863 : this.arguments = _referenceList(arguments), |
862 this.typeInformation = _referenceList(typeInformation); | 864 this.typeInformation = _referenceList(typeInformation); |
863 | 865 |
864 accept(Visitor visitor) => visitor.visitCreateInstance(this); | 866 accept(Visitor visitor) => visitor.visitCreateInstance(this); |
865 | 867 |
866 bool get isSafeForElimination => true; | 868 bool get isSafeForElimination => true; |
867 bool get isSafeForReordering => true; | 869 bool get isSafeForReordering => true; |
| 870 |
| 871 toString() => 'CreateInstance($classElement)'; |
868 } | 872 } |
869 | 873 |
870 class Interceptor extends Primitive { | 874 class Interceptor extends Primitive { |
871 final Reference<Primitive> input; | 875 final Reference<Primitive> input; |
872 final Set<ClassElement> interceptedClasses = new Set<ClassElement>(); | 876 final Set<ClassElement> interceptedClasses = new Set<ClassElement>(); |
873 final SourceInformation sourceInformation; | 877 final SourceInformation sourceInformation; |
874 | 878 |
875 Interceptor(Primitive input, this.sourceInformation) | 879 Interceptor(Primitive input, this.sourceInformation) |
876 : this.input = new Reference<Primitive>(input); | 880 : this.input = new Reference<Primitive>(input); |
877 | 881 |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 1633 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
1630 class RemovalVisitor extends RecursiveVisitor { | 1634 class RemovalVisitor extends RecursiveVisitor { |
1631 processReference(Reference reference) { | 1635 processReference(Reference reference) { |
1632 reference.unlink(); | 1636 reference.unlink(); |
1633 } | 1637 } |
1634 | 1638 |
1635 static void remove(Node node) { | 1639 static void remove(Node node) { |
1636 (new RemovalVisitor()).visit(node); | 1640 (new RemovalVisitor()).visit(node); |
1637 } | 1641 } |
1638 } | 1642 } |
OLD | NEW |