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

Unified Diff: runtime/vm/object.cc

Issue 269253005: Put metadata fields in their owner class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index eacee907452c9dd40ac41472c7affd274327a0f1..80893aa1ff9a40276c28ebad85feb949a330399f 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -2794,6 +2794,14 @@ void Class::SetFields(const Array& value) const {
}
+void Class::AddField(const Field& field) const {
rmacnak 2014/05/08 01:35:21 Cf. AddFunction
+ const Array& arr = Array::Handle(fields());
+ const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1));
+ new_arr.SetAt(arr.Length(), field);
+ SetFields(new_arr);
+}
+
+
intptr_t Class::FindFieldIndex(const Field& needle) const {
Isolate* isolate = Isolate::Current();
if (EnsureIsFinalized(isolate) != Error::null()) {
@@ -8268,6 +8276,7 @@ void Library::AddMetadata(const Class& cls,
GrowableObjectArray& metadata =
GrowableObjectArray::Handle(this->metadata());
metadata.Add(field, Heap::kOld);
+ cls.AddField(field);
}
« runtime/vm/class_finalizer.cc ('K') | « runtime/vm/object.h ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698