OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 tree_ir_nodes; | 5 library tree_ir_nodes; |
6 | 6 |
7 import '../constants/values.dart' as values; | 7 import '../constants/values.dart' as values; |
8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../io/source_information.dart' show SourceInformation; | 10 import '../io/source_information.dart' show SourceInformation; |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 accept1(ExpressionVisitor1 visitor, arg) { | 858 accept1(ExpressionVisitor1 visitor, arg) { |
859 return visitor.visitInterceptor(this, arg); | 859 return visitor.visitInterceptor(this, arg); |
860 } | 860 } |
861 } | 861 } |
862 | 862 |
863 class ForeignCode extends Node { | 863 class ForeignCode extends Node { |
864 final js.Template codeTemplate; | 864 final js.Template codeTemplate; |
865 final types.TypeMask type; | 865 final types.TypeMask type; |
866 final List<Expression> arguments; | 866 final List<Expression> arguments; |
867 final native.NativeBehavior nativeBehavior; | 867 final native.NativeBehavior nativeBehavior; |
| 868 final List<bool> nullableArguments; // One 'bit' per argument. |
868 final Element dependency; | 869 final Element dependency; |
869 | 870 |
870 ForeignCode(this.codeTemplate, this.type, this.arguments, this.nativeBehavior, | 871 ForeignCode(this.codeTemplate, this.type, this.arguments, this.nativeBehavior, |
871 this.dependency); | 872 this.nullableArguments, this.dependency) { |
| 873 assert(arguments.length == nullableArguments.length); |
| 874 } |
872 } | 875 } |
873 | 876 |
874 class ForeignExpression extends ForeignCode implements Expression { | 877 class ForeignExpression extends ForeignCode implements Expression { |
875 ForeignExpression(js.Template codeTemplate, types.TypeMask type, | 878 ForeignExpression( |
| 879 js.Template codeTemplate, types.TypeMask type, |
876 List<Expression> arguments, native.NativeBehavior nativeBehavior, | 880 List<Expression> arguments, native.NativeBehavior nativeBehavior, |
| 881 List<bool> nullableArguments, |
877 Element dependency) | 882 Element dependency) |
878 : super(codeTemplate, type, arguments, nativeBehavior, | 883 : super(codeTemplate, type, arguments, nativeBehavior, nullableArguments, |
879 dependency); | 884 dependency); |
880 | 885 |
881 accept(ExpressionVisitor visitor) { | 886 accept(ExpressionVisitor visitor) { |
882 return visitor.visitForeignExpression(this); | 887 return visitor.visitForeignExpression(this); |
883 } | 888 } |
884 | 889 |
885 accept1(ExpressionVisitor1 visitor, arg) { | 890 accept1(ExpressionVisitor1 visitor, arg) { |
886 return visitor.visitForeignExpression(this, arg); | 891 return visitor.visitForeignExpression(this, arg); |
887 } | 892 } |
888 } | 893 } |
889 | 894 |
890 class ForeignStatement extends ForeignCode implements Statement { | 895 class ForeignStatement extends ForeignCode implements Statement { |
891 ForeignStatement(js.Template codeTemplate, types.TypeMask type, | 896 ForeignStatement( |
| 897 js.Template codeTemplate, types.TypeMask type, |
892 List<Expression> arguments, native.NativeBehavior nativeBehavior, | 898 List<Expression> arguments, native.NativeBehavior nativeBehavior, |
| 899 List<bool> nullableArguments, |
893 Element dependency) | 900 Element dependency) |
894 : super(codeTemplate, type, arguments, nativeBehavior, | 901 : super(codeTemplate, type, arguments, nativeBehavior, nullableArguments, |
895 dependency); | 902 dependency); |
896 | 903 |
897 accept(StatementVisitor visitor) { | 904 accept(StatementVisitor visitor) { |
898 return visitor.visitForeignStatement(this); | 905 return visitor.visitForeignStatement(this); |
899 } | 906 } |
900 | 907 |
901 accept1(StatementVisitor1 visitor, arg) { | 908 accept1(StatementVisitor1 visitor, arg) { |
902 return visitor.visitForeignStatement(this, arg); | 909 return visitor.visitForeignStatement(this, arg); |
903 } | 910 } |
904 | 911 |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 | 1607 |
1601 /// Number of uses of the current fallthrough target. | 1608 /// Number of uses of the current fallthrough target. |
1602 int get useCount => _stack.last.useCount; | 1609 int get useCount => _stack.last.useCount; |
1603 | 1610 |
1604 /// Indicate that a statement will fall through to the current fallthrough | 1611 /// Indicate that a statement will fall through to the current fallthrough |
1605 /// target. | 1612 /// target. |
1606 void use() { | 1613 void use() { |
1607 ++_stack.last.useCount; | 1614 ++_stack.last.useCount; |
1608 } | 1615 } |
1609 } | 1616 } |
OLD | NEW |