| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 3041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3052 DARTSCOPE(isolate); | 3052 DARTSCOPE(isolate); |
| 3053 CHECK_CALLBACK_STATE(isolate); | 3053 CHECK_CALLBACK_STATE(isolate); |
| 3054 | 3054 |
| 3055 const Type& type_obj = Api::UnwrapTypeHandle(isolate, type); | 3055 const Type& type_obj = Api::UnwrapTypeHandle(isolate, type); |
| 3056 // Get the class to instantiate. | 3056 // Get the class to instantiate. |
| 3057 if (type_obj.IsNull()) { | 3057 if (type_obj.IsNull()) { |
| 3058 RETURN_TYPE_ERROR(isolate, type, Type); | 3058 RETURN_TYPE_ERROR(isolate, type, Type); |
| 3059 } | 3059 } |
| 3060 const Class& cls = Class::Handle(isolate, type_obj.type_class()); | 3060 const Class& cls = Class::Handle(isolate, type_obj.type_class()); |
| 3061 | 3061 |
| 3062 // Mark all fields as nullable. | 3062 if (!cls.is_fields_marked_nullable()) { |
| 3063 Class& iterate_cls = Class::Handle(isolate, cls.raw()); | 3063 // Mark all fields as nullable. |
| 3064 Field& field = Field::Handle(isolate); | 3064 Class& iterate_cls = Class::Handle(isolate, cls.raw()); |
| 3065 Array& fields = Array::Handle(isolate); | 3065 Field& field = Field::Handle(isolate); |
| 3066 while (!iterate_cls.IsNull()) { | 3066 Array& fields = Array::Handle(isolate); |
| 3067 fields = iterate_cls.fields(); | 3067 while (!iterate_cls.IsNull()) { |
| 3068 iterate_cls = iterate_cls.SuperClass(); | 3068 iterate_cls.set_is_fields_marked_nullable(); |
| 3069 for (int field_num = 0; field_num < fields.Length(); field_num++) { | 3069 fields = iterate_cls.fields(); |
| 3070 field ^= fields.At(field_num); | 3070 iterate_cls = iterate_cls.SuperClass(); |
| 3071 if (field.is_static()) { | 3071 for (int field_num = 0; field_num < fields.Length(); field_num++) { |
| 3072 continue; | 3072 field ^= fields.At(field_num); |
| 3073 if (field.is_static()) { |
| 3074 continue; |
| 3075 } |
| 3076 field.UpdateGuardedCidAndLength(Object::null_object()); |
| 3073 } | 3077 } |
| 3074 field.UpdateGuardedCidAndLength(Object::null_object()); | |
| 3075 } | 3078 } |
| 3076 } | 3079 } |
| 3080 |
| 3077 // Allocate an object for the given class. | 3081 // Allocate an object for the given class. |
| 3078 return Api::NewHandle(isolate, Instance::New(cls)); | 3082 return Api::NewHandle(isolate, Instance::New(cls)); |
| 3079 } | 3083 } |
| 3080 | 3084 |
| 3081 | 3085 |
| 3082 static Dart_Handle SetupArguments(Isolate* isolate, | 3086 static Dart_Handle SetupArguments(Isolate* isolate, |
| 3083 int num_args, | 3087 int num_args, |
| 3084 Dart_Handle* arguments, | 3088 Dart_Handle* arguments, |
| 3085 int extra_args, | 3089 int extra_args, |
| 3086 Array* args) { | 3090 Array* args) { |
| (...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4530 } | 4534 } |
| 4531 | 4535 |
| 4532 | 4536 |
| 4533 // --- Service support --- | 4537 // --- Service support --- |
| 4534 | 4538 |
| 4535 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { | 4539 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { |
| 4536 return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); | 4540 return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); |
| 4537 } | 4541 } |
| 4538 | 4542 |
| 4539 } // namespace dart | 4543 } // namespace dart |
| OLD | NEW |