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

Unified Diff: runtime/vm/object.cc

Issue 1440753002: Include field reference with implicit getter / setter functions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index d902eedf4452ce83f36a7686f5953535c73cb355..9c22c9bc3b885131885b7fe2b7e80accc49338fc 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -5543,6 +5543,27 @@ void Function::set_saved_args_desc(const Array& value) const {
}
+RawField* Function::LookupImplicitGetterSetterField() const {
+ ASSERT((kind() == RawFunction::kImplicitGetter) ||
+ (kind() == RawFunction::kImplicitSetter) ||
+ (kind() == RawFunction::kImplicitStaticFinalGetter));
+ const Class& owner = Class::Handle(Owner());
+ ASSERT(!owner.IsNull());
+ const Array& fields = Array::Handle(owner.fields());
+ ASSERT(!fields.IsNull());
+ Field& field = Field::Handle();
+ for (intptr_t i = 0; i < fields.Length(); i++) {
+ field ^= fields.At(i);
+ ASSERT(!field.IsNull());
+ if (field.token_pos() == token_pos()) {
+ return field.raw();
+ }
+ }
+ return Field::null();
+}
+
+
+
RawFunction* Function::parent_function() const {
if (IsClosureFunction()) {
const Object& obj = Object::Handle(raw_ptr()->data_);
@@ -7299,6 +7320,14 @@ void Function::PrintJSONImpl(JSONStream* stream, bool ref) const {
jsobj.AddProperty("_optimizedCallSiteCount", optimized_call_site_count());
jsobj.AddProperty("_deoptimizations",
static_cast<intptr_t>(deoptimization_counter()));
+ if ((kind() == RawFunction::kImplicitGetter) ||
+ (kind() == RawFunction::kImplicitSetter) ||
+ (kind() == RawFunction::kImplicitStaticFinalGetter)) {
+ const Field& field = Field::Handle(LookupImplicitGetterSetterField());
+ if (!field.IsNull()) {
+ jsobj.AddProperty("_field", field);
+ }
+ }
const Script& script = Script::Handle(this->script());
if (!script.IsNull()) {
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698