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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/resolution/scope.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 bf5708560af5300a54bd8431d2283ff5765bb882..50539abb481bd7a78bce141af6597f3ec0ed2b49 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -3758,7 +3758,15 @@ class VariableDefinitionsVisitor extends CommonResolverVisitor<SourceString> {
SourceString visitSendSet(SendSet node) {
assert(node.arguments.tail.isEmpty); // Sanity check
- resolver.visit(node.arguments.head);
+ Identifier identifier = node.selector;
+ SourceString name = identifier.source;
+ VariableDefinitionScope scope =
+ new VariableDefinitionScope(resolver.scope, name);
+ resolver.visitIn(node.arguments.head, scope);
+ if (scope.variableReferencedInInitializer) {
+ resolver.error(identifier, MessageKind.REFERENCE_IN_INITIALIZATION,
+ {'variableName': name.toString()});
+ }
return visit(node.selector);
}
« 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