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

Unified Diff: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart

Issue 1090593002: tree-ir: Always declare captured variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/compiler/lib/src/tree_ir/tree_ir_builder.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
index 0683911c095fc46bf697f617d93745040fc4257f..c67b2b58f287aec8466755c4a07e8ed16e0fc5f9 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
@@ -69,9 +69,6 @@ class Builder implements cps_ir.Visitor<Node> {
cps_ir.Parameter thisParameter;
cps_ir.Continuation returnContinuation;
- /// Number of loops enclosing the currently visited node.
- int enclosingLoops = 0;
-
Builder parent;
Builder(this.internalError, [this.parent]);
@@ -476,7 +473,7 @@ class Builder implements cps_ir.Visitor<Node> {
Statement body = visit(node.body);
// If the variable was captured by an inner function in the body, this
// must be declared here so we assign to a fresh copy of the variable.
- if (variable.isCaptured && enclosingLoops > 0) {
+ if (variable.isCaptured) {
return new VariableDeclaration(variable, value, body);
}
return Assign.makeStatement(variable, value, body);
@@ -543,7 +540,7 @@ class Builder implements cps_ir.Visitor<Node> {
if (cont.isRecursive) {
return node.isRecursive
? new Continue(labels[cont])
- : new WhileTrue(labels[cont], makeLoopBody(cont.body));
+ : new WhileTrue(labels[cont], visit(cont.body));
} else {
if (cont.hasExactlyOneUse) {
if (safeForInlining.contains(cont)) {
@@ -557,13 +554,6 @@ class Builder implements cps_ir.Visitor<Node> {
}
}
- Statement makeLoopBody(cps_ir.Expression body) {
- ++enclosingLoops;
- Statement result = visit(body);
- --enclosingLoops;
- return result;
- }
-
Statement visitBranch(cps_ir.Branch node) {
Expression condition = visit(node.condition);
Statement thenStatement, elseStatement;
« 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