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_task; | 5 library dart2js.ir_builder_task; |
6 | 6 |
7 import '../closure.dart' as closurelib; | 7 import '../closure.dart' as closurelib; |
8 import '../closure.dart' hide ClosureScope; | 8 import '../closure.dart' hide ClosureScope; |
9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 | 788 |
789 @override | 789 @override |
790 ir.Primitive visitSuperMethodGet( | 790 ir.Primitive visitSuperMethodGet( |
791 ast.Send node, | 791 ast.Send node, |
792 MethodElement method, | 792 MethodElement method, |
793 _) { | 793 _) { |
794 return irBuilder.buildSuperMethodGet(method); | 794 return irBuilder.buildSuperMethodGet(method); |
795 } | 795 } |
796 | 796 |
797 @override | 797 @override |
| 798 ir.Primitive visitUnresolvedSuperGet( |
| 799 ast.Send node, |
| 800 Element element, |
| 801 _) { |
| 802 return giveup(node, 'visitUnresolvedSuperGet'); |
| 803 } |
| 804 |
| 805 @override |
798 ir.Primitive visitThisGet(ast.Identifier node, _) { | 806 ir.Primitive visitThisGet(ast.Identifier node, _) { |
799 return irBuilder.buildThis(); | 807 return irBuilder.buildThis(); |
800 } | 808 } |
801 | 809 |
802 ir.Primitive translateTypeVariableTypeLiteral(TypeVariableElement element) { | 810 ir.Primitive translateTypeVariableTypeLiteral(TypeVariableElement element) { |
803 return buildReifyTypeVariable(irBuilder.buildThis(), element.type); | 811 return buildReifyTypeVariable(irBuilder.buildThis(), element.type); |
804 } | 812 } |
805 | 813 |
806 @override | 814 @override |
807 ir.Primitive visitTypeVariableTypeLiteralGet(ast.Send node, | 815 ir.Primitive visitTypeVariableTypeLiteralGet(ast.Send node, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 ir.Primitive visitSuperBinary( | 918 ir.Primitive visitSuperBinary( |
911 ast.Send node, | 919 ast.Send node, |
912 FunctionElement function, | 920 FunctionElement function, |
913 op.BinaryOperator operator, | 921 op.BinaryOperator operator, |
914 ast.Node argument, | 922 ast.Node argument, |
915 _) { | 923 _) { |
916 return translateSuperBinary(function, operator, argument); | 924 return translateSuperBinary(function, operator, argument); |
917 } | 925 } |
918 | 926 |
919 @override | 927 @override |
| 928 ir.Primitive visitUnresolvedSuperBinary( |
| 929 ast.Send node, |
| 930 Element element, |
| 931 op.BinaryOperator operator, |
| 932 ast.Node argument, |
| 933 _) { |
| 934 return giveup(node, 'visitUnresolvedSuperBinary'); |
| 935 } |
| 936 |
| 937 @override |
920 ir.Primitive visitSuperIndex( | 938 ir.Primitive visitSuperIndex( |
921 ast.Send node, | 939 ast.Send node, |
922 FunctionElement function, | 940 FunctionElement function, |
923 ast.Node index, | 941 ast.Node index, |
924 _) { | 942 _) { |
925 return irBuilder.buildSuperIndex(function, visit(index)); | 943 return irBuilder.buildSuperIndex(function, visit(index)); |
926 } | 944 } |
927 | 945 |
928 @override | 946 @override |
| 947 ir.Primitive visitUnresolvedSuperIndex( |
| 948 ast.Send node, |
| 949 Element element, |
| 950 ast.Node index, |
| 951 _) { |
| 952 return giveup(node, 'visitUnresolvedSuperIndex'); |
| 953 } |
| 954 |
| 955 @override |
929 ir.Primitive visitEquals( | 956 ir.Primitive visitEquals( |
930 ast.Send node, | 957 ast.Send node, |
931 ast.Node left, | 958 ast.Node left, |
932 ast.Node right, | 959 ast.Node right, |
933 _) { | 960 _) { |
934 return translateBinary(left, op.BinaryOperator.EQ, right); | 961 return translateBinary(left, op.BinaryOperator.EQ, right); |
935 } | 962 } |
936 | 963 |
937 @override | 964 @override |
938 ir.Primitive visitSuperEquals( | 965 ir.Primitive visitSuperEquals( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 @override | 1013 @override |
987 ir.Primitive visitSuperUnary( | 1014 ir.Primitive visitSuperUnary( |
988 ast.Send node, | 1015 ast.Send node, |
989 op.UnaryOperator operator, | 1016 op.UnaryOperator operator, |
990 FunctionElement function, | 1017 FunctionElement function, |
991 _) { | 1018 _) { |
992 return irBuilder.buildSuperMethodInvocation( | 1019 return irBuilder.buildSuperMethodInvocation( |
993 function, CallStructure.NO_ARGS, const []); | 1020 function, CallStructure.NO_ARGS, const []); |
994 } | 1021 } |
995 | 1022 |
| 1023 @override |
| 1024 ir.Primitive visitUnresolvedSuperUnary( |
| 1025 ast.Send node, |
| 1026 op.UnaryOperator operator, |
| 1027 Element element, |
| 1028 _) { |
| 1029 return giveup(node, 'visitUnresolvedSuperUnary'); |
| 1030 } |
| 1031 |
996 // TODO(johnniwinther): Handle this in the [IrBuilder] to ensure the correct | 1032 // TODO(johnniwinther): Handle this in the [IrBuilder] to ensure the correct |
997 // semantic correlation between arguments and invocation. | 1033 // semantic correlation between arguments and invocation. |
998 List<ir.Primitive> translateDynamicArguments(ast.NodeList nodeList, | 1034 List<ir.Primitive> translateDynamicArguments(ast.NodeList nodeList, |
999 CallStructure callStructure) { | 1035 CallStructure callStructure) { |
1000 List<ir.Primitive> arguments = nodeList.nodes.mapToList(visit); | 1036 List<ir.Primitive> arguments = nodeList.nodes.mapToList(visit); |
1001 return normalizeDynamicArguments(callStructure, arguments); | 1037 return normalizeDynamicArguments(callStructure, arguments); |
1002 } | 1038 } |
1003 | 1039 |
1004 // TODO(johnniwinther): Handle this in the [IrBuilder] to ensure the correct | 1040 // TODO(johnniwinther): Handle this in the [IrBuilder] to ensure the correct |
1005 // semantic correlation between arguments and invocation. | 1041 // semantic correlation between arguments and invocation. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 ast.Send node, | 1174 ast.Send node, |
1139 MethodElement method, | 1175 MethodElement method, |
1140 ast.NodeList arguments, | 1176 ast.NodeList arguments, |
1141 CallStructure callStructure, | 1177 CallStructure callStructure, |
1142 _) { | 1178 _) { |
1143 return irBuilder.buildSuperMethodInvocation(method, callStructure, | 1179 return irBuilder.buildSuperMethodInvocation(method, callStructure, |
1144 translateDynamicArguments(arguments, callStructure)); | 1180 translateDynamicArguments(arguments, callStructure)); |
1145 } | 1181 } |
1146 | 1182 |
1147 @override | 1183 @override |
| 1184 ir.Primitive visitSuperMethodIncompatibleInvoke( |
| 1185 ast.Send node, |
| 1186 MethodElement method, |
| 1187 ast.NodeList arguments, |
| 1188 CallStructure callStructure, |
| 1189 _) { |
| 1190 return giveup(node, 'visitSuperMethodIncompatibleInvoke'); |
| 1191 } |
| 1192 |
| 1193 @override |
| 1194 ir.Primitive visitUnresolvedSuperInvoke( |
| 1195 ast.Send node, |
| 1196 MethodElement method, |
| 1197 ast.NodeList arguments, |
| 1198 Selector selector, |
| 1199 _) { |
| 1200 return giveup(node, 'visitUnresolvedSuperInvoke'); |
| 1201 } |
| 1202 |
| 1203 @override |
1148 ir.Primitive visitThisInvoke( | 1204 ir.Primitive visitThisInvoke( |
1149 ast.Send node, | 1205 ast.Send node, |
1150 ast.NodeList arguments, | 1206 ast.NodeList arguments, |
1151 CallStructure callStructure, | 1207 CallStructure callStructure, |
1152 _) { | 1208 _) { |
1153 return translateCallInvoke(irBuilder.buildThis(), arguments, callStructure); | 1209 return translateCallInvoke(irBuilder.buildThis(), arguments, callStructure); |
1154 } | 1210 } |
1155 | 1211 |
1156 @override | 1212 @override |
1157 ir.Primitive visitTypeVariableTypeLiteralInvoke( | 1213 ir.Primitive visitTypeVariableTypeLiteralInvoke( |
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2822 node.body = replacementFor(node.body); | 2878 node.body = replacementFor(node.body); |
2823 } | 2879 } |
2824 } | 2880 } |
2825 | 2881 |
2826 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 2882 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
2827 class RemovalVisitor extends ir.RecursiveVisitor { | 2883 class RemovalVisitor extends ir.RecursiveVisitor { |
2828 processReference(ir.Reference reference) { | 2884 processReference(ir.Reference reference) { |
2829 reference.unlink(); | 2885 reference.unlink(); |
2830 } | 2886 } |
2831 } | 2887 } |
OLD | NEW |