| 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3092 test_const_length_ofClassConstField_imported_withPrefix() async { | 3092 test_const_length_ofClassConstField_imported_withPrefix() async { |
| 3093 addLibrarySource('/a.dart', r''' | 3093 addLibrarySource('/a.dart', r''' |
| 3094 class C { | 3094 class C { |
| 3095 static const String F = ''; | 3095 static const String F = ''; |
| 3096 } | 3096 } |
| 3097 '''); | 3097 '''); |
| 3098 var library = await checkLibrary(r''' | 3098 var library = await checkLibrary(r''' |
| 3099 import 'a.dart' as p; | 3099 import 'a.dart' as p; |
| 3100 const int v = p.C.F.length; | 3100 const int v = p.C.F.length; |
| 3101 '''); | 3101 '''); |
| 3102 checkElementText(library, r''' | 3102 if (isSharedFrontEnd) { |
| 3103 checkElementText(library, r''' |
| 3104 import 'a.dart' as p; |
| 3105 const int v = |
| 3106 C/*location: a.dart;C*/. |
| 3107 F/*location: a.dart;C;F?*/. |
| 3108 length/*location: dart:core;String;length?*/; |
| 3109 '''); |
| 3110 } else { |
| 3111 checkElementText(library, r''' |
| 3103 import 'a.dart' as p; | 3112 import 'a.dart' as p; |
| 3104 const int v = | 3113 const int v = |
| 3105 p/*location: test.dart;p*/. | 3114 p/*location: test.dart;p*/. |
| 3106 C/*location: a.dart;C*/. | 3115 C/*location: a.dart;C*/. |
| 3107 F/*location: a.dart;C;F?*/. | 3116 F/*location: a.dart;C;F?*/. |
| 3108 length/*location: dart:core;String;length?*/; | 3117 length/*location: dart:core;String;length?*/; |
| 3109 '''); | 3118 '''); |
| 3119 } |
| 3110 } | 3120 } |
| 3111 | 3121 |
| 3112 test_const_length_ofStringLiteral() async { | 3122 test_const_length_ofStringLiteral() async { |
| 3113 var library = await checkLibrary(r''' | 3123 var library = await checkLibrary(r''' |
| 3114 const v = 'abc'.length; | 3124 const v = 'abc'.length; |
| 3115 '''); | 3125 '''); |
| 3116 if (isStrongMode) { | 3126 if (isStrongMode) { |
| 3117 if (isSharedFrontEnd) { | 3127 if (isSharedFrontEnd) { |
| 3118 checkElementText(library, r''' | 3128 checkElementText(library, r''' |
| 3119 const int v = 'abc'. | 3129 const int v = 'abc'. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3191 | 3201 |
| 3192 test_const_length_ofTopLevelVariable_imported_withPrefix() async { | 3202 test_const_length_ofTopLevelVariable_imported_withPrefix() async { |
| 3193 addLibrarySource('/a.dart', r''' | 3203 addLibrarySource('/a.dart', r''' |
| 3194 const String S = 'abc'; | 3204 const String S = 'abc'; |
| 3195 '''); | 3205 '''); |
| 3196 var library = await checkLibrary(r''' | 3206 var library = await checkLibrary(r''' |
| 3197 import 'a.dart' as p; | 3207 import 'a.dart' as p; |
| 3198 const v = p.S.length; | 3208 const v = p.S.length; |
| 3199 '''); | 3209 '''); |
| 3200 if (isStrongMode) { | 3210 if (isStrongMode) { |
| 3201 checkElementText(library, r''' | 3211 if (isSharedFrontEnd) { |
| 3212 checkElementText(library, r''' |
| 3213 import 'a.dart' as p; |
| 3214 const int v = |
| 3215 S/*location: a.dart;S?*/. |
| 3216 length/*location: dart:core;String;length?*/; |
| 3217 '''); |
| 3218 } else { |
| 3219 checkElementText(library, r''' |
| 3202 import 'a.dart' as p; | 3220 import 'a.dart' as p; |
| 3203 const int v = | 3221 const int v = |
| 3204 p/*location: test.dart;p*/. | 3222 p/*location: test.dart;p*/. |
| 3205 S/*location: a.dart;S?*/. | 3223 S/*location: a.dart;S?*/. |
| 3206 length/*location: dart:core;String;length?*/; | 3224 length/*location: dart:core;String;length?*/; |
| 3207 '''); | 3225 '''); |
| 3226 } |
| 3208 } else { | 3227 } else { |
| 3209 checkElementText(library, r''' | 3228 checkElementText(library, r''' |
| 3210 import 'a.dart' as p; | 3229 import 'a.dart' as p; |
| 3211 const dynamic v = | 3230 const dynamic v = |
| 3212 p/*location: test.dart;p*/. | 3231 p/*location: test.dart;p*/. |
| 3213 S/*location: a.dart;S?*/. | 3232 S/*location: a.dart;S?*/. |
| 3214 length/*location: dart:core;String;length?*/; | 3233 length/*location: dart:core;String;length?*/; |
| 3215 '''); | 3234 '''); |
| 3216 } | 3235 } |
| 3217 } | 3236 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3374 addLibrarySource('/a.dart', r''' | 3393 addLibrarySource('/a.dart', r''' |
| 3375 class C { | 3394 class C { |
| 3376 static const int F = 42; | 3395 static const int F = 42; |
| 3377 } | 3396 } |
| 3378 '''); | 3397 '''); |
| 3379 var library = await checkLibrary(r''' | 3398 var library = await checkLibrary(r''' |
| 3380 import 'a.dart' as p; | 3399 import 'a.dart' as p; |
| 3381 const V = p.C.F; | 3400 const V = p.C.F; |
| 3382 '''); | 3401 '''); |
| 3383 if (isStrongMode) { | 3402 if (isStrongMode) { |
| 3384 checkElementText(library, r''' | 3403 if (isSharedFrontEnd) { |
| 3404 checkElementText(library, r''' |
| 3405 import 'a.dart' as p; |
| 3406 const int V = |
| 3407 C/*location: a.dart;C*/. |
| 3408 F/*location: a.dart;C;F?*/; |
| 3409 '''); |
| 3410 } else { |
| 3411 checkElementText(library, r''' |
| 3385 import 'a.dart' as p; | 3412 import 'a.dart' as p; |
| 3386 const int V = | 3413 const int V = |
| 3387 p/*location: test.dart;p*/. | 3414 p/*location: test.dart;p*/. |
| 3388 C/*location: a.dart;C*/. | 3415 C/*location: a.dart;C*/. |
| 3389 F/*location: a.dart;C;F?*/; | 3416 F/*location: a.dart;C;F?*/; |
| 3390 '''); | 3417 '''); |
| 3418 } |
| 3391 } else { | 3419 } else { |
| 3392 checkElementText(library, r''' | 3420 checkElementText(library, r''' |
| 3393 import 'a.dart' as p; | 3421 import 'a.dart' as p; |
| 3394 const dynamic V = | 3422 const dynamic V = |
| 3395 p/*location: test.dart;p*/. | 3423 p/*location: test.dart;p*/. |
| 3396 C/*location: a.dart;C*/. | 3424 C/*location: a.dart;C*/. |
| 3397 F/*location: a.dart;C;F?*/; | 3425 F/*location: a.dart;C;F?*/; |
| 3398 '''); | 3426 '''); |
| 3399 } | 3427 } |
| 3400 } | 3428 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3458 addLibrarySource('/a.dart', r''' | 3486 addLibrarySource('/a.dart', r''' |
| 3459 class C { | 3487 class C { |
| 3460 static int m(int a, String b) => 42; | 3488 static int m(int a, String b) => 42; |
| 3461 } | 3489 } |
| 3462 '''); | 3490 '''); |
| 3463 var library = await checkLibrary(r''' | 3491 var library = await checkLibrary(r''' |
| 3464 import 'a.dart' as p; | 3492 import 'a.dart' as p; |
| 3465 const V = p.C.m; | 3493 const V = p.C.m; |
| 3466 '''); | 3494 '''); |
| 3467 if (isStrongMode) { | 3495 if (isStrongMode) { |
| 3468 checkElementText(library, r''' | 3496 if (isSharedFrontEnd) { |
| 3497 checkElementText(library, r''' |
| 3498 import 'a.dart' as p; |
| 3499 const (int, String) → int V = |
| 3500 C/*location: a.dart;C*/. |
| 3501 m/*location: a.dart;C;m*/; |
| 3502 '''); |
| 3503 } else { |
| 3504 checkElementText(library, r''' |
| 3469 import 'a.dart' as p; | 3505 import 'a.dart' as p; |
| 3470 const (int, String) → int V = | 3506 const (int, String) → int V = |
| 3471 p/*location: test.dart;p*/. | 3507 p/*location: test.dart;p*/. |
| 3472 C/*location: a.dart;C*/. | 3508 C/*location: a.dart;C*/. |
| 3473 m/*location: a.dart;C;m*/; | 3509 m/*location: a.dart;C;m*/; |
| 3474 '''); | 3510 '''); |
| 3511 } |
| 3475 } else { | 3512 } else { |
| 3476 checkElementText(library, r''' | 3513 checkElementText(library, r''' |
| 3477 import 'a.dart' as p; | 3514 import 'a.dart' as p; |
| 3478 const dynamic V = | 3515 const dynamic V = |
| 3479 p/*location: test.dart;p*/. | 3516 p/*location: test.dart;p*/. |
| 3480 C/*location: a.dart;C*/. | 3517 C/*location: a.dart;C*/. |
| 3481 m/*location: a.dart;C;m*/; | 3518 m/*location: a.dart;C;m*/; |
| 3482 '''); | 3519 '''); |
| 3483 } | 3520 } |
| 3484 } | 3521 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3548 | 3585 |
| 3549 test_const_reference_topLevelFunction_imported_withPrefix() async { | 3586 test_const_reference_topLevelFunction_imported_withPrefix() async { |
| 3550 addLibrarySource('/a.dart', r''' | 3587 addLibrarySource('/a.dart', r''' |
| 3551 foo() {} | 3588 foo() {} |
| 3552 '''); | 3589 '''); |
| 3553 var library = await checkLibrary(r''' | 3590 var library = await checkLibrary(r''' |
| 3554 import 'a.dart' as p; | 3591 import 'a.dart' as p; |
| 3555 const V = p.foo; | 3592 const V = p.foo; |
| 3556 '''); | 3593 '''); |
| 3557 if (isStrongMode) { | 3594 if (isStrongMode) { |
| 3558 checkElementText(library, r''' | 3595 if (isSharedFrontEnd) { |
| 3596 checkElementText(library, r''' |
| 3597 import 'a.dart' as p; |
| 3598 const () → dynamic V = |
| 3599 foo/*location: a.dart;foo*/; |
| 3600 '''); |
| 3601 } else { |
| 3602 checkElementText(library, r''' |
| 3559 import 'a.dart' as p; | 3603 import 'a.dart' as p; |
| 3560 const () → dynamic V = | 3604 const () → dynamic V = |
| 3561 p/*location: test.dart;p*/. | 3605 p/*location: test.dart;p*/. |
| 3562 foo/*location: a.dart;foo*/; | 3606 foo/*location: a.dart;foo*/; |
| 3563 '''); | 3607 '''); |
| 3608 } |
| 3564 } else { | 3609 } else { |
| 3565 checkElementText(library, r''' | 3610 checkElementText(library, r''' |
| 3566 import 'a.dart' as p; | 3611 import 'a.dart' as p; |
| 3567 const dynamic V = | 3612 const dynamic V = |
| 3568 p/*location: test.dart;p*/. | 3613 p/*location: test.dart;p*/. |
| 3569 foo/*location: a.dart;foo*/; | 3614 foo/*location: a.dart;foo*/; |
| 3570 '''); | 3615 '''); |
| 3571 } | 3616 } |
| 3572 } | 3617 } |
| 3573 | 3618 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3616 | 3661 |
| 3617 test_const_reference_topLevelVariable_imported_withPrefix() async { | 3662 test_const_reference_topLevelVariable_imported_withPrefix() async { |
| 3618 addLibrarySource('/a.dart', r''' | 3663 addLibrarySource('/a.dart', r''' |
| 3619 const A = 1; | 3664 const A = 1; |
| 3620 '''); | 3665 '''); |
| 3621 var library = await checkLibrary(r''' | 3666 var library = await checkLibrary(r''' |
| 3622 import 'a.dart' as p; | 3667 import 'a.dart' as p; |
| 3623 const B = p.A + 2; | 3668 const B = p.A + 2; |
| 3624 '''); | 3669 '''); |
| 3625 if (isStrongMode) { | 3670 if (isStrongMode) { |
| 3626 checkElementText(library, r''' | 3671 if (isSharedFrontEnd) { |
| 3672 checkElementText(library, r''' |
| 3673 import 'a.dart' as p; |
| 3674 const int B = |
| 3675 A/*location: a.dart;A?*/ + 2; |
| 3676 '''); |
| 3677 } else { |
| 3678 checkElementText(library, r''' |
| 3627 import 'a.dart' as p; | 3679 import 'a.dart' as p; |
| 3628 const int B = | 3680 const int B = |
| 3629 p/*location: test.dart;p*/. | 3681 p/*location: test.dart;p*/. |
| 3630 A/*location: a.dart;A?*/ + 2; | 3682 A/*location: a.dart;A?*/ + 2; |
| 3631 '''); | 3683 '''); |
| 3684 } |
| 3632 } else { | 3685 } else { |
| 3633 checkElementText(library, r''' | 3686 checkElementText(library, r''' |
| 3634 import 'a.dart' as p; | 3687 import 'a.dart' as p; |
| 3635 const dynamic B = | 3688 const dynamic B = |
| 3636 p/*location: test.dart;p*/. | 3689 p/*location: test.dart;p*/. |
| 3637 A/*location: a.dart;A?*/ + 2; | 3690 A/*location: a.dart;A?*/ + 2; |
| 3638 '''); | 3691 '''); |
| 3639 } | 3692 } |
| 3640 } | 3693 } |
| 3641 | 3694 |
| (...skipping 6352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9994 fail('Unexpectedly tried to get unlinked summary for $uri'); | 10047 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 9995 } | 10048 } |
| 9996 return serializedUnit; | 10049 return serializedUnit; |
| 9997 } | 10050 } |
| 9998 | 10051 |
| 9999 @override | 10052 @override |
| 10000 bool hasLibrarySummary(String uri) { | 10053 bool hasLibrarySummary(String uri) { |
| 10001 return true; | 10054 return true; |
| 10002 } | 10055 } |
| 10003 } | 10056 } |
| OLD | NEW |