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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 70983002: Fixes issue 14742. Dart API may allocate objects without calling the constructor, this messes up th… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 30215)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -2960,6 +2960,21 @@
}
const Class& cls = Class::Handle(isolate, type_obj.type_class());
+ // Mark all fields as nullable.
+ Class& iterate_cls = Class::Handle(isolate, cls.raw());
+ Field& field = Field::Handle(isolate);
+ Array& fields = Array::Handle(isolate);
+ while (!iterate_cls.IsNull()) {
+ fields = iterate_cls.fields();
+ iterate_cls = iterate_cls.SuperClass();
+ for (int field_num = 0; field_num < fields.Length(); field_num++) {
+ field ^= fields.At(field_num);
+ if (field.is_static()) {
+ continue;
+ }
+ field.UpdateGuardedCidAndLength(Object::null_object());
+ }
+ }
// Allocate an object for the given class.
return Api::NewHandle(isolate, Instance::New(cls));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698