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

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

Issue 1215053003: Compute mixin application constructors in the ClassElement.constructors getter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months 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
Index: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 85ea9015c109dbc89c8a4ff03c5e5e76f7a0f9a6..e80e02abdd0c8528ad1717884a64134c084879e3 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -422,6 +422,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
_checkForConflictingInstanceGetterAndSuperclassMember();
_checkImplementsSuperClass(node);
_checkImplementsFunctionWithoutCall(node);
+ _checkForMixinHasNoConstructors(node);
}
}
visitClassDeclarationIncrementally(node);
@@ -474,6 +475,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
_checkForImplementsDeferredClass(implementsClause);
_checkForRecursiveInterfaceInheritance(_enclosingClass);
_checkForNonAbstractClassInheritsAbstractMember(node.name);
+ _checkForMixinHasNoConstructors(node);
}
} finally {
_enclosingClass = outerClassElement;
@@ -4165,6 +4167,18 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
+ * Report the error [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS] if
+ * appropriate.
+ */
+ void _checkForMixinHasNoConstructors(AstNode node) {
+ if ((_enclosingClass as ClassElementImpl).doesMixinLackConstructors) {
+ ErrorCode errorCode = CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS;
+ _errorReporter.reportErrorForNode(
+ errorCode, node, [_enclosingClass.supertype]);
+ }
+ }
+
+ /**
* Verify that the given mixin has the 'Object' superclass. The [mixinName] is
* the node to report problem on. The [mixinElement] is the mixing to
* evaluate.
@@ -4290,7 +4304,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
ClassDeclaration declaration) {
// do nothing if mixin errors have already been reported for this class.
ClassElementImpl enclosingClass = _enclosingClass;
- if (enclosingClass.mixinErrorsReported) {
+ if (enclosingClass.doesMixinLackConstructors) {
return false;
}
// do nothing if there is explicit constructor
@@ -5183,7 +5197,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
// do nothing if mixin errors have already been reported for this class.
ClassElementImpl enclosingClass = _enclosingClass;
- if (enclosingClass.mixinErrorsReported) {
+ if (enclosingClass.doesMixinLackConstructors) {
return false;
}
//
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_resolver.dart ('k') | pkg/analyzer/lib/src/generated/incremental_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698