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

Unified Diff: pkg/compiler/lib/src/native/js.dart

Issue 1436263002: dart2js: Forbid # placeholders in JS function bodies. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698