Index: runtime/vm/kernel.h |
diff --git a/runtime/vm/kernel.h b/runtime/vm/kernel.h |
index a6aae20ab6bcee7f1ee26b821c1be80174242be3..227a225ce9854f202454ad3eb59a13f58a5a7d82 100644 |
--- a/runtime/vm/kernel.h |
+++ b/runtime/vm/kernel.h |
@@ -935,7 +935,12 @@ class FunctionNode : public TreeNode { |
DartType* return_type() { return return_type_; } |
Statement* body() { return body_; } |
- void set_body(Statement* body) { body_ = body; } |
+ void ReplaceBody(Statement* body) { |
+ delete body_; |
+ // Use static_cast to invoke the conversion function and so avoid triggering |
+ // ASSERT(pointer_ == NULL) in operator= when overwriting a non-NULL body. |
+ static_cast<Statement*&>(body_) = body; |
+ } |
TokenPosition position() { return position_; } |
TokenPosition end_position() { return end_position_; } |