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

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

Issue 14698013: Report CompileTimeErrorCode.MIXIN_REFERENCES_SUPER (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments Created 7 years, 7 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 72c004edac39af2ba820e6ba6a7ad4315f90d510..18d00a087f0bc6edee3e08a7e2725bc69259a809 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
@@ -1528,6 +1528,24 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
}
/**
+ * This verifies that the passed mixin does not reference 'super'.
+ *
+ * @param mixinName the node to report problem on
+ * @param mixinElement the mixing to evaluate
+ * @return {@code true} if and only if an error code is generated on the passed node
+ * @see CompileTimeErrorCode#MIXIN_REFERENCES_SUPER
+ */
+ private boolean checkForMixinReferencesSuper(TypeName mixinName, ClassElement mixinElement) {
+ if (mixinElement.hasReferenceToSuper()) {
+ errorReporter.reportError(
+ CompileTimeErrorCode.MIXIN_REFERENCES_SUPER,
+ mixinName,
+ mixinElement.getName());
+ }
+ return false;
+ }
+
+ /**
* This verifies that all classes of the passed 'with' clause are valid.
*
* @param node the 'with' clause to evaluate
@@ -1547,6 +1565,7 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
ClassElement mixinElement = ((InterfaceType) mixinType).getElement();
problemReported |= checkForMixinDeclaresConstructor(mixinName, mixinElement);
problemReported |= checkForMixinInheritsNotFromObject(mixinName, mixinElement);
+ problemReported |= checkForMixinReferencesSuper(mixinName, mixinElement);
}
return problemReported;
}

Powered by Google App Engine
This is Rietveld 408576698