| Index: pkg/analyzer/lib/src/task/dart.dart
|
| diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
|
| index 029f11c3d31a45e2725dcee8b50cb6eb7a93be11..0d3981fc0ac5644d66a19b8116525163e7186209 100644
|
| --- a/pkg/analyzer/lib/src/task/dart.dart
|
| +++ b/pkg/analyzer/lib/src/task/dart.dart
|
| @@ -2656,6 +2656,15 @@ class DartDelta extends Delta {
|
| }
|
| }
|
| }
|
| + for (String name in references.extendedUsedUnnamedConstructorNames) {
|
| + for (ClassElementDelta classDelta in changedClasses.values) {
|
| + if (classDelta.name == name && classDelta.hasUnnamedConstructorChange) {
|
| + _log(() =>
|
| + '$refLibrary is affected by the default constructor of $name');
|
| + return true;
|
| + }
|
| + }
|
| + }
|
| return false;
|
| }
|
|
|
| @@ -4788,6 +4797,13 @@ class ReferencedNames {
|
| final Map<String, Set<String>> superToSubs = <String, Set<String>>{};
|
|
|
| /**
|
| + * The names of extended classes for which the unnamed constructor is
|
| + * invoked. Because we cannot use the name of the constructor to identify
|
| + * whether the unit is affected, we need to use the class name.
|
| + */
|
| + final Set<String> extendedUsedUnnamedConstructorNames = new Set<String>();
|
| +
|
| + /**
|
| * The names of instantiated classes.
|
| *
|
| * If one of these classes changes its set of members, it might change
|
| @@ -4823,6 +4839,7 @@ class ReferencedNamesBuilder extends GeneralizingAstVisitor {
|
| final Set<String> importPrefixNames = new Set<String>();
|
| final ReferencedNames names;
|
|
|
| + String enclosingSuperClassName;
|
| ReferencedNamesScope scope = new ReferencedNamesScope(null);
|
|
|
| int localLevel = 0;
|
| @@ -4852,6 +4869,8 @@ class ReferencedNamesBuilder extends GeneralizingAstVisitor {
|
| try {
|
| scope = new ReferencedNamesScope.forClass(scope, node);
|
| dependsOn = new Set<String>();
|
| + enclosingSuperClassName =
|
| + _getSimpleName(node.extendsClause?.superclass?.name);
|
| super.visitClassDeclaration(node);
|
| String className = node.name.name;
|
| names.userToDependsOn[className] = dependsOn;
|
| @@ -4859,11 +4878,22 @@ class ReferencedNamesBuilder extends GeneralizingAstVisitor {
|
| _addSuperNames(className, node.withClause?.mixinTypes);
|
| _addSuperNames(className, node.implementsClause?.interfaces);
|
| } finally {
|
| + enclosingSuperClassName = null;
|
| dependsOn = null;
|
| scope = outerScope;
|
| }
|
| }
|
|
|
| + static String _getSimpleName(Identifier identifier) {
|
| + if (identifier is SimpleIdentifier) {
|
| + return identifier.name;
|
| + }
|
| + if (identifier is PrefixedIdentifier) {
|
| + return identifier.identifier.name;
|
| + }
|
| + return null;
|
| + }
|
| +
|
| @override
|
| visitClassTypeAlias(ClassTypeAlias node) {
|
| ReferencedNamesScope outerScope = scope;
|
| @@ -4893,6 +4923,14 @@ class ReferencedNamesBuilder extends GeneralizingAstVisitor {
|
| }
|
|
|
| @override
|
| + visitSuperConstructorInvocation(SuperConstructorInvocation node) {
|
| + if (node.constructorName == null && enclosingSuperClassName != null) {
|
| + names.extendedUsedUnnamedConstructorNames.add(enclosingSuperClassName);
|
| + }
|
| + super.visitSuperConstructorInvocation(node);
|
| + }
|
| +
|
| + @override
|
| visitConstructorName(ConstructorName node) {
|
| if (node.parent is! ConstructorDeclaration) {
|
| super.visitConstructorName(node);
|
|
|