OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library cps_ir.cps_fragment; | 5 library cps_ir.cps_fragment; |
6 | 6 |
7 import 'cps_ir_nodes.dart'; | 7 import 'cps_ir_nodes.dart'; |
8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
9 import '../universe/selector.dart' show Selector; | 9 import '../universe/selector.dart' show Selector; |
10 import '../types/types.dart' show TypeMask; | 10 import '../types/types.dart' show TypeMask; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 root.parent = node; | 307 root.parent = node; |
308 context.body = child; | 308 context.body = child; |
309 child.parent = context; | 309 child.parent = context; |
310 root = context = null; | 310 root = context = null; |
311 } | 311 } |
312 | 312 |
313 void insertAbove(InteriorExpression node) { | 313 void insertAbove(InteriorExpression node) { |
314 insertBelow(node.parent); | 314 insertBelow(node.parent); |
315 } | 315 } |
316 } | 316 } |
| 317 |
| 318 /// Removes [node], unlinking all its references and replaces it with [newNode]. |
| 319 void destroyAndReplace(Expression node, Expression newNode) { |
| 320 InteriorNode parent = node.parent; |
| 321 RemovalVisitor.remove(node); |
| 322 parent.body = newNode; |
| 323 newNode.parent = parent; |
| 324 } |
OLD | NEW |