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

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

Issue 272803002: Issue 18653. Report error for a const constructor in a class with a mixin. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 50df8fd5dbb7b9894ac4df78c73cdd2c337febcd..0e259ec21a116001a22f369d75d2f289314cf104 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
@@ -2641,6 +2641,13 @@ public class ErrorVerifier extends RecursiveAstVisitor<Void> {
if (node.getFactoryKeyword() != null) {
return false;
}
+ // check for mixins
+ if (enclosingClass.getMixins().length != 0) {
+ errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN,
+ node.getReturnType());
+ return true;
+ }
// try to find and check super constructor invocation
for (ConstructorInitializer initializer : node.getInitializers()) {
if (initializer instanceof SuperConstructorInvocation) {
@@ -2651,7 +2658,8 @@ public class ErrorVerifier extends RecursiveAstVisitor<Void> {
}
errorReporter.reportErrorForNode(
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER,
- superInvocation);
+ superInvocation,
+ element.getEnclosingElement().getDisplayName());
return true;
}
}
@@ -2673,7 +2681,8 @@ public class ErrorVerifier extends RecursiveAstVisitor<Void> {
// default constructor is not 'const', report problem
errorReporter.reportErrorForNode(
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER,
- node.getReturnType());
+ node.getReturnType(),
+ supertype.getDisplayName());
return true;
}

Powered by Google App Engine
This is Rietveld 408576698