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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 25006002: Emit compile-time error when a constant field is not initialized. (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 | tests/co19/co19-dart2dart.status » ('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 aba2213c581e3c1b60005ae7c3cca65202e2c4c1..1e03d331dc3579f3748e1b682b2a371efab11199 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -448,9 +448,14 @@ class ResolverTask extends CompilerTask {
ResolverVisitor visitor = visitorFor(element);
visitor.useElement(tree, element);
- // TODO(johnniwinther): Avoid analyzing initializers if
- // [Compiler.analyzeSignaturesOnly] is set.
- initializerDo(tree, visitor.visit);
+ SendSet send = tree.asSendSet();
+ if (send != null) {
+ if (!compiler.analyzeSignaturesOnly) {
+ visitor.visit(send.arguments.head);
+ }
+ } else if (element.modifiers.isConst()) {
+ compiler.reportError(element, MessageKind.CONST_WITHOUT_INITIALIZER);
+ }
if (Elements.isStaticOrTopLevelField(element)) {
if (tree.asSendSet() != null) {
« no previous file with comments | « no previous file | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698