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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 2595674855ccde764ab95078df4959167a7e795f..cd68ae9a1e5c9f61fbba7654d5b353bca818bac4 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -449,12 +449,16 @@ class ResolverTask extends CompilerTask {
visitor.useElement(tree, element);
SendSet send = tree.asSendSet();
+ Modifiers modifiers = element.modifiers;
if (send != null) {
// TODO(johnniwinther): Avoid analyzing initializers if
// [Compiler.analyzeSignaturesOnly] is set.
visitor.visit(send.arguments.head);
- } else if (element.modifiers.isConst()) {
+ } else if (modifiers.isConst()) {
compiler.reportError(element, MessageKind.CONST_WITHOUT_INITIALIZER);
+ } else if (modifiers.isStatic() && modifiers.isFinal()) {
+ compiler.reportError(element,
kasperl 2013/10/02 12:17:02 Shouldn't this be a warning?
+ MessageKind.STATIC_FINAL_WITHOUT_INITIALIZER);
}
if (Elements.isStaticOrTopLevelField(element)) {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698