| 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 part of dart2js.semantics_visitor_test; | 5 part of dart2js.semantics_visitor_test; |
| 6 | 6 |
| 7 const Map<String, List<Test>> SEND_TESTS = const { | 7 const Map<String, List<Test>> SEND_TESTS = const { |
| 8 'Parameters': const [ | 8 'Parameters': const [ |
| 9 // Parameters | 9 // Parameters |
| 10 const Test('m(o) => o;', | 10 const Test('m(o) => o;', |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 element: 'field(o)', | 796 element: 'field(o)', |
| 797 rhs: '42')), | 797 rhs: '42')), |
| 798 const Test.prefix( | 798 const Test.prefix( |
| 799 ''' | 799 ''' |
| 800 var o; | 800 var o; |
| 801 ''', | 801 ''', |
| 802 'm() { p.o = 42; }', | 802 'm() { p.o = 42; }', |
| 803 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET, | 803 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET, |
| 804 element: 'field(o)', | 804 element: 'field(o)', |
| 805 rhs: '42')), | 805 rhs: '42')), |
| 806 const Test.prefix( |
| 807 ''' |
| 808 ''', |
| 809 'm() { p = 42; }', |
| 810 const Visit(VisitKind.ERROR_INVALID_SET, |
| 811 error: MessageKind.PREFIX_AS_EXPRESSION, |
| 812 rhs: '42')), |
| 806 const Test( | 813 const Test( |
| 807 ''' | 814 ''' |
| 808 final o = 0; | 815 final o = 0; |
| 809 m() { o = 42; } | 816 m() { o = 42; } |
| 810 ''', | 817 ''', |
| 811 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, | 818 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, |
| 812 element: 'field(o)', | 819 element: 'field(o)', |
| 813 rhs: '42')), | 820 rhs: '42')), |
| 814 const Test.prefix( | 821 const Test.prefix( |
| 815 ''' | 822 ''' |
| (...skipping 28 matching lines...) Expand all Loading... |
| 844 element: 'field(o)', | 851 element: 'field(o)', |
| 845 arguments: '(null,42)')), | 852 arguments: '(null,42)')), |
| 846 const Test.prefix( | 853 const Test.prefix( |
| 847 ''' | 854 ''' |
| 848 var o; | 855 var o; |
| 849 ''', | 856 ''', |
| 850 'm() { p.o(null, 42); }', | 857 'm() { p.o(null, 42); }', |
| 851 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE, | 858 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE, |
| 852 element: 'field(o)', | 859 element: 'field(o)', |
| 853 arguments: '(null,42)')), | 860 arguments: '(null,42)')), |
| 861 const Test.prefix( |
| 862 ''' |
| 863 ''', |
| 864 'm() { p(null, 42); }', |
| 865 const Visit(VisitKind.ERROR_INVALID_INVOKE, |
| 866 error: MessageKind.PREFIX_AS_EXPRESSION, |
| 867 arguments: '(null,42)')), |
| 854 const Test( | 868 const Test( |
| 855 ''' | 869 ''' |
| 856 m() => o; | 870 m() => o; |
| 857 ''', | 871 ''', |
| 858 const Visit(VisitKind.VISIT_UNRESOLVED_GET, | 872 const Visit(VisitKind.VISIT_UNRESOLVED_GET, |
| 859 name: 'o')), | 873 name: 'o')), |
| 860 const Test( | 874 const Test( |
| 861 ''' | 875 ''' |
| 862 m() { o = 42; } | 876 m() { o = 42; } |
| 863 ''', | 877 ''', |
| (...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 ''' | 2421 ''' |
| 2408 class C { | 2422 class C { |
| 2409 var o; | 2423 var o; |
| 2410 static m() { o += 42; } | 2424 static m() { o += 42; } |
| 2411 } | 2425 } |
| 2412 ''', | 2426 ''', |
| 2413 const Visit(VisitKind.ERROR_INVALID_COMPOUND, | 2427 const Visit(VisitKind.ERROR_INVALID_COMPOUND, |
| 2414 error: MessageKind.NO_INSTANCE_AVAILABLE, | 2428 error: MessageKind.NO_INSTANCE_AVAILABLE, |
| 2415 operator: '+=', | 2429 operator: '+=', |
| 2416 rhs: '42')), | 2430 rhs: '42')), |
| 2431 const Test.prefix( |
| 2432 ''' |
| 2433 ''', |
| 2434 ''' |
| 2435 m() { p += 42; } |
| 2436 ''', |
| 2437 const Visit(VisitKind.ERROR_INVALID_COMPOUND, |
| 2438 error: MessageKind.PREFIX_AS_EXPRESSION, |
| 2439 operator: '+=', |
| 2440 rhs: '42')), |
| 2417 const Test( | 2441 const Test( |
| 2418 ''' | 2442 ''' |
| 2419 class C { | 2443 class C { |
| 2420 static get a => 0; | 2444 static get a => 0; |
| 2421 static set a(_) {} | 2445 static set a(_) {} |
| 2422 } | 2446 } |
| 2423 m() => C.a += 42; | 2447 m() => C.a += 42; |
| 2424 ''', | 2448 ''', |
| 2425 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, | 2449 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, |
| 2426 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2450 getter: 'getter(C#a)', setter: 'setter(C#a)', |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2926 const Test.clazz( | 2950 const Test.clazz( |
| 2927 ''' | 2951 ''' |
| 2928 class C { | 2952 class C { |
| 2929 var o; | 2953 var o; |
| 2930 static m() { ++o; } | 2954 static m() { ++o; } |
| 2931 } | 2955 } |
| 2932 ''', | 2956 ''', |
| 2933 const Visit(VisitKind.ERROR_INVALID_PREFIX, | 2957 const Visit(VisitKind.ERROR_INVALID_PREFIX, |
| 2934 error: MessageKind.NO_INSTANCE_AVAILABLE, | 2958 error: MessageKind.NO_INSTANCE_AVAILABLE, |
| 2935 operator: '++')), | 2959 operator: '++')), |
| 2960 const Test.prefix( |
| 2961 ''' |
| 2962 ''', |
| 2963 ''' |
| 2964 m() { ++p; } |
| 2965 ''', |
| 2966 const Visit(VisitKind.ERROR_INVALID_PREFIX, |
| 2967 error: MessageKind.PREFIX_AS_EXPRESSION, |
| 2968 operator: '++')), |
| 2936 const Test( | 2969 const Test( |
| 2937 ''' | 2970 ''' |
| 2938 class C { | 2971 class C { |
| 2939 static get a => 0; | 2972 static get a => 0; |
| 2940 static set a(_) {} | 2973 static set a(_) {} |
| 2941 } | 2974 } |
| 2942 m() => ++C.a; | 2975 m() => ++C.a; |
| 2943 ''', | 2976 ''', |
| 2944 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, | 2977 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, |
| 2945 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2978 getter: 'getter(C#a)', setter: 'setter(C#a)', |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3311 const Test.clazz( | 3344 const Test.clazz( |
| 3312 ''' | 3345 ''' |
| 3313 class C { | 3346 class C { |
| 3314 var o; | 3347 var o; |
| 3315 static m() { o--; } | 3348 static m() { o--; } |
| 3316 } | 3349 } |
| 3317 ''', | 3350 ''', |
| 3318 const Visit(VisitKind.ERROR_INVALID_POSTFIX, | 3351 const Visit(VisitKind.ERROR_INVALID_POSTFIX, |
| 3319 error: MessageKind.NO_INSTANCE_AVAILABLE, | 3352 error: MessageKind.NO_INSTANCE_AVAILABLE, |
| 3320 operator: '--')), | 3353 operator: '--')), |
| 3354 const Test.prefix( |
| 3355 ''' |
| 3356 ''', |
| 3357 ''' |
| 3358 m() { p--; } |
| 3359 ''', |
| 3360 const Visit(VisitKind.ERROR_INVALID_POSTFIX, |
| 3361 error: MessageKind.PREFIX_AS_EXPRESSION, |
| 3362 operator: '--')), |
| 3321 const Test( | 3363 const Test( |
| 3322 ''' | 3364 ''' |
| 3323 class C { | 3365 class C { |
| 3324 static get a => 0; | 3366 static get a => 0; |
| 3325 static set a(_) {} | 3367 static set a(_) {} |
| 3326 } | 3368 } |
| 3327 m() => C.a++; | 3369 m() => C.a++; |
| 3328 ''', | 3370 ''', |
| 3329 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, | 3371 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, |
| 3330 getter: 'getter(C#a)', setter: 'setter(C#a)', | 3372 getter: 'getter(C#a)', setter: 'setter(C#a)', |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4115 const Test.clazz( | 4157 const Test.clazz( |
| 4116 ''' | 4158 ''' |
| 4117 class C { | 4159 class C { |
| 4118 var o; | 4160 var o; |
| 4119 static m() { o ??= 42; } | 4161 static m() { o ??= 42; } |
| 4120 } | 4162 } |
| 4121 ''', | 4163 ''', |
| 4122 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, | 4164 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, |
| 4123 error: MessageKind.NO_INSTANCE_AVAILABLE, | 4165 error: MessageKind.NO_INSTANCE_AVAILABLE, |
| 4124 rhs: '42')), | 4166 rhs: '42')), |
| 4167 const Test.prefix( |
| 4168 ''' |
| 4169 ''', |
| 4170 ''' |
| 4171 m() { p ??= 42; } |
| 4172 ''', |
| 4173 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, |
| 4174 error: MessageKind.PREFIX_AS_EXPRESSION, |
| 4175 rhs: '42')), |
| 4125 const Test( | 4176 const Test( |
| 4126 ''' | 4177 ''' |
| 4127 class C { | 4178 class C { |
| 4128 static get a => 0; | 4179 static get a => 0; |
| 4129 static set a(_) {} | 4180 static set a(_) {} |
| 4130 } | 4181 } |
| 4131 m() => C.a ??= 42; | 4182 m() => C.a ??= 42; |
| 4132 ''', | 4183 ''', |
| 4133 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, | 4184 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, |
| 4134 getter: 'getter(C#a)', setter: 'setter(C#a)', | 4185 getter: 'getter(C#a)', setter: 'setter(C#a)', |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4451 element: 'field(a)', rhs: '42')), | 4502 element: 'field(a)', rhs: '42')), |
| 4452 | 4503 |
| 4453 const Test( | 4504 const Test( |
| 4454 ''' | 4505 ''' |
| 4455 m() => unresolved ??= 42; | 4506 m() => unresolved ??= 42; |
| 4456 ''', | 4507 ''', |
| 4457 const Visit(VisitKind.VISIT_UNRESOLVED_SET_IF_NULL, | 4508 const Visit(VisitKind.VISIT_UNRESOLVED_SET_IF_NULL, |
| 4458 name: 'unresolved', rhs: '42')), | 4509 name: 'unresolved', rhs: '42')), |
| 4459 ], | 4510 ], |
| 4460 }; | 4511 }; |
| OLD | NEW |