Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/closure.dart |
| =================================================================== |
| --- sdk/lib/_internal/compiler/implementation/closure.dart (revision 19427) |
| +++ sdk/lib/_internal/compiler/implementation/closure.dart (working copy) |
| @@ -193,9 +193,11 @@ |
| bool isClosure() => closureElement != null; |
| - bool captures(Element element) => freeVariableMapping.containsKey(element); |
| + bool isVariableCaptured(Element element) { |
| + freeVariableMapping.containsKey(element); |
| + } |
| - bool mutates(Element element) { |
| + bool isVariableBoxed(Element element) { |
| Element copy = freeVariableMapping[element]; |
| return copy != null && !copy.isMember(); |
| } |
| @@ -206,6 +208,21 @@ |
| f(variable); |
| }); |
| } |
| + |
| + void forEachBoxedVariable(void f(Element element)) { |
|
karlklose
2013/03/05 09:57:24
Is this function used?
ngeoffray
2013/03/05 10:18:45
No, but I'd like to come up with some abstractions
|
| + freeVariableMapping.forEach((variable, copy) { |
| + if (!isVariableBoxed(variable)) return; |
| + f(variable); |
| + }); |
| + } |
| + |
| + void forEachNonBoxedCapturedVariable(void f(Element element)) { |
| + freeVariableMapping.forEach((variable, copy) { |
| + if (variable is BoxElement) return; |
| + if (isVariableBoxed(variable)) return; |
| + f(variable); |
| + }); |
| + } |
| } |
| class ClosureTranslator extends Visitor { |