Index: runtime/vm/object_reload.cc |
diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc |
index 046333438cb6f655df89e1730501f5610f1865ed..62a983543f5c14285da60195b28897e94325c890 100644 |
--- a/runtime/vm/object_reload.cc |
+++ b/runtime/vm/object_reload.cc |
@@ -363,6 +363,32 @@ void Class::PatchFieldsAndFunctions() const { |
} |
+void Class::MigrateImplicitStaticClosures(IsolateReloadContext* irc, |
+ const Class& new_cls) const { |
+ const Array& funcs = Array::Handle(functions()); |
+ Function& old_func = Function::Handle(); |
+ String& selector = String::Handle(); |
+ Function& new_func = Function::Handle(); |
+ Instance& old_closure = Instance::Handle(); |
+ Instance& new_closure = Instance::Handle(); |
+ for (intptr_t i = 0; i < funcs.Length(); i++) { |
+ old_func ^= funcs.At(i); |
+ if (old_func.is_static() && |
+ old_func.HasImplicitClosureFunction()) { |
+ selector = old_func.name(); |
+ new_func = new_cls.LookupFunction(selector); |
+ if (!new_func.IsNull() && new_func.is_static()) { |
+ old_func = old_func.ImplicitClosureFunction(); |
+ old_closure = old_func.ImplicitStaticClosure(); |
+ new_func = new_func.ImplicitClosureFunction(); |
+ new_closure = new_func.ImplicitStaticClosure(); |
+ irc->AddBecomeMapping(old_closure, new_closure); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
class EnumClassConflict : public ClassReasonForCancelling { |
public: |
EnumClassConflict(const Class& from, const Class& to) |