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

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

Issue 25504002: Emit a compile-time error for uninitialized final variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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: 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 7d5dcbf30e087af02b5bbb8efdbc1743bac34565..43986562cc57b5de1d7fe48a187bd340f477469e 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -881,6 +881,13 @@ void main() {
const c; // This constant variable must be initialized.
}"""]);
+ static const MessageKind STATIC_FINAL_WITHOUT_INITIALIZER = const MessageKind(
+ "Error: A static final field must be initialized.",
+ howToFix: "Try adding an initializer or "
+ "removing the 'final' modifier.",
+ examples: const [
+ "class C { static final field; } main() => C.field;"]);
+
static const MessageKind MEMBER_USES_CLASS_NAME = const MessageKind(
"Error: Member variable can't have the same name as the class it is "
"declared in.",

Powered by Google App Engine
This is Rietveld 408576698