Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 40fc1b7d493c1cd948df846dd8975645efac5334..4542f6ddf04a4de104b25b321abe50f2144c756f 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -1436,6 +1436,7 @@ bool Class::HasInstanceFields() const { |
return false; |
} |
+ |
void Class::SetFunctions(const Array& value) const { |
ASSERT(!value.IsNull()); |
#if defined(DEBUG) |
@@ -1451,6 +1452,14 @@ void Class::SetFunctions(const Array& value) const { |
} |
+void Class::AddFunction(const Function& function) const { |
+ const Array& arr = Array::Handle(functions()); |
+ const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1)); |
+ new_arr.SetAt(arr.Length(), function); |
+ SetFunctions(new_arr); |
+} |
+ |
+ |
void Class::AddClosureFunction(const Function& function) const { |
GrowableObjectArray& closures = |
GrowableObjectArray::Handle(raw_ptr()->closure_functions_); |
@@ -3220,6 +3229,21 @@ void Function::set_closure_allocation_stub(const Code& value) const { |
} |
+RawFunction* Function::extracted_method_closure() const { |
+ ASSERT(kind() == RawFunction::kMethodExtractor); |
+ const Object& obj = Object::Handle(raw_ptr()->data_); |
+ ASSERT(obj.IsFunction()); |
+ return Function::Cast(obj).raw(); |
+} |
+ |
+ |
+void Function::set_extracted_method_closure(const Function& value) const { |
+ ASSERT(kind() == RawFunction::kMethodExtractor); |
+ ASSERT(raw_ptr()->data_ == Object::null()); |
+ set_data(value); |
+} |
+ |
+ |
RawFunction* Function::parent_function() const { |
if (IsClosureFunction()) { |
const Object& obj = Object::Handle(raw_ptr()->data_); |
@@ -4309,6 +4333,9 @@ const char* Function::ToCString() const { |
case RawFunction::kConstImplicitGetter: |
kind_str = " const-getter"; |
break; |
+ case RawFunction::kMethodExtractor: |
+ kind_str = " method-extractor"; |
+ break; |
default: |
UNREACHABLE(); |
} |