Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2171673002: Fix for limited invalidation in the middle, and the unlimited invalidation for an exported library. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update tasks. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3612 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 int foo; 3623 int foo;
3624 } 3624 }
3625 '''); 3625 ''');
3626 _assertValidForChangedLibrary(a); 3626 _assertValidForChangedLibrary(a);
3627 _assertInvalid(a, LIBRARY_ERRORS_READY); 3627 _assertInvalid(a, LIBRARY_ERRORS_READY);
3628 _assertValidForDependentLibrary(b); 3628 _assertValidForDependentLibrary(b);
3629 _assertValidAllLibraryUnitResults(b); 3629 _assertValidAllLibraryUnitResults(b);
3630 _assertValid(b, LIBRARY_ERRORS_READY); 3630 _assertValid(b, LIBRARY_ERRORS_READY);
3631 } 3631 }
3632 3632
3633 void test_sequence_middleLimited_thenFirstFull() {
3634 Source a = addSource(
3635 '/a.dart',
3636 r'''
3637 class A {}
3638 ''');
3639 Source b = addSource(
3640 '/b.dart',
3641 r'''
3642 export 'a.dart';
3643 ''');
3644 Source c = addSource(
3645 '/c.dart',
3646 r'''
3647 import 'b.dart';
3648 A a;
3649 ''');
3650 _performPendingAnalysisTasks();
3651 // Update b.dart: limited invalidation.
3652 // Results in c.dart are valid, because the change in b.dart does not
3653 // affect anything in c.dart.
3654 context.setContents(
3655 b,
3656 r'''
3657 export 'a.dart';
3658 class B {}
3659 ''');
3660 _assertValid(a, LIBRARY_ERRORS_READY);
3661 _assertInvalid(b, LIBRARY_ERRORS_READY);
3662 _assertValid(c, LIBRARY_ERRORS_READY);
3663 _assertUnitValid(c, RESOLVED_UNIT4);
3664 _assertUnitValid(c, RESOLVED_UNIT5);
3665 // Update a.dart: unlimited invalidation.
3666 // Results RESOLVED_UNIT4, RESOLVED_UNIT5, and RESOLVED_UNIT6 in c.dart
3667 // are invalid, because after unlimited change to a.dart everything
3668 // should be invalidated.
3669 // This fixes the problem that c.dart was not re-resolving type names.
3670 context.setContents(
3671 a,
3672 r'''
3673 import 'dart:async';
3674 class A {}
3675 ''');
3676 _assertInvalid(a, LIBRARY_ERRORS_READY);
3677 _assertInvalid(b, LIBRARY_ERRORS_READY);
3678 _assertInvalid(c, LIBRARY_ERRORS_READY);
3679 _assertInvalidUnits(c, RESOLVED_UNIT4);
3680 }
3681
3633 void test_sequence_noChange_thenChange() { 3682 void test_sequence_noChange_thenChange() {
3634 Source a = addSource( 3683 Source a = addSource(
3635 '/a.dart', 3684 '/a.dart',
3636 r''' 3685 r'''
3637 class A { 3686 class A {
3638 A(); 3687 A();
3639 } 3688 }
3640 3689
3641 class B { 3690 class B {
3642 B(); 3691 B();
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
4375 * Initialize the visitor. 4424 * Initialize the visitor.
4376 */ 4425 */
4377 _ElementGatherer(); 4426 _ElementGatherer();
4378 4427
4379 @override 4428 @override
4380 void visitElement(Element element) { 4429 void visitElement(Element element) {
4381 elements[element] = element; 4430 elements[element] = element;
4382 super.visitElement(element); 4431 super.visitElement(element);
4383 } 4432 }
4384 } 4433 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698