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_test; | 5 library dart2js.semantics_visitor_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:mirrors'; | 8 import 'dart:mirrors'; |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 ''' | 1227 ''' |
1228 class B { | 1228 class B { |
1229 get o => null; | 1229 get o => null; |
1230 } | 1230 } |
1231 class C extends B { | 1231 class C extends B { |
1232 m() => super.o; | 1232 m() => super.o; |
1233 } | 1233 } |
1234 ''', | 1234 ''', |
1235 const Visit(VisitKind.VISIT_SUPER_GETTER_GET, | 1235 const Visit(VisitKind.VISIT_SUPER_GETTER_GET, |
1236 element: 'getter(B#o)')), | 1236 element: 'getter(B#o)')), |
1237 // TODO(johnniwinther): Expect [VISIT_SUPER_SETTER_GET] instead. | |
1238 const Test.clazz( | 1237 const Test.clazz( |
1239 ''' | 1238 ''' |
1240 class B { | 1239 class B { |
1241 set o(_) {} | 1240 set o(_) {} |
1242 } | 1241 } |
1243 class C extends B { | 1242 class C extends B { |
1244 m() => super.o; | 1243 m() => super.o; |
1245 } | 1244 } |
1246 ''', | 1245 ''', |
1247 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GET)), | 1246 const Visit(VisitKind.VISIT_SUPER_SETTER_GET, |
| 1247 element: 'setter(B#o)')), |
1248 // TODO(johnniwinther): Expect [VISIT_SUPER_GETTER_SET] instead. | 1248 // TODO(johnniwinther): Expect [VISIT_SUPER_GETTER_SET] instead. |
1249 const Test.clazz( | 1249 const Test.clazz( |
1250 ''' | 1250 ''' |
1251 class B { | 1251 class B { |
1252 get o => 0; | 1252 get o => 0; |
1253 } | 1253 } |
1254 class C extends B { | 1254 class C extends B { |
1255 m() { super.o = 42; } | 1255 m() { super.o = 42; } |
1256 } | 1256 } |
1257 ''', | 1257 ''', |
(...skipping 17 matching lines...) Expand all Loading... |
1275 class B { | 1275 class B { |
1276 get o => null; | 1276 get o => null; |
1277 } | 1277 } |
1278 class C extends B { | 1278 class C extends B { |
1279 m() { super.o(null, 42); } | 1279 m() { super.o(null, 42); } |
1280 } | 1280 } |
1281 ''', | 1281 ''', |
1282 const Visit(VisitKind.VISIT_SUPER_GETTER_INVOKE, | 1282 const Visit(VisitKind.VISIT_SUPER_GETTER_INVOKE, |
1283 element: 'getter(B#o)', | 1283 element: 'getter(B#o)', |
1284 arguments: '(null,42)')), | 1284 arguments: '(null,42)')), |
1285 // TODO(johnniwinther): Expect [VISIT_SUPER_SETTER_INVOKE] instead. | |
1286 const Test.clazz( | 1285 const Test.clazz( |
1287 ''' | 1286 ''' |
1288 class B { | 1287 class B { |
1289 set o(_) {} | 1288 set o(_) {} |
1290 } | 1289 } |
1291 class C extends B { | 1290 class C extends B { |
1292 m() { super.o(null, 42); } | 1291 m() { super.o(null, 42); } |
1293 } | 1292 } |
1294 ''', | 1293 ''', |
1295 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INVOKE, | 1294 const Visit(VisitKind.VISIT_SUPER_SETTER_INVOKE, |
| 1295 element: 'setter(B#o)', |
1296 arguments: '(null,42)')), | 1296 arguments: '(null,42)')), |
1297 ], | 1297 ], |
1298 'Super methods': const [ | 1298 'Super methods': const [ |
1299 // Super methods | 1299 // Super methods |
1300 const Test.clazz( | 1300 const Test.clazz( |
1301 ''' | 1301 ''' |
1302 class B { | 1302 class B { |
1303 o(a, b) {} | 1303 o(a, b) {} |
1304 } | 1304 } |
1305 class C extends B { | 1305 class C extends B { |
(...skipping 2974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4280 VisitKind.VISIT_STATIC_SETTER_INVOKE, | 4280 VisitKind.VISIT_STATIC_SETTER_INVOKE, |
4281 VisitKind.VISIT_FINAL_STATIC_FIELD_SET, | 4281 VisitKind.VISIT_FINAL_STATIC_FIELD_SET, |
4282 VisitKind.VISIT_STATIC_FUNCTION_SET, | 4282 VisitKind.VISIT_STATIC_FUNCTION_SET, |
4283 VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, | 4283 VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, |
4284 VisitKind.VISIT_TOP_LEVEL_GETTER_SET, | 4284 VisitKind.VISIT_TOP_LEVEL_GETTER_SET, |
4285 VisitKind.VISIT_TOP_LEVEL_SETTER_GET, | 4285 VisitKind.VISIT_TOP_LEVEL_SETTER_GET, |
4286 VisitKind.VISIT_TOP_LEVEL_SETTER_INVOKE, | 4286 VisitKind.VISIT_TOP_LEVEL_SETTER_INVOKE, |
4287 VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET, | 4287 VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET, |
4288 VisitKind.VISIT_FINAL_SUPER_FIELD_SET, | 4288 VisitKind.VISIT_FINAL_SUPER_FIELD_SET, |
4289 VisitKind.VISIT_SUPER_GETTER_SET, | 4289 VisitKind.VISIT_SUPER_GETTER_SET, |
4290 VisitKind.VISIT_SUPER_SETTER_GET, | |
4291 VisitKind.VISIT_SUPER_SETTER_INVOKE, | |
4292 VisitKind.VISIT_SUPER_METHOD_SET, | 4290 VisitKind.VISIT_SUPER_METHOD_SET, |
4293 ]; | 4291 ]; |
4294 | 4292 |
4295 main(List<String> arguments) { | 4293 main(List<String> arguments) { |
4296 Set<VisitKind> kinds = new Set<VisitKind>.from(VisitKind.values); | 4294 Set<VisitKind> kinds = new Set<VisitKind>.from(VisitKind.values); |
4297 asyncTest(() => Future.forEach([ | 4295 asyncTest(() => Future.forEach([ |
4298 () { | 4296 () { |
4299 return test( | 4297 return test( |
4300 kinds, | 4298 kinds, |
4301 arguments, | 4299 arguments, |
(...skipping 3766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8068 VISIT_REQUIRED_INITIALIZING_FORMAL_DECL, | 8066 VISIT_REQUIRED_INITIALIZING_FORMAL_DECL, |
8069 VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL, | 8067 VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL, |
8070 VISIT_NAMED_INITIALIZING_FORMAL_DECL, | 8068 VISIT_NAMED_INITIALIZING_FORMAL_DECL, |
8071 | 8069 |
8072 VISIT_UNRESOLVED_COMPOUND, | 8070 VISIT_UNRESOLVED_COMPOUND, |
8073 VISIT_UNRESOLVED_PREFIX, | 8071 VISIT_UNRESOLVED_PREFIX, |
8074 VISIT_UNRESOLVED_POSTFIX, | 8072 VISIT_UNRESOLVED_POSTFIX, |
8075 | 8073 |
8076 // TODO(johnniwinther): Add tests for more error cases. | 8074 // TODO(johnniwinther): Add tests for more error cases. |
8077 } | 8075 } |
OLD | NEW |