Index: runtime/vm/object.cc |
=================================================================== |
--- runtime/vm/object.cc (revision 29562) |
+++ runtime/vm/object.cc (working copy) |
@@ -4224,7 +4224,9 @@ |
RawFunction* Function::implicit_closure_function() const { |
- if (IsClosureFunction() || IsSignatureFunction()) { |
+ if (IsClosureFunction() || |
+ IsSignatureFunction() || |
+ IsStaticInitializerFunction()) { |
return Function::null(); |
} |
const Object& obj = Object::Handle(raw_ptr()->data_); |
@@ -5427,6 +5429,30 @@ |
} |
+RawFunction* Function::NewStaticInitializer(const String& field_name, |
+ const AbstractType& result_type, |
+ const Class& cls, |
+ intptr_t initializer_pos) { |
+ const String& init_name = |
+ String::Handle(Symbols::New(String::Handle( |
+ String::Concat(Symbols::InitPrefix(), field_name)))); |
srdjan
2013/10/30 17:54:15
Indent another 4 spaces
Florian Schneider
2013/10/31 16:34:53
Done.
|
+ const Function& init_function = Function::ZoneHandle( |
+ Function::New(init_name, |
+ RawFunction::kStaticInitializer, |
+ true, // static |
+ false, // !const |
+ false, // !abstract |
+ false, // !external |
+ cls, |
+ initializer_pos)); |
+ init_function.set_result_type(result_type); |
srdjan
2013/10/30 17:54:15
Please add a comment describing the special settin
Florian Schneider
2013/10/31 16:34:53
Done.
|
+ init_function.set_is_visible(false); |
+ init_function.set_is_optimizable(false); |
+ init_function.set_is_inlinable(false); |
+ return init_function.raw(); |
+} |
+ |
+ |
const char* Function::ToCString() const { |
const char* static_str = is_static() ? " static" : ""; |
const char* abstract_str = is_abstract() ? " abstract" : ""; |
@@ -5451,6 +5477,9 @@ |
case RawFunction::kImplicitSetter: |
kind_str = " setter"; |
break; |
+ case RawFunction::kStaticInitializer: |
+ kind_str = " static-initializer"; |
+ break; |
case RawFunction::kImplicitStaticFinalGetter: |
kind_str = " static-final-getter"; |
break; |
@@ -5522,6 +5551,9 @@ |
case RawFunction::kConstructor: |
kind_string = "constructor"; |
break; |
+ case RawFunction::kStaticInitializer: |
+ kind_string = "static initializer"; |
+ break; |
case RawFunction::kImplicitStaticFinalGetter: |
kind_string = "static final getter"; |
break; |