| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.semantics_visitor; | 5 library dart2js.semantics_visitor; |
| 6 | 6 |
| 7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import '../dart2jslib.dart' show invariant; |
| 8 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 9 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| 10 import '../tree/tree.dart'; | 11 import '../tree/tree.dart'; |
| 11 import '../universe/universe.dart'; | 12 import '../universe/universe.dart'; |
| 12 import '../util/util.dart' show Spannable, SpannableAssertionFailure; | 13 import '../util/util.dart' show Spannable, SpannableAssertionFailure; |
| 13 import 'access_semantics.dart'; | 14 import 'access_semantics.dart'; |
| 14 import 'operators.dart'; | 15 import 'operators.dart'; |
| 15 import 'resolution.dart'; | 16 import 'resolution.dart'; |
| 16 import 'send_structure.dart'; | 17 import 'send_structure.dart'; |
| 17 | 18 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return structure.dispatch(sendVisitor, node, arg); | 51 return structure.dispatch(sendVisitor, node, arg); |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 @override | 55 @override |
| 55 R visitSendSet(SendSet node) { | 56 R visitSendSet(SendSet node) { |
| 56 return visitSend(node); | 57 return visitSend(node); |
| 57 } | 58 } |
| 58 } | 59 } |
| 59 | 60 |
| 61 // TODO(johnniwinther): Add visits for [visitLocalConstantGet], |
| 62 // [visitLocalConstantInvoke], [visitStaticConstantGet], etc. |
| 60 abstract class SemanticSendVisitor<R, A> { | 63 abstract class SemanticSendVisitor<R, A> { |
| 61 R apply(Node node, A arg); | 64 R apply(Node node, A arg); |
| 62 | 65 |
| 63 /// Read of the [parameter]. | 66 /// Read of the [parameter]. |
| 64 /// | 67 /// |
| 65 /// For instance: | 68 /// For instance: |
| 66 /// m(parameter) => parameter; | 69 /// m(parameter) => parameter; |
| 67 /// | 70 /// |
| 68 R visitParameterGet( | 71 R visitParameterGet( |
| 69 Send node, | 72 Send node, |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 /// | 1098 /// |
| 1096 /// For instance: | 1099 /// For instance: |
| 1097 /// lookup(a, b) => a[b]; | 1100 /// lookup(a, b) => a[b]; |
| 1098 /// | 1101 /// |
| 1099 R visitIndex( | 1102 R visitIndex( |
| 1100 Send node, | 1103 Send node, |
| 1101 Node receiver, | 1104 Node receiver, |
| 1102 Node index, | 1105 Node index, |
| 1103 A arg); | 1106 A arg); |
| 1104 | 1107 |
| 1108 /// Prefix operation on an index expression `operator receiver[index]` where |
| 1109 /// the operation is defined by [operator]. |
| 1110 /// |
| 1111 /// For instance: |
| 1112 /// lookup(a, b) => --a[b]; |
| 1113 /// |
| 1114 R visitIndexPrefix( |
| 1115 Send node, |
| 1116 Node receiver, |
| 1117 Node index, |
| 1118 IncDecOperator operator, |
| 1119 A arg); |
| 1120 |
| 1121 /// Postfix operation on an index expression `receiver[index] operator` where |
| 1122 /// the operation is defined by [operator]. |
| 1123 /// |
| 1124 /// For instance: |
| 1125 /// lookup(a, b) => a[b]++; |
| 1126 /// |
| 1127 R visitIndexPostfix( |
| 1128 Send node, |
| 1129 Node receiver, |
| 1130 Node index, |
| 1131 IncDecOperator operator, |
| 1132 A arg); |
| 1133 |
| 1105 /// Index expression `super[index]` where 'operator []' is implemented on a | 1134 /// Index expression `super[index]` where 'operator []' is implemented on a |
| 1106 /// superclass by [function]. | 1135 /// superclass by [function]. |
| 1107 /// | 1136 /// |
| 1108 /// For instance: | 1137 /// For instance: |
| 1109 /// class B { | 1138 /// class B { |
| 1110 /// operator [](_) => null; | 1139 /// operator [](_) => null; |
| 1111 /// } | 1140 /// } |
| 1112 /// class C extends B { | 1141 /// class C extends B { |
| 1113 /// m(a) => super[a]; | 1142 /// m(a) => super[a]; |
| 1114 /// } | 1143 /// } |
| 1115 /// | 1144 /// |
| 1116 R visitSuperIndex( | 1145 R visitSuperIndex( |
| 1117 Send node, | 1146 Send node, |
| 1118 FunctionElement function, | 1147 FunctionElement function, |
| 1119 Node index, | 1148 Node index, |
| 1120 A arg); | 1149 A arg); |
| 1121 | 1150 |
| 1151 /// Prefix operation on an index expression `operator super[index]` where |
| 1152 /// 'operator []' is implemented on a superclass by [indexFunction] and |
| 1153 /// 'operator []=' is implemented on by [indexSetFunction] and the operation |
| 1154 /// is defined by [operator]. |
| 1155 /// |
| 1156 /// For instance: |
| 1157 /// class B { |
| 1158 /// operator [](_) => null; |
| 1159 /// operator []=(a, b) {} |
| 1160 /// } |
| 1161 /// class C extends B { |
| 1162 /// m(a) => --super[a]; |
| 1163 /// } |
| 1164 /// |
| 1165 R visitSuperIndexPrefix( |
| 1166 Send node, |
| 1167 FunctionElement indexFunction, |
| 1168 FunctionElement indexSetFunction, |
| 1169 Node index, |
| 1170 IncDecOperator operator, |
| 1171 A arg); |
| 1172 |
| 1173 /// Postfix operation on an index expression `super[index] operator` where |
| 1174 /// 'operator []' is implemented on a superclass by [indexFunction] and |
| 1175 /// 'operator []=' is implemented on by [indexSetFunction] and the operation |
| 1176 /// is defined by [operator]. |
| 1177 /// |
| 1178 /// For instance: |
| 1179 /// class B { |
| 1180 /// operator [](_) => null; |
| 1181 /// operator []=(a, b) {} |
| 1182 /// } |
| 1183 /// class C extends B { |
| 1184 /// m(a) => super[a]++; |
| 1185 /// } |
| 1186 /// |
| 1187 R visitSuperIndexPostfix( |
| 1188 Send node, |
| 1189 FunctionElement indexFunction, |
| 1190 FunctionElement indexSetFunction, |
| 1191 Node index, |
| 1192 IncDecOperator operator, |
| 1193 A arg); |
| 1194 |
| 1195 /// Index expression `super[index]` where 'operator []' is unresolved. |
| 1196 /// |
| 1197 /// For instance: |
| 1198 /// class B {} |
| 1199 /// class C extends B { |
| 1200 /// m(a) => super[a]; |
| 1201 /// } |
| 1202 /// |
| 1203 R errorUnresolvedSuperIndex( |
| 1204 Send node, |
| 1205 Element element, |
| 1206 Node index, |
| 1207 A arg); |
| 1208 |
| 1209 /// Prefix operation on an index expression `operator super[index]` where |
| 1210 /// 'operator []' or 'operator []=' is unresolved and the operation |
| 1211 /// is defined by [operator]. |
| 1212 /// |
| 1213 /// For instance: |
| 1214 /// class B {} |
| 1215 /// class C extends B { |
| 1216 /// m(a) => --super[a]; |
| 1217 /// } |
| 1218 /// |
| 1219 R errorUnresolvedSuperIndexPrefix( |
| 1220 Send node, |
| 1221 Element function, |
| 1222 Node index, |
| 1223 IncDecOperator operator, |
| 1224 A arg); |
| 1225 |
| 1226 /// Postfix operation on an index expression `super[index] operator` where |
| 1227 /// 'operator []' or 'operator []=' is unresolved and the operation |
| 1228 /// is defined by [operator]. |
| 1229 /// |
| 1230 /// For instance: |
| 1231 /// class B {} |
| 1232 /// class C extends B { |
| 1233 /// m(a) => super[a]++; |
| 1234 /// } |
| 1235 /// |
| 1236 R errorUnresolvedSuperIndexPostfix( |
| 1237 Send node, |
| 1238 Element function, |
| 1239 Node index, |
| 1240 IncDecOperator operator, |
| 1241 A arg); |
| 1242 |
| 1122 /// Binary expression `left == right`. | 1243 /// Binary expression `left == right`. |
| 1123 /// | 1244 /// |
| 1124 /// For instance: | 1245 /// For instance: |
| 1125 /// neq(a, b) => a != b; | 1246 /// neq(a, b) => a != b; |
| 1126 /// | 1247 /// |
| 1127 R visitNotEquals( | 1248 R visitNotEquals( |
| 1128 Send node, | 1249 Send node, |
| 1129 Node left, | 1250 Node left, |
| 1130 Node right, | 1251 Node right, |
| 1131 A arg); | 1252 A arg); |
| (...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2638 | 2759 |
| 2639 /// Invocation of an undefined unary [operator] with operands | 2760 /// Invocation of an undefined unary [operator] with operands |
| 2640 /// [left] and [right]. | 2761 /// [left] and [right]. |
| 2641 R errorUndefinedBinaryExpression( | 2762 R errorUndefinedBinaryExpression( |
| 2642 Send node, | 2763 Send node, |
| 2643 Node left, | 2764 Node left, |
| 2644 Operator operator, | 2765 Operator operator, |
| 2645 Node right, | 2766 Node right, |
| 2646 A arg); | 2767 A arg); |
| 2647 } | 2768 } |
| OLD | NEW |