Index: pkg/kernel/lib/transformations/closure/converter.dart |
diff --git a/pkg/kernel/lib/transformations/closure/converter.dart b/pkg/kernel/lib/transformations/closure/converter.dart |
index 42def515583d11852bb3139399e9ea55655981c2..12b42dd452a05d17f412b7d883941f6c21adf378 100644 |
--- a/pkg/kernel/lib/transformations/closure/converter.dart |
+++ b/pkg/kernel/lib/transformations/closure/converter.dart |
@@ -6,6 +6,7 @@ library kernel.transformations.closure.converter; |
import '../../ast.dart' |
show |
+ AsyncMarker, |
Arguments, |
Block, |
Catch, |
@@ -346,7 +347,12 @@ class ClosureConverter extends Transformer { |
return node; |
} |
- Expression handleLocalFunction(FunctionNode function) { |
+ Expression handleLocalFunction(FunctionNode function, [bool nope]) { |
Dmitry Stefantsov
2017/08/24 09:41:13
Is [nope] used anywhere? If not, I suggest removi
sjindel
2017/08/24 11:11:43
This was just some vestigial debugging code.
|
+ nope ??= false; |
+ if (function.asyncMarker != AsyncMarker.Sync || nope) { |
+ function.transformChildren(this); |
+ return new FunctionExpression(function); |
+ } |
FunctionNode enclosingFunction = currentFunction; |
Map<TypeParameter, DartType> enclosingTypeSubstitution = typeSubstitution; |
currentFunction = function; |
@@ -554,6 +560,11 @@ class ClosureConverter extends Transformer { |
TreeNode visitBlock(Block node) { |
return saveContext(() { |
BlockRewriter blockRewriter = rewriter = rewriter.forNestedBlock(node); |
+ if (node.parent is Statement && |
+ (node.parent as Statement).isLoop && |
+ context is! NoContext) { |
+ context = context.toNestedContext(); |
+ } |
blockRewriter.transformStatements(this); |
return node; |
}); |