Remove ClassElement.isSuperConstructorAccessible().
I don't see it used anywhere outside of Analyzer itself in internal
codebase. So, I think it is safe to remove.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: If5dafdaaa0f94cf280822418d99ed64060b66d4b
Reviewed-on: https://dart-review.googlesource.com/75562
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index a1b84af..fdc7100 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -267,14 +267,6 @@
PropertyAccessorElement getSetter(String name);
/**
- * Determine whether the given [constructor], which exists in the superclass
- * of this class, is accessible to constructors in this class.
- *
- * TODO(scheglov) Remove this.
- */
- bool isSuperConstructorAccessible(ConstructorElement constructor);
-
- /**
* Return the element representing the method that results from looking up the
* given [methodName] in this class with respect to the given [library],
* ignoring abstract methods, or `null` if the look up fails. The behavior of
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 588f112..2c409ca 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -1022,11 +1022,6 @@
getNamedConstructorFromList(name, constructors);
@override
- bool isSuperConstructorAccessible(ConstructorElement constructor) {
- return constructor.isAccessibleIn(library);
- }
-
- @override
void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(constructors, visitor);
@@ -1052,12 +1047,9 @@
assert(false);
constructorsToForward = <ConstructorElement>[];
} else if (!supertype.element.isMixinApplication) {
- List<ConstructorElement> superclassConstructors =
- supertype.element.constructors;
- // Filter out any constructors with optional parameters (see
- // dartbug.com/15101).
- constructorsToForward =
- superclassConstructors.where(isSuperConstructorAccessible);
+ var library = this.library;
+ constructorsToForward = supertype.element.constructors
+ .where((constructor) => constructor.isAccessibleIn(library));
} else {
if (visitedClasses == null) {
visitedClasses = <ClassElementImpl>[this];
@@ -3756,9 +3748,6 @@
@override
ConstructorElement getNamedConstructor(String name) => null;
- @override
- bool isSuperConstructorAccessible(ConstructorElement constructor) => false;
-
void _resynthesizeMembers() {
List<FieldElementImpl> fields = <FieldElementImpl>[];
// Build the 'index' field.
diff --git a/pkg/analyzer/lib/src/dart/element/handle.dart b/pkg/analyzer/lib/src/dart/element/handle.dart
index f2929a7..8d6f5f0 100644
--- a/pkg/analyzer/lib/src/dart/element/handle.dart
+++ b/pkg/analyzer/lib/src/dart/element/handle.dart
@@ -139,10 +139,6 @@
actualElement.getSetter(setterName);
@override
- bool isSuperConstructorAccessible(ConstructorElement constructor) =>
- actualElement.isSuperConstructorAccessible(constructor);
-
- @override
MethodElement lookUpConcreteMethod(
String methodName, LibraryElement library) =>
actualElement.lookUpConcreteMethod(methodName, library);
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 46d3c3b..286a2f7 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -1052,8 +1052,7 @@
String superName = name?.name;
ConstructorElement element =
superType.lookUpConstructor(superName, _definingLibrary);
- if (element == null ||
- !enclosingClass.isSuperConstructorAccessible(element)) {
+ if (element == null || !element.isAccessibleIn(_definingLibrary)) {
if (name != null) {
_resolver.errorReporter.reportErrorForNode(
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER,
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index b783d25..41b7cbe 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -4496,9 +4496,7 @@
[superUnnamedConstructor]);
return;
}
- if (superUnnamedConstructor.isDefaultConstructor &&
- _enclosingClass
- .isSuperConstructorAccessible(superUnnamedConstructor)) {
+ if (superUnnamedConstructor.isDefaultConstructor) {
return;
}
}
@@ -5505,9 +5503,7 @@
CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
constructor.returnType,
[superUnnamedConstructor]);
- } else if (!superUnnamedConstructor.isDefaultConstructor ||
- !_enclosingClass
- .isSuperConstructorAccessible(superUnnamedConstructor)) {
+ } else if (!superUnnamedConstructor.isDefaultConstructor) {
Identifier returnType = constructor.returnType;
SimpleIdentifier name = constructor.name;
int offset = returnType.offset;