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

Unified Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 707073002: Fix analyzer's treatment of mixin constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve error message. Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698