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

Unified Diff: sdk/lib/_internal/compiler/implementation/closure.dart

Issue 12385076: Infer types of catpured variables and use the types in the SSA builder. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698