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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/scope.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
Index: sdk/lib/_internal/compiler/implementation/resolution/scope.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/scope.dart b/sdk/lib/_internal/compiler/implementation/resolution/scope.dart
index 0af9fd78b325db9e25abd819366a322b2e4fb601..81eadaebbfd52814cf78aa4811fd73e8ee023b46 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/scope.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/scope.dart
@@ -41,6 +41,24 @@ abstract class NestedScope extends Scope {
}
}
+class VariableDefinitionScope extends NestedScope {
+ final SourceString variableName;
+ bool variableReferencedInInitializer = false;
+
+ VariableDefinitionScope(Scope parent, this.variableName) : super(parent);
+
+ Element localLookup(SourceString name) {
+ if (name == variableName) {
+ variableReferencedInInitializer = true;
+ }
+ return null;
+ }
+
+ Element add(Element newElement) {
+ throw "Cannot add element to VariableDefinitionScope";
+ }
+}
+
/**
* [TypeDeclarationScope] defines the outer scope of a type declaration in
* which the declared type variables and the entities in the enclosing scope are

Powered by Google App Engine
This is Rietveld 408576698