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 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 number_of_arguments); | 2812 number_of_arguments); |
2813 if (result.IsError()) { | 2813 if (result.IsError()) { |
2814 return Api::NewHandle(isolate, result.raw()); | 2814 return Api::NewHandle(isolate, result.raw()); |
2815 } | 2815 } |
2816 ASSERT(result.IsFunction()); | 2816 ASSERT(result.IsFunction()); |
2817 Function& constructor = Function::Handle(isolate); | 2817 Function& constructor = Function::Handle(isolate); |
2818 constructor ^= result.raw(); | 2818 constructor ^= result.raw(); |
2819 | 2819 |
2820 Instance& new_object = Instance::Handle(isolate); | 2820 Instance& new_object = Instance::Handle(isolate); |
2821 if (constructor.IsRedirectingFactory()) { | 2821 if (constructor.IsRedirectingFactory()) { |
2822 Type& type = Type::Handle(constructor.RedirectionType()); | 2822 ClassFinalizer::ResolveRedirectingFactory(cls, constructor); |
| 2823 const Type& type = Type::Handle(constructor.RedirectionType()); |
| 2824 constructor = constructor.RedirectionTarget(); |
| 2825 if (constructor.IsNull()) { |
| 2826 ASSERT(type.IsMalformed()); |
| 2827 return Api::NewHandle(isolate, type.malformed_error()); |
| 2828 } |
2823 cls = type.type_class(); | 2829 cls = type.type_class(); |
2824 constructor = constructor.RedirectionTarget(); | |
2825 } | 2830 } |
2826 if (constructor.IsConstructor()) { | 2831 if (constructor.IsConstructor()) { |
2827 // Create the new object. | 2832 // Create the new object. |
2828 new_object = Instance::New(cls); | 2833 new_object = Instance::New(cls); |
2829 } | 2834 } |
2830 | 2835 |
2831 // Create the argument list. | 2836 // Create the argument list. |
2832 intptr_t arg_index = 0; | 2837 intptr_t arg_index = 0; |
2833 int extra_args = (constructor.IsConstructor() ? 2 : 1); | 2838 int extra_args = (constructor.IsConstructor() ? 2 : 1); |
2834 const Array& args = | 2839 const Array& args = |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4070 } | 4075 } |
4071 { | 4076 { |
4072 NoGCScope no_gc; | 4077 NoGCScope no_gc; |
4073 RawObject* raw_obj = obj.raw(); | 4078 RawObject* raw_obj = obj.raw(); |
4074 isolate->heap()->SetPeer(raw_obj, peer); | 4079 isolate->heap()->SetPeer(raw_obj, peer); |
4075 } | 4080 } |
4076 return Api::Success(); | 4081 return Api::Success(); |
4077 } | 4082 } |
4078 | 4083 |
4079 } // namespace dart | 4084 } // namespace dart |
OLD | NEW |