| 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;
|
| + }
|
| +}
|
|
|