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

Unified Diff: dart/frog/leg/ssa/closure.dart

Issue 9836022: No globals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Nicolas' comment by doing horrible things ;-) Created 8 years, 9 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 | « dart/frog/leg/ssa/builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/ssa/closure.dart
diff --git a/dart/frog/leg/ssa/closure.dart b/dart/frog/leg/ssa/closure.dart
index ad364e758fd42b8202192e05921d335dd877646d..ab2d6a48c541bdbf94572232acce6b9d99a23635 100644
--- a/dart/frog/leg/ssa/closure.dart
+++ b/dart/frog/leg/ssa/closure.dart
@@ -79,19 +79,12 @@ class ClosureData {
bool isClosure() => closureElement !== null;
}
-Map<Node, ClosureData> _closureDataCache;
-Map<Node, ClosureData> get closureDataCache() {
- if (_closureDataCache === null) {
- _closureDataCache = new HashMap<Node, ClosureData>();
- }
- return _closureDataCache;
-}
-
class ClosureTranslator extends AbstractVisitor {
final Compiler compiler;
final TreeElements elements;
int boxCounter = 0;
bool inTryCatchOrFinally = false;
+ final Map<Node, ClosureData> closureDataCache;
// Map of captured variables. Initially they will map to themselves. If
// a variable needs to be boxed then the scope declaring the variable
@@ -109,9 +102,11 @@ class ClosureTranslator extends AbstractVisitor {
bool insideClosure = false;
- ClosureTranslator(this.compiler, this.elements)
+ ClosureTranslator(Compiler compiler, this.elements)
: capturedVariableMapping = new Map<Element, Element>(),
- closures = <FunctionExpression>[];
+ closures = <FunctionExpression>[],
+ this.compiler = compiler,
+ this.closureDataCache = compiler.builder.closureDataCache;
ClosureData translate(Node node) {
// Closures have already been analyzed when visiting the surrounding
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698