| 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 | 4 |
| 5 library dart2js.ir_builder; | 5 library dart2js.ir_builder; |
| 6 | 6 |
| 7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import '../constants/values.dart' show PrimitiveConstantValue; | 8 import '../constants/values.dart' show PrimitiveConstantValue; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../dart2jslib.dart'; | 10 import '../dart2jslib.dart'; |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 CallStructure callStructure, | 875 CallStructure callStructure, |
| 876 List<ir.Primitive> arguments) { | 876 List<ir.Primitive> arguments) { |
| 877 // TODO(johnniwinther): This shouldn't be necessary. | 877 // TODO(johnniwinther): This shouldn't be necessary. |
| 878 SelectorKind kind = Elements.isOperatorName(method.name) | 878 SelectorKind kind = Elements.isOperatorName(method.name) |
| 879 ? SelectorKind.OPERATOR : SelectorKind.CALL; | 879 ? SelectorKind.OPERATOR : SelectorKind.CALL; |
| 880 Selector selector = | 880 Selector selector = |
| 881 new Selector(kind, method.memberName, callStructure); | 881 new Selector(kind, method.memberName, callStructure); |
| 882 return _buildInvokeSuper(method, selector, arguments); | 882 return _buildInvokeSuper(method, selector, arguments); |
| 883 } | 883 } |
| 884 | 884 |
| 885 /// Create a call invocation on the value of [field] on the super class where | |
| 886 /// the call structure is defined [callStructure] and the argument values are | |
| 887 /// defined by [arguments]. | |
| 888 ir.Primitive buildSuperFieldInvocation(FieldElement field, | |
| 889 CallStructure callStructure, | |
| 890 List<ir.Primitive> arguments) { | |
| 891 // TODO(johnniwinther): Maybe this should have its own ir node. | |
| 892 return buildCallInvocation( | |
| 893 buildSuperFieldGet(field), | |
| 894 callStructure, | |
| 895 arguments); | |
| 896 } | |
| 897 | |
| 898 /// Create a call invocation on the value returned from the [getter] on the | |
| 899 /// super class where the call structure is defined [selector] and the | |
| 900 /// argument values are defined by [arguments]. | |
| 901 ir.Primitive buildSuperGetterInvocation(MethodElement getter, | |
| 902 CallStructure callStructure, | |
| 903 List<ir.Primitive> arguments) { | |
| 904 // TODO(johnniwinther): Maybe this should have its own ir node. | |
| 905 return buildCallInvocation( | |
| 906 buildSuperGetterGet(getter), | |
| 907 callStructure, | |
| 908 arguments); | |
| 909 } | |
| 910 | |
| 911 /// Create a read access of the [field] on the super class. | 885 /// Create a read access of the [field] on the super class. |
| 912 ir.Primitive buildSuperFieldGet(FieldElement field) { | 886 ir.Primitive buildSuperFieldGet(FieldElement field) { |
| 913 // TODO(johnniwinther): This should have its own ir node. | 887 // TODO(johnniwinther): This should have its own ir node. |
| 914 return _buildInvokeSuper( | 888 return _buildInvokeSuper( |
| 915 field, | 889 field, |
| 916 new Selector.getter(field.name, field.library), | 890 new Selector.getter(field.name, field.library), |
| 917 const <ir.Primitive>[]); | 891 const <ir.Primitive>[]); |
| 918 } | 892 } |
| 919 | 893 |
| 920 /// Create a read access of the [method] on the super class, i.e. a | 894 /// Create a read access of the [method] on the super class, i.e. a |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 MethodElement function, | 1034 MethodElement function, |
| 1061 CallStructure callStructure, | 1035 CallStructure callStructure, |
| 1062 List<ir.Primitive> arguments, | 1036 List<ir.Primitive> arguments, |
| 1063 {SourceInformation sourceInformation}) { | 1037 {SourceInformation sourceInformation}) { |
| 1064 Selector selector = | 1038 Selector selector = |
| 1065 new Selector(SelectorKind.CALL, function.memberName, callStructure); | 1039 new Selector(SelectorKind.CALL, function.memberName, callStructure); |
| 1066 return _buildInvokeStatic( | 1040 return _buildInvokeStatic( |
| 1067 function, selector, arguments, sourceInformation); | 1041 function, selector, arguments, sourceInformation); |
| 1068 } | 1042 } |
| 1069 | 1043 |
| 1070 /// Create a call invocation of the value of the static [field] where argument | |
| 1071 /// structure is defined by [callStructure] and the argument values are | |
| 1072 /// defined by [arguments]. | |
| 1073 ir.Primitive buildStaticFieldInvocation( | |
| 1074 FieldElement field, | |
| 1075 CallStructure callStructure, | |
| 1076 List<ir.Primitive> arguments, | |
| 1077 {SourceInformation sourceInformation}) { | |
| 1078 // TODO(johnniwinther): Maybe this should have its own node. | |
| 1079 return buildCallInvocation( | |
| 1080 buildStaticFieldGet(field), | |
| 1081 callStructure, | |
| 1082 arguments, | |
| 1083 sourceInformation: sourceInformation); | |
| 1084 } | |
| 1085 | |
| 1086 /// Create a call invocation of the result of calling the static [getter] | |
| 1087 /// where argument structure is defined by [callStructure] and the argument | |
| 1088 /// values are defined by [arguments]. | |
| 1089 ir.Primitive buildStaticGetterInvocation( | |
| 1090 MethodElement getter, | |
| 1091 CallStructure callStructure, | |
| 1092 List<ir.Primitive> arguments, | |
| 1093 {SourceInformation sourceInformation}) { | |
| 1094 // TODO(johnniwinther): Maybe this should have its own node. | |
| 1095 return buildCallInvocation( | |
| 1096 buildStaticGetterGet(getter), | |
| 1097 callStructure, | |
| 1098 arguments, | |
| 1099 sourceInformation: sourceInformation); | |
| 1100 } | |
| 1101 | |
| 1102 /// Create a read access of the static [field]. | 1044 /// Create a read access of the static [field]. |
| 1103 ir.Primitive buildStaticFieldGet(FieldElement field, | 1045 ir.Primitive buildStaticFieldGet(FieldElement field, |
| 1104 {SourceInformation sourceInformation}) { | 1046 {SourceInformation sourceInformation}) { |
| 1105 Selector selector = new Selector.getter(field.name, field.library); | 1047 Selector selector = new Selector.getter(field.name, field.library); |
| 1106 // TODO(karlklose,sigurdm): build different nodes for getters. | 1048 // TODO(karlklose,sigurdm): build different nodes for getters. |
| 1107 return _buildInvokeStatic( | 1049 return _buildInvokeStatic( |
| 1108 field, selector, const <ir.Primitive>[], sourceInformation); | 1050 field, selector, const <ir.Primitive>[], sourceInformation); |
| 1109 } | 1051 } |
| 1110 | 1052 |
| 1111 /// Create a getter invocation of the static [getter]. | 1053 /// Create a getter invocation of the static [getter]. |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2698 } | 2640 } |
| 2699 | 2641 |
| 2700 /// Synthetic parameter to a JavaScript factory method that takes the type | 2642 /// Synthetic parameter to a JavaScript factory method that takes the type |
| 2701 /// argument given for the type variable [variable]. | 2643 /// argument given for the type variable [variable]. |
| 2702 class TypeInformationParameter implements Local { | 2644 class TypeInformationParameter implements Local { |
| 2703 final TypeVariableElement variable; | 2645 final TypeVariableElement variable; |
| 2704 final ExecutableElement executableContext; | 2646 final ExecutableElement executableContext; |
| 2705 TypeInformationParameter(this.variable, this.executableContext); | 2647 TypeInformationParameter(this.variable, this.executableContext); |
| 2706 String get name => variable.name; | 2648 String get name => variable.name; |
| 2707 } | 2649 } |
| OLD | NEW |