Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 150be3ed8b4df78464ebf9ee893868e3a62f4803..b178ae0145a3c10ddcd0fd75b2185d46a20a435f 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -6511,6 +6511,21 @@ RawInstance* Function::ImplicitStaticClosure() const { |
} |
+RawInstance* Function::ImplicitInstanceClosure(const Instance& receiver) const { |
+ ASSERT(IsImplicitClosureFunction()); |
+ const Class& cls = Class::Handle(signature_class()); |
+ const Context& context = Context::Handle(Context::New(1)); |
+ context.SetAt(0, receiver); |
+ const Instance& result = Instance::Handle(Closure::New(*this, context)); |
+ if (cls.NumTypeArguments() > 0) { |
+ const TypeArguments& type_arguments = |
+ TypeArguments::Handle(receiver.GetTypeArguments()); |
+ result.SetTypeArguments(type_arguments); |
+ } |
+ return result.raw(); |
+} |
+ |
+ |
RawString* Function::BuildSignature(bool instantiate, |
NameVisibility name_visibility, |
const TypeArguments& instantiator) const { |