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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java

Issue 17581003: Report NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT as CTEC. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tweaks Created 7 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: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
index 0bc7718b4cdad3d59b5b8251b830ab37c9e4e765..b884866115c803a445b67c98b4b8e063f4f70565 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
@@ -3044,12 +3044,12 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
}
/**
- * This checks that passed if the passed class declaration implicitly calls default constructor of
- * its superclass, there should be such default constructor - implicit or explicit.
+ * This checks that if the passed class declaration implicitly calls default constructor of its
+ * superclass, there should be such default constructor - implicit or explicit.
*
* @param node the {@link ClassDeclaration} to evaluate
* @return {@code true} if and only if an error code is generated on the passed node
- * @see StaticWarningCode#NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
+ * @see CompileTimeErrorCode#NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
*/
private boolean checkForNoDefaultSuperConstructorImplicit(ClassDeclaration node) {
// do nothing if there is explicit constructor
@@ -3062,14 +3062,24 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
if (superType == null) {
return false;
}
- ClassElement superClass = superType.getElement();
- // check if super has default constructor
- if (superClass.hasDefaultConstructor()) {
- return false;
+ ClassElement superElement = superType.getElement();
+ // try to find default generative super constructor
+ ConstructorElement superUnnamedConstructor = superElement.getUnnamedConstructor();
+ if (superUnnamedConstructor != null) {
+ if (superUnnamedConstructor.isFactory()) {
+ errorReporter.reportError(
+ CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
+ node.getName(),
+ superUnnamedConstructor);
+ return true;
+ }
+ if (superUnnamedConstructor.isDefaultConstructor()) {
+ return true;
+ }
}
// report problem
errorReporter.reportError(
- StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT,
+ CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT,
node.getName(),
superType.getDisplayName());
return true;
@@ -3917,7 +3927,7 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
length = (name != null ? name.getEnd() : returnType.getEnd()) - offset;
}
errorReporter.reportError(
- StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT,
+ CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT,
offset,
length,
superType.getDisplayName());

Powered by Google App Engine
This is Rietveld 408576698