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

Side by Side 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, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element get currentElement; 8 Element get currentElement;
9 Set<Node> get superUses; 9 Set<Node> get superUses;
10 10
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 TreeElements resolveField(VariableElement element) { 442 TreeElements resolveField(VariableElement element) {
443 Node tree = element.parseNode(compiler); 443 Node tree = element.parseNode(compiler);
444 if(element.modifiers.isStatic() && element.variables.isTopLevel()) { 444 if(element.modifiers.isStatic() && element.variables.isTopLevel()) {
445 error(element.modifiers.getStatic(), 445 error(element.modifiers.getStatic(),
446 MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC); 446 MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC);
447 } 447 }
448 ResolverVisitor visitor = visitorFor(element); 448 ResolverVisitor visitor = visitorFor(element);
449 visitor.useElement(tree, element); 449 visitor.useElement(tree, element);
450 450
451 // TODO(johnniwinther): Avoid analyzing initializers if 451 SendSet send = tree.asSendSet();
452 // [Compiler.analyzeSignaturesOnly] is set. 452 if (send != null) {
453 initializerDo(tree, visitor.visit); 453 if (!compiler.analyzeSignaturesOnly) {
454 visitor.visit(send.arguments.head);
455 }
456 } else if (element.modifiers.isConst()) {
457 compiler.reportError(element, MessageKind.CONST_WITHOUT_INITIALIZER);
458 }
454 459
455 if (Elements.isStaticOrTopLevelField(element)) { 460 if (Elements.isStaticOrTopLevelField(element)) {
456 if (tree.asSendSet() != null) { 461 if (tree.asSendSet() != null) {
457 // TODO(13429): We could do better here by using the 462 // TODO(13429): We could do better here by using the
458 // constant handler to figure out if it's a lazy field or not. 463 // constant handler to figure out if it's a lazy field or not.
459 compiler.backend.registerLazyField(visitor.mapping); 464 compiler.backend.registerLazyField(visitor.mapping);
460 } else { 465 } else {
461 compiler.enqueuer.resolution.registerInstantiatedClass( 466 compiler.enqueuer.resolution.registerInstantiatedClass(
462 compiler.nullClass, visitor.mapping); 467 compiler.nullClass, visitor.mapping);
463 } 468 }
(...skipping 3918 matching lines...) Expand 10 before | Expand all | Expand 10 after
4382 return e; 4387 return e;
4383 } 4388 }
4384 4389
4385 /// Assumed to be called by [resolveRedirectingFactory]. 4390 /// Assumed to be called by [resolveRedirectingFactory].
4386 Element visitReturn(Return node) { 4391 Element visitReturn(Return node) {
4387 Node expression = node.expression; 4392 Node expression = node.expression;
4388 return finishConstructorReference(visit(expression), 4393 return finishConstructorReference(visit(expression),
4389 expression, expression); 4394 expression, expression);
4390 } 4395 }
4391 } 4396 }
OLDNEW
« 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