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

Unified Diff: pkg/kernel/lib/interpreter/interpreter.dart

Issue 2980483002: Modify environment binding to bind variable declarations to locations (Closed)
Patch Set: Make location final Created 3 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/interpreter/interpreter.dart
diff --git a/pkg/kernel/lib/interpreter/interpreter.dart b/pkg/kernel/lib/interpreter/interpreter.dart
index 73330c1b15e9da5f9b846f9085bad20bb465094f..121709d4145f5ff0dae14b8e7f6c6c501473b9b2 100644
--- a/pkg/kernel/lib/interpreter/interpreter.dart
+++ b/pkg/kernel/lib/interpreter/interpreter.dart
@@ -36,11 +36,17 @@ class Interpreter {
}
}
+class Location {
+ Value value;
+
+ Location(this.value);
+}
+
class Binding {
final VariableDeclaration variable;
- Value value;
+ final Location location;
- Binding(this.variable, this.value);
+ Binding(this.variable, this.location);
}
class Environment {
@@ -70,17 +76,17 @@ class Environment {
}
Value lookup(VariableDeclaration variable) {
- return lookupBinding(variable).value;
+ return lookupBinding(variable).location.value;
}
void assign(VariableDeclaration variable, Value value) {
assert(contains(variable));
- lookupBinding(variable).value = value;
+ lookupBinding(variable).location.value = value;
}
void expand(VariableDeclaration variable, Value value) {
assert(!contains(variable));
- bindings.add(new Binding(variable, value));
+ bindings.add(new Binding(variable, new Location(value)));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698