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

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 2201993002: Don't invalidate resolution for ClassElementDelta annotation changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('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) 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 analyzer.src.task.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2626 2626
2627 bool hasAffectedHintsVerifyErrors( 2627 bool hasAffectedHintsVerifyErrors(
2628 ReferencedNames references, Source refLibrary) { 2628 ReferencedNames references, Source refLibrary) {
2629 for (String superName in references.superToSubs.keys) { 2629 for (String superName in references.superToSubs.keys) {
2630 if (isChangedOrClass(refLibrary, superName)) { 2630 if (isChangedOrClass(refLibrary, superName)) {
2631 _log(() => '$refLibrary hints/verify errors are affected because ' 2631 _log(() => '$refLibrary hints/verify errors are affected because '
2632 '${references.superToSubs[superName]} subclasses $superName'); 2632 '${references.superToSubs[superName]} subclasses $superName');
2633 return true; 2633 return true;
2634 } 2634 }
2635 } 2635 }
2636 for (String name in references.names) {
2637 ClassElementDelta classDelta = changedClasses[name];
2638 if (classDelta != null && classDelta.hasAnnotationChanges) {
2639 _log(() => '$refLibrary hints/verify errors are affected because '
2640 '$name has a class delta with annotation changes');
2641 return true;
2642 }
2643 }
2636 return false; 2644 return false;
2637 } 2645 }
2638 2646
2639 bool hasAffectedReferences(ReferencedNames references, Source refLibrary) { 2647 bool hasAffectedReferences(ReferencedNames references, Source refLibrary) {
2640 // Resolution must be performed when a referenced element changes. 2648 // Resolution must be performed when a referenced element changes.
2641 for (String name in references.names) { 2649 for (String name in references.names) {
2642 if (isChangedOrClassMember(refLibrary, name)) { 2650 if (isChangedOrClassMember(refLibrary, name)) {
2643 _log(() => '$refLibrary is affected by $name'); 2651 _log(() => '$refLibrary is affected by $name');
2644 return true; 2652 return true;
2645 } 2653 }
(...skipping 12 matching lines...) Expand all
2658 } 2666 }
2659 for (String name in references.extendedUsedUnnamedConstructorNames) { 2667 for (String name in references.extendedUsedUnnamedConstructorNames) {
2660 for (ClassElementDelta classDelta in changedClasses.values) { 2668 for (ClassElementDelta classDelta in changedClasses.values) {
2661 if (classDelta.name == name && classDelta.hasUnnamedConstructorChange) { 2669 if (classDelta.name == name && classDelta.hasUnnamedConstructorChange) {
2662 _log(() => 2670 _log(() =>
2663 '$refLibrary is affected by the default constructor of $name'); 2671 '$refLibrary is affected by the default constructor of $name');
2664 return true; 2672 return true;
2665 } 2673 }
2666 } 2674 }
2667 } 2675 }
2668 // TODO(scheglov) We don't need to invalidate resolution.
2669 // We could just invalidate errors if we moved reporting of
2670 // HintCode.DEPRECATED_MEMBER_USE from resolver to verifier.
2671 for (String name in references.names) {
2672 ClassElementDelta classDelta = changedClasses[name];
2673 if (classDelta != null && classDelta.hasAnnotationChanges) {
2674 _log(() => '$refLibrary is affected because '
2675 '$name has a class delta with annotation changes');
2676 return true;
2677 }
2678 }
2679 return false; 2676 return false;
2680 } 2677 }
2681 2678
2682 /** 2679 /**
2683 * Return `true` if the given [name], used in a unit of the [librarySource], 2680 * Return `true` if the given [name], used in a unit of the [librarySource],
2684 * is affected by a changed top-level element, excluding classes. 2681 * is affected by a changed top-level element, excluding classes.
2685 */ 2682 */
2686 bool isChanged(Source librarySource, String name) { 2683 bool isChanged(Source librarySource, String name) {
2687 if (_isPrivateName(name)) { 2684 if (_isPrivateName(name)) {
2688 if (changedPrivateNames[librarySource]?.contains(name) ?? false) { 2685 if (changedPrivateNames[librarySource]?.contains(name) ?? false) {
(...skipping 3884 matching lines...) Expand 10 before | Expand all | Expand 10 after
6573 6570
6574 @override 6571 @override
6575 bool moveNext() { 6572 bool moveNext() {
6576 if (_newSources.isEmpty) { 6573 if (_newSources.isEmpty) {
6577 return false; 6574 return false;
6578 } 6575 }
6579 currentTarget = _newSources.removeLast(); 6576 currentTarget = _newSources.removeLast();
6580 return true; 6577 return true;
6581 } 6578 }
6582 } 6579 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698