OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.test.src.context.context_test; | 5 library analyzer.test.src.context.context_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 3452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3463 _assertValidForChangedLibrary(a); | 3463 _assertValidForChangedLibrary(a); |
3464 _assertInvalid(a, LIBRARY_ERRORS_READY); | 3464 _assertInvalid(a, LIBRARY_ERRORS_READY); |
3465 _assertValidForDependentLibrary(b); | 3465 _assertValidForDependentLibrary(b); |
3466 _assertValidAllResolution(b); | 3466 _assertValidAllResolution(b); |
3467 _assertInvalidHintsVerifyErrors(b); | 3467 _assertInvalidHintsVerifyErrors(b); |
3468 | 3468 |
3469 _performPendingAnalysisTasks(); | 3469 _performPendingAnalysisTasks(); |
3470 expect(context.getErrors(b).errors, hasLength(1)); | 3470 expect(context.getErrors(b).errors, hasLength(1)); |
3471 } | 3471 } |
3472 | 3472 |
| 3473 void test_sequence_dependenciesWithCycles() { |
| 3474 Source a = addSource( |
| 3475 '/a.dart', |
| 3476 r''' |
| 3477 const A = 1; |
| 3478 '''); |
| 3479 Source b = addSource( |
| 3480 '/b.dart', |
| 3481 r''' |
| 3482 import 'c.dart'; |
| 3483 const B = C1 + 1; |
| 3484 '''); |
| 3485 Source c = addSource( |
| 3486 '/c.dart', |
| 3487 r''' |
| 3488 import 'a.dart'; |
| 3489 import 'b.dart'; |
| 3490 const C1 = A + 1; |
| 3491 const C2 = B + 2; |
| 3492 '''); |
| 3493 Source d = addSource( |
| 3494 '/d.dart', |
| 3495 r''' |
| 3496 import 'c.dart'; |
| 3497 const D = C2 + 1; |
| 3498 '''); |
| 3499 _performPendingAnalysisTasks(); |
| 3500 // Update "A" constant. |
| 3501 // This should invalidate results in all sources. |
| 3502 context.setContents( |
| 3503 a, |
| 3504 r''' |
| 3505 const A = 2; |
| 3506 '''); |
| 3507 _assertInvalid(a, LIBRARY_ERRORS_READY); |
| 3508 _assertInvalid(b, LIBRARY_ERRORS_READY); |
| 3509 _assertInvalid(c, LIBRARY_ERRORS_READY); |
| 3510 _assertInvalid(d, LIBRARY_ERRORS_READY); |
| 3511 } |
| 3512 |
3473 void test_sequence_inBodyChange_addRef_deltaChange() { | 3513 void test_sequence_inBodyChange_addRef_deltaChange() { |
3474 Source a = addSource( | 3514 Source a = addSource( |
3475 '/a.dart', | 3515 '/a.dart', |
3476 r''' | 3516 r''' |
3477 class A { | 3517 class A { |
3478 } | 3518 } |
3479 '''); | 3519 '''); |
3480 Source b = addSource( | 3520 Source b = addSource( |
3481 '/b.dart', | 3521 '/b.dart', |
3482 r''' | 3522 r''' |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4306 * Initialize the visitor. | 4346 * Initialize the visitor. |
4307 */ | 4347 */ |
4308 _ElementGatherer(); | 4348 _ElementGatherer(); |
4309 | 4349 |
4310 @override | 4350 @override |
4311 void visitElement(Element element) { | 4351 void visitElement(Element element) { |
4312 elements[element] = element; | 4352 elements[element] = element; |
4313 super.visitElement(element); | 4353 super.visitElement(element); |
4314 } | 4354 } |
4315 } | 4355 } |
OLD | NEW |