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

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

Issue 24091002: Emit a compile-time error when the name of a variable is referenced in the (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update co19 test expectations. 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/resolution/scope.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 3740 matching lines...) Expand 10 before | Expand all | Expand 10 after
3751 3751
3752 VariableDefinitionsVisitor(Compiler compiler, 3752 VariableDefinitionsVisitor(Compiler compiler,
3753 this.definitions, this.resolver, this.kind) 3753 this.definitions, this.resolver, this.kind)
3754 : super(compiler) { 3754 : super(compiler) {
3755 variables = new VariableListElementX.node( 3755 variables = new VariableListElementX.node(
3756 definitions, ElementKind.VARIABLE_LIST, resolver.enclosingElement); 3756 definitions, ElementKind.VARIABLE_LIST, resolver.enclosingElement);
3757 } 3757 }
3758 3758
3759 SourceString visitSendSet(SendSet node) { 3759 SourceString visitSendSet(SendSet node) {
3760 assert(node.arguments.tail.isEmpty); // Sanity check 3760 assert(node.arguments.tail.isEmpty); // Sanity check
3761 resolver.visit(node.arguments.head); 3761 Identifier identifier = node.selector;
3762 SourceString name = identifier.source;
3763 VariableDefinitionScope scope =
3764 new VariableDefinitionScope(resolver.scope, name);
3765 resolver.visitIn(node.arguments.head, scope);
3766 if (scope.variableReferencedInInitializer) {
3767 resolver.error(identifier, MessageKind.REFERENCE_IN_INITIALIZATION,
3768 {'variableName': name.toString()});
3769 }
3762 return visit(node.selector); 3770 return visit(node.selector);
3763 } 3771 }
3764 3772
3765 SourceString visitIdentifier(Identifier node) { 3773 SourceString visitIdentifier(Identifier node) {
3766 // The variable is initialized to null. 3774 // The variable is initialized to null.
3767 resolver.world.registerInstantiatedClass(compiler.nullClass, 3775 resolver.world.registerInstantiatedClass(compiler.nullClass,
3768 resolver.mapping); 3776 resolver.mapping);
3769 return node.source; 3777 return node.source;
3770 } 3778 }
3771 3779
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
4166 return e; 4174 return e;
4167 } 4175 }
4168 4176
4169 /// Assumed to be called by [resolveRedirectingFactory]. 4177 /// Assumed to be called by [resolveRedirectingFactory].
4170 Element visitReturn(Return node) { 4178 Element visitReturn(Return node) {
4171 Node expression = node.expression; 4179 Node expression = node.expression;
4172 return finishConstructorReference(visit(expression), 4180 return finishConstructorReference(visit(expression),
4173 expression, expression); 4181 expression, expression);
4174 } 4182 }
4175 } 4183 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/resolution/scope.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698