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

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

Issue 23979004: Check for uninitialized constant variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('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 3894 matching lines...) Expand 10 before | Expand all | Expand 10 after
3905 assert(node.arguments.tail.isEmpty); // Sanity check 3905 assert(node.arguments.tail.isEmpty); // Sanity check
3906 Identifier identifier = node.selector; 3906 Identifier identifier = node.selector;
3907 SourceString name = identifier.source; 3907 SourceString name = identifier.source;
3908 VariableDefinitionScope scope = 3908 VariableDefinitionScope scope =
3909 new VariableDefinitionScope(resolver.scope, name); 3909 new VariableDefinitionScope(resolver.scope, name);
3910 resolver.visitIn(node.arguments.head, scope); 3910 resolver.visitIn(node.arguments.head, scope);
3911 if (scope.variableReferencedInInitializer) { 3911 if (scope.variableReferencedInInitializer) {
3912 resolver.error(identifier, MessageKind.REFERENCE_IN_INITIALIZATION, 3912 resolver.error(identifier, MessageKind.REFERENCE_IN_INITIALIZATION,
3913 {'variableName': name.toString()}); 3913 {'variableName': name.toString()});
3914 } 3914 }
3915 return visit(node.selector); 3915 return name;
3916 } 3916 }
3917 3917
3918 SourceString visitIdentifier(Identifier node) { 3918 SourceString visitIdentifier(Identifier node) {
3919 // The variable is initialized to null. 3919 // The variable is initialized to null.
3920 resolver.world.registerInstantiatedClass(compiler.nullClass, 3920 resolver.world.registerInstantiatedClass(compiler.nullClass,
3921 resolver.mapping); 3921 resolver.mapping);
3922 if (definitions.modifiers.isConst()) {
3923 compiler.reportError(node, MessageKind.CONST_WITHOUT_INITIALIZER);
3924 }
3922 return node.source; 3925 return node.source;
3923 } 3926 }
3924 3927
3925 visitNodeList(NodeList node) { 3928 visitNodeList(NodeList node) {
3926 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { 3929 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) {
3927 SourceString name = visit(link.head); 3930 SourceString name = visit(link.head);
3928 VariableElement element = 3931 VariableElement element =
3929 new VariableElementX(name, variables, kind, link.head); 3932 new VariableElementX(name, variables, kind, link.head);
3930 resolver.defineElement(link.head, element); 3933 resolver.defineElement(link.head, element);
3931 } 3934 }
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
4319 return e; 4322 return e;
4320 } 4323 }
4321 4324
4322 /// Assumed to be called by [resolveRedirectingFactory]. 4325 /// Assumed to be called by [resolveRedirectingFactory].
4323 Element visitReturn(Return node) { 4326 Element visitReturn(Return node) {
4324 Node expression = node.expression; 4327 Node expression = node.expression;
4325 return finishConstructorReference(visit(expression), 4328 return finishConstructorReference(visit(expression),
4326 expression, expression); 4329 expression, expression);
4327 } 4330 }
4328 } 4331 }
OLDNEW
« 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