| 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 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |