Index: pkg/compiler/lib/src/native/js.dart |
diff --git a/pkg/compiler/lib/src/native/js.dart b/pkg/compiler/lib/src/native/js.dart |
index 7dc7d70f32e36a24edcc31607e8989fbf5f27e33..5d1d37b8e06abee7fa4059de4c47c6e054018fb8 100644 |
--- a/pkg/compiler/lib/src/native/js.dart |
+++ b/pkg/compiler/lib/src/native/js.dart |
@@ -4,6 +4,35 @@ |
part of native; |
+ |
+class HasCapturedPlaceholders extends js.BaseVisitor { |
+ |
+ HasCapturedPlaceholders._(); |
+ |
+ static bool check(js.Node node) { |
+ HasCapturedPlaceholders visitor = new HasCapturedPlaceholders._(); |
+ node.accept(visitor); |
+ return visitor.found; |
+ } |
+ |
+ int enclosingFunctions = 0; |
+ bool found = false; |
+ |
+ @override |
+ visitFun(js.Fun node) { |
+ ++enclosingFunctions; |
+ node.visitChildren(this); |
+ --enclosingFunctions; |
+ } |
+ |
+ @override |
+ visitInterpolatedNode(js.InterpolatedNode node) { |
+ if (enclosingFunctions > 0) { |
+ found = true; |
+ } |
+ } |
+} |
+ |
class SideEffectsVisitor extends js.BaseVisitor { |
final SideEffects sideEffects; |
SideEffectsVisitor(this.sideEffects); |