Index: pkg/analyzer/lib/src/generated/element.dart |
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart |
index 5c3d4d035fe1cdbb7858196d3b270a35bfc50e14..d38c4798955c834b4f7684a2faeee2c85bcfeb18 100644 |
--- a/pkg/analyzer/lib/src/generated/element.dart |
+++ b/pkg/analyzer/lib/src/generated/element.dart |
@@ -1031,6 +1031,12 @@ abstract class ClassElement implements Element { |
bool get isProxy; |
/** |
+ * Determine whether the given [constructor], which exists in the superclass |
+ * of this class, is accessible to constructors in this class. |
+ */ |
+ bool isSuperConstructorAccessible(ConstructorElement constructor); |
+ |
+ /** |
* Return `true` if this class is defined by a typedef construct. |
* |
* @return `true` if this class is defined by a typedef construct |
@@ -1501,6 +1507,23 @@ class ClassElementImpl extends ElementImpl implements ClassElement { |
} |
@override |
+ bool isSuperConstructorAccessible(ConstructorElement constructor) { |
+ // If this class has no mixins, then all superclass constructors are |
+ // accessible. |
+ if (mixins.isEmpty) { |
+ return true; |
+ } |
+ // Otherwise only constructors that lack optional parameters are |
+ // accessible (see dartbug.com/19576). |
+ for (ParameterElement parameter in constructor.parameters) { |
+ if (parameter.parameterKind != ParameterKind.REQUIRED) { |
+ return false; |
+ } |
+ } |
+ return true; |
+ } |
+ |
+ @override |
bool get isTypedef => hasModifier(Modifier.TYPEDEF); |
@override |