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

Unified Diff: sdk/lib/_internal/compiler/implementation/warnings.dart

Issue 339583004: Add a compile time error for non-static const fields (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressing Comment Created 6 years, 5 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/warnings.dart
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index 37c3e2396cda4695eba2eba224d887f267b29607..cee1c8792926e2d4189379a52717ec0fc78854bf 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -991,6 +991,16 @@ main() => new C();"""]);
static const MessageKind ILLEGAL_FINAL_METHOD_MODIFIER = const MessageKind(
"Cannot have final modifier on method.");
+ static const MessageKind ILLEGAL_CONST_FIELD_MODIFIER = const MessageKind(
+ "Cannot have const modifier on non-static field.",
+ howToFix: "Try adding a static modifier, or removing the const modifier.",
+ examples: const ["""
+class C {
+ const int a = 1;
+}
+
+main() => new C();"""]);
+
static const MessageKind ILLEGAL_CONSTRUCTOR_MODIFIERS = const MessageKind(
"Illegal constructor modifiers: '#{modifiers}'.");
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698