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..ef7905690bb190a92eb9759feb822292821dd883 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,7 +102,7 @@ class ClosureTranslator extends AbstractVisitor { |
bool insideClosure = false; |
- ClosureTranslator(this.compiler, this.elements) |
+ ClosureTranslator(this.compiler, this.elements, this.closureDataCache) |
: capturedVariableMapping = new Map<Element, Element>(), |
closures = <FunctionExpression>[]; |