| Index: dart/runtime/vm/object.cc
|
| ===================================================================
|
| --- dart/runtime/vm/object.cc (revision 29802)
|
| +++ dart/runtime/vm/object.cc (working copy)
|
| @@ -4227,6 +4227,21 @@
|
| }
|
|
|
|
|
| +RawField* Function::saved_static_field() const {
|
| + ASSERT(kind() == RawFunction::kStaticInitializer);
|
| + const Object& obj = Object::Handle(raw_ptr()->data_);
|
| + ASSERT(obj.IsField());
|
| + return Field::Cast(obj).raw();
|
| +}
|
| +
|
| +
|
| +void Function::set_saved_static_field(const Field& value) const {
|
| + ASSERT(kind() == RawFunction::kStaticInitializer);
|
| + ASSERT(raw_ptr()->data_ == Object::null());
|
| + set_data(value);
|
| +}
|
| +
|
| +
|
| RawFunction* Function::parent_function() const {
|
| if (IsClosureFunction()) {
|
| const Object& obj = Object::Handle(raw_ptr()->data_);
|
| @@ -5454,10 +5469,9 @@
|
| }
|
|
|
|
|
| -RawFunction* Function::NewStaticInitializer(const String& field_name,
|
| - const AbstractType& result_type,
|
| - const Class& cls,
|
| - intptr_t initializer_pos) {
|
| +RawFunction* Function::NewStaticInitializer(const Field& field) {
|
| + ASSERT(field.is_static());
|
| + const String& field_name = String::Handle(field.name());
|
| const String& init_name =
|
| String::Handle(Symbols::New(String::Handle(
|
| String::Concat(Symbols::InitPrefix(), field_name))));
|
| @@ -5468,9 +5482,9 @@
|
| false, // !const
|
| false, // !abstract
|
| false, // !external
|
| - cls,
|
| - initializer_pos));
|
| - init_function.set_result_type(result_type);
|
| + Class::Handle(field.owner()),
|
| + field.token_pos()));
|
| + init_function.set_result_type(AbstractType::Handle(field.type()));
|
| // Static initializer functions are generated by the VM and are therfore
|
| // hidden from the user. Since they are only executed once, we avoid
|
| // optimizing and inlining them. After the field is initialized, the
|
| @@ -5479,6 +5493,7 @@
|
| init_function.set_is_visible(false);
|
| init_function.set_is_optimizable(false);
|
| init_function.set_is_inlinable(false);
|
| + init_function.set_saved_static_field(field);
|
| return init_function.raw();
|
| }
|
|
|
|
|