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

Unified Diff: pkg/kernel/lib/transformations/closure/invalidate_closures.dart

Issue 2639253003: Handle constructor bodies (Closed)
Patch Set: Created 3 years, 11 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
Index: pkg/kernel/lib/transformations/closure/invalidate_closures.dart
diff --git a/pkg/kernel/lib/transformations/closure/invalidate_closures.dart b/pkg/kernel/lib/transformations/closure/invalidate_closures.dart
new file mode 100644
index 0000000000000000000000000000000000000000..96e281e2b1990a992f4c53fb8f42f621aa00bd88
--- /dev/null
+++ b/pkg/kernel/lib/transformations/closure/invalidate_closures.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library kernel.transformations.closure.invalidate;
+
+import '../../ast.dart';
+
+class InvalidateClosures extends Transformer {
+ FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) {
+ invalidate(node.function);
+ return node;
+ }
+
+ FunctionExpression visitFunctionExpression(FunctionExpression node) {
+ invalidate(node.function);
+ return node;
+ }
+
+ void invalidate(FunctionNode function) {
+ var position = function.location;
+ function.body = new ExpressionStatement(new Throw(
+ new StringLiteral("Calling unconverted closure at $position")))
+ ..parent = function;
+ }
+}
« no previous file with comments | « pkg/kernel/lib/transformations/closure/converter.dart ('k') | pkg/kernel/lib/transformations/closure_conversion.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698