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 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 return Api::ClassId(object) == kLibraryCid; | 1297 return Api::ClassId(object) == kLibraryCid; |
1298 } | 1298 } |
1299 | 1299 |
1300 | 1300 |
1301 DART_EXPORT bool Dart_IsType(Dart_Handle handle) { | 1301 DART_EXPORT bool Dart_IsType(Dart_Handle handle) { |
1302 TRACE_API_CALL(CURRENT_FUNC); | 1302 TRACE_API_CALL(CURRENT_FUNC); |
1303 return Api::ClassId(handle) == kTypeCid; | 1303 return Api::ClassId(handle) == kTypeCid; |
1304 } | 1304 } |
1305 | 1305 |
1306 | 1306 |
1307 DART_EXPORT bool Dart_IsClass(Dart_Handle handle) { | |
1308 Isolate* isolate = Isolate::Current(); | |
1309 DARTSCOPE(isolate); | |
1310 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); | |
1311 return obj.IsClass(); | |
1312 } | |
1313 | |
1314 | |
1315 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle) { | 1307 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle) { |
1316 TRACE_API_CALL(CURRENT_FUNC); | 1308 TRACE_API_CALL(CURRENT_FUNC); |
1317 return Api::ClassId(handle) == kFunctionCid; | 1309 return Api::ClassId(handle) == kFunctionCid; |
1318 } | 1310 } |
1319 | 1311 |
1320 | 1312 |
1321 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle) { | 1313 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle) { |
1322 TRACE_API_CALL(CURRENT_FUNC); | 1314 TRACE_API_CALL(CURRENT_FUNC); |
1323 return Api::ClassId(handle) == kFieldCid; | 1315 return Api::ClassId(handle) == kFieldCid; |
1324 } | 1316 } |
(...skipping 24 matching lines...) Expand all Loading... |
1349 if (obj.IsNull()) { | 1341 if (obj.IsNull()) { |
1350 return Api::NewHandle(isolate, isolate->object_store()->null_type()); | 1342 return Api::NewHandle(isolate, isolate->object_store()->null_type()); |
1351 } | 1343 } |
1352 if (!obj.IsInstance()) { | 1344 if (!obj.IsInstance()) { |
1353 RETURN_TYPE_ERROR(isolate, instance, Instance); | 1345 RETURN_TYPE_ERROR(isolate, instance, Instance); |
1354 } | 1346 } |
1355 const Type& type = Type::Handle(Instance::Cast(obj).GetType()); | 1347 const Type& type = Type::Handle(Instance::Cast(obj).GetType()); |
1356 return Api::NewHandle(isolate, type.Canonicalize()); | 1348 return Api::NewHandle(isolate, type.Canonicalize()); |
1357 } | 1349 } |
1358 | 1350 |
1359 // TODO(asiva): Deprecate this method. | |
1360 DART_EXPORT Dart_Handle Dart_InstanceGetClass(Dart_Handle instance) { | |
1361 Isolate* isolate = Isolate::Current(); | |
1362 DARTSCOPE(isolate); | |
1363 const Instance& obj = Api::UnwrapInstanceHandle(isolate, instance); | |
1364 if (obj.IsNull()) { | |
1365 RETURN_TYPE_ERROR(isolate, instance, Instance); | |
1366 } | |
1367 return Api::NewHandle(isolate, obj.clazz()); | |
1368 } | |
1369 | |
1370 | 1351 |
1371 // --- Numbers, Integers and Doubles ---- | 1352 // --- Numbers, Integers and Doubles ---- |
1372 | 1353 |
1373 DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer, | 1354 DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer, |
1374 bool* fits) { | 1355 bool* fits) { |
1375 // Fast path for Smis and Mints. | 1356 // Fast path for Smis and Mints. |
1376 Isolate* isolate = Isolate::Current(); | 1357 Isolate* isolate = Isolate::Current(); |
1377 CHECK_ISOLATE(isolate); | 1358 CHECK_ISOLATE(isolate); |
1378 intptr_t class_id = Api::ClassId(integer); | 1359 intptr_t class_id = Api::ClassId(integer); |
1379 if (class_id == kSmiCid || class_id == kMintCid) { | 1360 if (class_id == kSmiCid || class_id == kMintCid) { |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2834 CHECK_CALLBACK_STATE(isolate); | 2815 CHECK_CALLBACK_STATE(isolate); |
2835 Object& result = Object::Handle(isolate); | 2816 Object& result = Object::Handle(isolate); |
2836 | 2817 |
2837 if (number_of_arguments < 0) { | 2818 if (number_of_arguments < 0) { |
2838 return Api::NewError( | 2819 return Api::NewError( |
2839 "%s expects argument 'number_of_arguments' to be non-negative.", | 2820 "%s expects argument 'number_of_arguments' to be non-negative.", |
2840 CURRENT_FUNC); | 2821 CURRENT_FUNC); |
2841 } | 2822 } |
2842 | 2823 |
2843 // Get the class to instantiate. | 2824 // Get the class to instantiate. |
2844 result = Api::UnwrapHandle(type); | 2825 const Type& type_obj = Api::UnwrapTypeHandle(isolate, type); |
2845 if (result.IsNull()) { | 2826 if (type_obj.IsNull()) { |
2846 RETURN_TYPE_ERROR(isolate, type, Type); | 2827 RETURN_TYPE_ERROR(isolate, type, Type); |
2847 } | 2828 } |
2848 Class& cls = Class::Handle(isolate); | 2829 Class& cls = Class::Handle(isolate, type_obj.type_class()); |
2849 AbstractTypeArguments& type_arguments = | 2830 const AbstractTypeArguments& type_arguments = |
2850 AbstractTypeArguments::Handle(isolate); | 2831 AbstractTypeArguments::Handle(isolate, type_obj.arguments()); |
2851 | 2832 |
2852 if (result.IsType()) { | 2833 const String& base_constructor_name = String::Handle(isolate, cls.Name()); |
2853 cls = Type::Cast(result).type_class(); | |
2854 type_arguments = Type::Cast(result).arguments(); | |
2855 } else if (result.IsClass()) { | |
2856 // For backwards compatibility we allow class objects to be passed in | |
2857 // for now. This needs to be removed once all code that uses class | |
2858 // objects to invoke Dart_New is removed. | |
2859 cls ^= result.raw(); | |
2860 type_arguments = Type::Handle(cls.RareType()).arguments(); | |
2861 } else { | |
2862 RETURN_TYPE_ERROR(isolate, type, Type); | |
2863 } | |
2864 | |
2865 String& base_constructor_name = String::Handle(); | |
2866 base_constructor_name = cls.Name(); | |
2867 | 2834 |
2868 // And get the name of the constructor to invoke. | 2835 // And get the name of the constructor to invoke. |
2869 String& dot_name = String::Handle(isolate); | 2836 String& dot_name = String::Handle(isolate); |
2870 result = Api::UnwrapHandle(constructor_name); | 2837 result = Api::UnwrapHandle(constructor_name); |
2871 if (result.IsNull()) { | 2838 if (result.IsNull()) { |
2872 dot_name = Symbols::Dot().raw(); | 2839 dot_name = Symbols::Dot().raw(); |
2873 } else if (result.IsString()) { | 2840 } else if (result.IsString()) { |
2874 dot_name = String::Concat(Symbols::Dot(), String::Cast(result)); | 2841 dot_name = String::Concat(Symbols::Dot(), String::Cast(result)); |
2875 } else { | 2842 } else { |
2876 RETURN_TYPE_ERROR(isolate, constructor_name, String); | 2843 RETURN_TYPE_ERROR(isolate, constructor_name, String); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 new_object ^= result.raw(); | 2925 new_object ^= result.raw(); |
2959 } | 2926 } |
2960 return Api::NewHandle(isolate, new_object.raw()); | 2927 return Api::NewHandle(isolate, new_object.raw()); |
2961 } | 2928 } |
2962 | 2929 |
2963 | 2930 |
2964 DART_EXPORT Dart_Handle Dart_Allocate(Dart_Handle type) { | 2931 DART_EXPORT Dart_Handle Dart_Allocate(Dart_Handle type) { |
2965 Isolate* isolate = Isolate::Current(); | 2932 Isolate* isolate = Isolate::Current(); |
2966 DARTSCOPE(isolate); | 2933 DARTSCOPE(isolate); |
2967 CHECK_CALLBACK_STATE(isolate); | 2934 CHECK_CALLBACK_STATE(isolate); |
2968 const Object& result = Object::Handle(isolate, Api::UnwrapHandle(type)); | |
2969 | 2935 |
| 2936 const Type& type_obj = Api::UnwrapTypeHandle(isolate, type); |
2970 // Get the class to instantiate. | 2937 // Get the class to instantiate. |
2971 if (result.IsNull()) { | 2938 if (type_obj.IsNull()) { |
2972 RETURN_TYPE_ERROR(isolate, type, Type); | 2939 RETURN_TYPE_ERROR(isolate, type, Type); |
2973 } | 2940 } |
2974 Class& cls = Class::Handle(isolate); | 2941 const Class& cls = Class::Handle(isolate, type_obj.type_class()); |
2975 if (result.IsType()) { | |
2976 cls = Type::Cast(result).type_class(); | |
2977 } else if (result.IsClass()) { | |
2978 // For backwards compatibility we allow class objects to be passed in | |
2979 // for now. This needs to be removed once all code that uses class | |
2980 // objects to invoke Dart_New is removed. | |
2981 cls ^= result.raw(); | |
2982 } else { | |
2983 RETURN_TYPE_ERROR(isolate, type, Type); | |
2984 } | |
2985 | 2942 |
2986 // Allocate an object for the given class. | 2943 // Allocate an object for the given class. |
2987 return Api::NewHandle(isolate, Instance::New(cls)); | 2944 return Api::NewHandle(isolate, Instance::New(cls)); |
2988 } | 2945 } |
2989 | 2946 |
2990 | 2947 |
2991 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, | 2948 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, |
2992 Dart_Handle name, | 2949 Dart_Handle name, |
2993 int number_of_arguments, | 2950 int number_of_arguments, |
2994 Dart_Handle* arguments) { | 2951 Dart_Handle* arguments) { |
(...skipping 28 matching lines...) Expand all Loading... |
3023 return Api::NewHandle(isolate, arg.raw()); | 2980 return Api::NewHandle(isolate, arg.raw()); |
3024 } else { | 2981 } else { |
3025 return Api::NewError( | 2982 return Api::NewError( |
3026 "%s expects arguments[%d] to be an Instance handle.", | 2983 "%s expects arguments[%d] to be an Instance handle.", |
3027 CURRENT_FUNC, i); | 2984 CURRENT_FUNC, i); |
3028 } | 2985 } |
3029 } | 2986 } |
3030 args.SetAt((i + num_receiver), arg); | 2987 args.SetAt((i + num_receiver), arg); |
3031 } | 2988 } |
3032 | 2989 |
3033 if (obj.IsType() || obj.IsClass()) { | 2990 if (obj.IsType()) { |
3034 // Finalize all classes. | 2991 // Finalize all classes. |
3035 Dart_Handle state = Api::CheckIsolateState(isolate); | 2992 Dart_Handle state = Api::CheckIsolateState(isolate); |
3036 if (::Dart_IsError(state)) { | 2993 if (::Dart_IsError(state)) { |
3037 return state; | 2994 return state; |
3038 } | 2995 } |
3039 | 2996 |
3040 // For backwards compatibility we allow class objects to be passed in | 2997 const Class& cls = Class::Handle(isolate, Type::Cast(obj).type_class()); |
3041 // for now. This needs to be removed once all code that uses class | |
3042 // objects to invoke Dart_Invoke is removed. | |
3043 Class& cls = Class::Handle(); | |
3044 if (obj.IsType()) { | |
3045 cls = Type::Cast(obj).type_class(); | |
3046 } else { | |
3047 cls = Class::Cast(obj).raw(); | |
3048 } | |
3049 const Function& function = Function::Handle( | 2998 const Function& function = Function::Handle( |
3050 isolate, | 2999 isolate, |
3051 Resolver::ResolveStatic(cls, | 3000 Resolver::ResolveStatic(cls, |
3052 function_name, | 3001 function_name, |
3053 number_of_arguments, | 3002 number_of_arguments, |
3054 Object::empty_array(), | 3003 Object::empty_array(), |
3055 Resolver::kIsQualified)); | 3004 Resolver::kIsQualified)); |
3056 if (function.IsNull()) { | 3005 if (function.IsNull()) { |
3057 const String& cls_name = String::Handle(isolate, cls.Name()); | 3006 const String& cls_name = String::Handle(isolate, cls.Name()); |
3058 return Api::NewError("%s: did not find static method '%s.%s'.", | 3007 return Api::NewError("%s: did not find static method '%s.%s'.", |
(...skipping 26 matching lines...) Expand all Loading... |
3085 } else if (obj.IsLibrary()) { | 3034 } else if (obj.IsLibrary()) { |
3086 // Check whether class finalization is needed. | 3035 // Check whether class finalization is needed. |
3087 const Library& lib = Library::Cast(obj); | 3036 const Library& lib = Library::Cast(obj); |
3088 | 3037 |
3089 // Finalize all classes if needed. | 3038 // Finalize all classes if needed. |
3090 Dart_Handle state = Api::CheckIsolateState(isolate); | 3039 Dart_Handle state = Api::CheckIsolateState(isolate); |
3091 if (::Dart_IsError(state)) { | 3040 if (::Dart_IsError(state)) { |
3092 return state; | 3041 return state; |
3093 } | 3042 } |
3094 | 3043 |
3095 Function& function = Function::Handle(isolate); | 3044 const Function& function = |
3096 function = lib.LookupFunctionAllowPrivate(function_name); | 3045 Function::Handle(isolate, |
| 3046 lib.LookupFunctionAllowPrivate(function_name)); |
3097 if (function.IsNull()) { | 3047 if (function.IsNull()) { |
3098 return Api::NewError("%s: did not find top-level function '%s'.", | 3048 return Api::NewError("%s: did not find top-level function '%s'.", |
3099 CURRENT_FUNC, | 3049 CURRENT_FUNC, |
3100 function_name.ToCString()); | 3050 function_name.ToCString()); |
3101 } | 3051 } |
3102 // LookupFunctionAllowPrivate does not check argument arity, so we | 3052 // LookupFunctionAllowPrivate does not check argument arity, so we |
3103 // do it here. | 3053 // do it here. |
3104 String& error_message = String::Handle(); | 3054 String& error_message = String::Handle(); |
3105 if (!function.AreValidArgumentCounts(number_of_arguments, | 3055 if (!function.AreValidArgumentCounts(number_of_arguments, |
3106 0, | 3056 0, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3181 if (::Dart_IsError(state)) { | 3131 if (::Dart_IsError(state)) { |
3182 return state; | 3132 return state; |
3183 } | 3133 } |
3184 | 3134 |
3185 Field& field = Field::Handle(isolate); | 3135 Field& field = Field::Handle(isolate); |
3186 Function& getter = Function::Handle(isolate); | 3136 Function& getter = Function::Handle(isolate); |
3187 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(container)); | 3137 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(container)); |
3188 if (obj.IsNull()) { | 3138 if (obj.IsNull()) { |
3189 return Api::NewError("%s expects argument 'container' to be non-null.", | 3139 return Api::NewError("%s expects argument 'container' to be non-null.", |
3190 CURRENT_FUNC); | 3140 CURRENT_FUNC); |
3191 } else if (obj.IsType() || obj.IsClass()) { | 3141 } else if (obj.IsType()) { |
3192 // To access a static field we may need to use the Field or the | 3142 // To access a static field we may need to use the Field or the |
3193 // getter Function. | 3143 // getter Function. |
3194 // For backwards compatibility we allow class objects to be passed in | 3144 Class& cls = Class::Handle(isolate, Type::Cast(obj).type_class()); |
3195 // for now. This needs to be removed once all code that uses class | 3145 |
3196 // objects to invoke Dart_GetField is removed. | |
3197 Class& cls = Class::Handle(); | |
3198 if (obj.IsType()) { | |
3199 cls = Type::Cast(obj).type_class(); | |
3200 } else { | |
3201 cls = Class::Cast(obj).raw(); | |
3202 } | |
3203 field = cls.LookupStaticField(field_name); | 3146 field = cls.LookupStaticField(field_name); |
3204 if (field.IsNull() || FieldIsUninitialized(isolate, field)) { | 3147 if (field.IsNull() || FieldIsUninitialized(isolate, field)) { |
3205 const String& getter_name = | 3148 const String& getter_name = |
3206 String::Handle(isolate, Field::GetterName(field_name)); | 3149 String::Handle(isolate, Field::GetterName(field_name)); |
3207 getter = cls.LookupStaticFunctionAllowPrivate(getter_name); | 3150 getter = cls.LookupStaticFunctionAllowPrivate(getter_name); |
3208 } | 3151 } |
3209 | 3152 |
3210 if (!getter.IsNull()) { | 3153 if (!getter.IsNull()) { |
3211 // Invoke the getter and return the result. | 3154 // Invoke the getter and return the result. |
3212 return Api::NewHandle( | 3155 return Api::NewHandle( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3313 Dart_Handle state = Api::CheckIsolateState(isolate); | 3256 Dart_Handle state = Api::CheckIsolateState(isolate); |
3314 if (::Dart_IsError(state)) { | 3257 if (::Dart_IsError(state)) { |
3315 return state; | 3258 return state; |
3316 } | 3259 } |
3317 Field& field = Field::Handle(isolate); | 3260 Field& field = Field::Handle(isolate); |
3318 Function& setter = Function::Handle(isolate); | 3261 Function& setter = Function::Handle(isolate); |
3319 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(container)); | 3262 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(container)); |
3320 if (obj.IsNull()) { | 3263 if (obj.IsNull()) { |
3321 return Api::NewError("%s expects argument 'container' to be non-null.", | 3264 return Api::NewError("%s expects argument 'container' to be non-null.", |
3322 CURRENT_FUNC); | 3265 CURRENT_FUNC); |
3323 } else if (obj.IsType() || obj.IsClass()) { | 3266 } else if (obj.IsType()) { |
3324 // To access a static field we may need to use the Field or the | 3267 // To access a static field we may need to use the Field or the |
3325 // setter Function. | 3268 // setter Function. |
3326 // For backwards compatibility we allow class objects to be passed in | 3269 Class& cls = Class::Handle(isolate, Type::Cast(obj).type_class()); |
3327 // for now. This needs to be removed once all code that uses class | 3270 |
3328 // objects to invoke Dart_SetField is removed. | |
3329 Class& cls = Class::Handle(); | |
3330 if (obj.IsType()) { | |
3331 cls = Type::Cast(obj).type_class(); | |
3332 } else { | |
3333 cls = Class::Cast(obj).raw(); | |
3334 } | |
3335 field = cls.LookupStaticField(field_name); | 3271 field = cls.LookupStaticField(field_name); |
3336 if (field.IsNull()) { | 3272 if (field.IsNull()) { |
3337 String& setter_name = | 3273 String& setter_name = |
3338 String::Handle(isolate, Field::SetterName(field_name)); | 3274 String::Handle(isolate, Field::SetterName(field_name)); |
3339 setter = cls.LookupStaticFunctionAllowPrivate(setter_name); | 3275 setter = cls.LookupStaticFunctionAllowPrivate(setter_name); |
3340 } | 3276 } |
3341 | 3277 |
3342 if (!setter.IsNull()) { | 3278 if (!setter.IsNull()) { |
3343 // Invoke the setter and return the result. | 3279 // Invoke the setter and return the result. |
3344 const int kNumArgs = 1; | 3280 const int kNumArgs = 1; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3543 } | 3479 } |
3544 CHECK_CALLBACK_STATE(isolate); | 3480 CHECK_CALLBACK_STATE(isolate); |
3545 | 3481 |
3546 String& cls_symbol = String::Handle(isolate, Symbols::New(cls_name)); | 3482 String& cls_symbol = String::Handle(isolate, Symbols::New(cls_name)); |
3547 const Class& cls = Class::Handle( | 3483 const Class& cls = Class::Handle( |
3548 isolate, Class::NewNativeWrapper(lib, cls_symbol, field_count)); | 3484 isolate, Class::NewNativeWrapper(lib, cls_symbol, field_count)); |
3549 if (cls.IsNull()) { | 3485 if (cls.IsNull()) { |
3550 return Api::NewError( | 3486 return Api::NewError( |
3551 "Unable to create native wrapper class : already exists"); | 3487 "Unable to create native wrapper class : already exists"); |
3552 } | 3488 } |
3553 return Api::NewHandle(isolate, cls.raw()); | 3489 return Api::NewHandle(isolate, cls.RareType()); |
3554 } | 3490 } |
3555 | 3491 |
3556 | 3492 |
3557 DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount(Dart_Handle obj, | 3493 DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount(Dart_Handle obj, |
3558 int* count) { | 3494 int* count) { |
3559 Isolate* isolate = Isolate::Current(); | 3495 Isolate* isolate = Isolate::Current(); |
3560 DARTSCOPE(isolate); | 3496 DARTSCOPE(isolate); |
3561 const Instance& instance = Api::UnwrapInstanceHandle(isolate, obj); | 3497 const Instance& instance = Api::UnwrapInstanceHandle(isolate, obj); |
3562 if (instance.IsNull()) { | 3498 if (instance.IsNull()) { |
3563 RETURN_TYPE_ERROR(isolate, obj, Instance); | 3499 RETURN_TYPE_ERROR(isolate, obj, Instance); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4027 RETURN_TYPE_ERROR(isolate, class_name, String); | 3963 RETURN_TYPE_ERROR(isolate, class_name, String); |
4028 } | 3964 } |
4029 const Class& cls = Class::Handle( | 3965 const Class& cls = Class::Handle( |
4030 isolate, lib.LookupClassAllowPrivate(cls_name)); | 3966 isolate, lib.LookupClassAllowPrivate(cls_name)); |
4031 if (cls.IsNull()) { | 3967 if (cls.IsNull()) { |
4032 // TODO(turnidge): Return null or error in this case? | 3968 // TODO(turnidge): Return null or error in this case? |
4033 const String& lib_name = String::Handle(isolate, lib.name()); | 3969 const String& lib_name = String::Handle(isolate, lib.name()); |
4034 return Api::NewError("Class '%s' not found in library '%s'.", | 3970 return Api::NewError("Class '%s' not found in library '%s'.", |
4035 cls_name.ToCString(), lib_name.ToCString()); | 3971 cls_name.ToCString(), lib_name.ToCString()); |
4036 } | 3972 } |
4037 return Api::NewHandle(isolate, cls.raw()); | 3973 return Api::NewHandle(isolate, cls.RareType()); |
4038 } | 3974 } |
4039 | 3975 |
4040 | 3976 |
4041 DART_EXPORT Dart_Handle Dart_GetType(Dart_Handle library, | 3977 DART_EXPORT Dart_Handle Dart_GetType(Dart_Handle library, |
4042 Dart_Handle class_name, | 3978 Dart_Handle class_name, |
4043 intptr_t number_of_type_arguments, | 3979 intptr_t number_of_type_arguments, |
4044 Dart_Handle* type_arguments) { | 3980 Dart_Handle* type_arguments) { |
4045 Isolate* isolate = Isolate::Current(); | 3981 Isolate* isolate = Isolate::Current(); |
4046 DARTSCOPE(isolate); | 3982 DARTSCOPE(isolate); |
4047 | 3983 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4337 } | 4273 } |
4338 { | 4274 { |
4339 NoGCScope no_gc; | 4275 NoGCScope no_gc; |
4340 RawObject* raw_obj = obj.raw(); | 4276 RawObject* raw_obj = obj.raw(); |
4341 isolate->heap()->SetPeer(raw_obj, peer); | 4277 isolate->heap()->SetPeer(raw_obj, peer); |
4342 } | 4278 } |
4343 return Api::Success(); | 4279 return Api::Success(); |
4344 } | 4280 } |
4345 | 4281 |
4346 } // namespace dart | 4282 } // namespace dart |
OLD | NEW |