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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Resolver.java

Issue 8624001: Don't allow invoking a constructor as 'const' if it wasn't declared 'const'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Self-review Created 9 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
Index: compiler/java/com/google/dart/compiler/resolver/Resolver.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Resolver.java b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
index 4721b98aed25209a03404dbcf4996217f548951d..17ed6ccae8f5c430e7aedd83910cd73a4d853997 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -935,6 +935,12 @@ public class Resolver {
constructor = checkIsConstructor(x, element);
}
+ if (constructor != null) {
+ if (x.isConst() && !constructor.getModifiers().isConstant()) {
+ onError(x, ResolverErrorCode.CONST_AND_NONCONST_CONSTRUCTOR);
+ }
+ }
+
return recordElement(x, constructor);
}

Powered by Google App Engine
This is Rietveld 408576698