| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library kernel.transformations.closure.invalidate; |
| 6 |
| 7 import '../../ast.dart'; |
| 8 |
| 9 class InvalidateClosures extends Transformer { |
| 10 FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) { |
| 11 invalidate(node.function); |
| 12 return node; |
| 13 } |
| 14 |
| 15 FunctionExpression visitFunctionExpression(FunctionExpression node) { |
| 16 invalidate(node.function); |
| 17 return node; |
| 18 } |
| 19 |
| 20 void invalidate(FunctionNode function) { |
| 21 var position = function.location; |
| 22 function.body = new ExpressionStatement(new Throw( |
| 23 new StringLiteral("Calling unconverted closure at $position"))) |
| 24 ..parent = function; |
| 25 } |
| 26 } |
| OLD | NEW |