Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Unified Diff: runtime/vm/parser.cc

Issue 1317753004: Eliminate LocalVarDescriptors in some corner cases (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 604e453cf044aeb41efcb2044b6fc9ad98a156d7..22df857e4b0737fca24cbb1c979534bed913ac3c 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -1152,15 +1152,21 @@ ParsedFunction* Parser::ParseStaticFieldInitializer(const Field& field) {
String& init_name = String::Handle(zone,
Symbols::FromConcat(Symbols::InitPrefix(), field_name));
+ Object& initializer_owner = Object::Handle(field.owner());
+ if (field.owner() != field.origin()) {
+ initializer_owner =
+ PatchClass::New(Class::Handle(field.owner()), script_cls);
+ }
+
const Function& initializer = Function::ZoneHandle(zone,
Function::New(init_name,
- RawFunction::kRegularFunction,
+ RawFunction::kImplicitStaticFinalGetter,
true, // static
false, // !const
false, // !abstract
false, // !external
false, // !native
- Class::Handle(field.owner()),
+ initializer_owner,
field.token_pos()));
initializer.set_result_type(AbstractType::Handle(zone, field.type()));
// Static initializer functions are hidden from the user.
@@ -1249,6 +1255,7 @@ SequenceNode* Parser::ParseStaticFinalGetter(const Function& func) {
const Class& field_class = Class::Handle(Z, func.Owner());
const Field& field =
Field::ZoneHandle(Z, field_class.LookupStaticField(field_name));
+ ASSERT(!field.IsNull());
// Static final fields must have an initializer.
ExpectToken(Token::kASSIGN);
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698