| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 reinterpret_cast<RawExternalFourByteString*>(raw_obj)->ptr(); | 277 reinterpret_cast<RawExternalFourByteString*>(raw_obj)->ptr(); |
| 278 ExternalStringData<uint32_t>* data = raw_string->external_data_; | 278 ExternalStringData<uint32_t>* data = raw_string->external_data_; |
| 279 *peer = data->peer(); | 279 *peer = data->peer(); |
| 280 return true; | 280 return true; |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 return false; | 283 return false; |
| 284 } | 284 } |
| 285 | 285 |
| 286 | 286 |
| 287 // When we want to return a handle to a type to the user, we handle |
| 288 // class-types differently than some other types. |
| 289 static Dart_Handle TypeToHandle(Isolate* isolate, |
| 290 const char* function_name, |
| 291 const AbstractType& type) { |
| 292 if (type.HasResolvedTypeClass()) { |
| 293 const Class& cls = Class::Handle(isolate, type.type_class()); |
| 294 #if defined(DEBUG) |
| 295 const Library& lib = Library::Handle(cls.library()); |
| 296 if (lib.IsNull()) { |
| 297 ASSERT(cls.IsDynamicClass() || cls.IsVoidClass()); |
| 298 } |
| 299 #endif |
| 300 return Api::NewHandle(isolate, cls.raw()); |
| 301 } else if (type.IsTypeParameter()) { |
| 302 return Api::NewHandle(isolate, type.raw()); |
| 303 } else { |
| 304 return Api::NewError("%s: unexpected type '%s' encountered.", |
| 305 function_name, type.ToCString()); |
| 306 } |
| 307 } |
| 308 |
| 309 |
| 287 // --- Handles --- | 310 // --- Handles --- |
| 288 | 311 |
| 289 | 312 |
| 290 DART_EXPORT bool Dart_IsError(Dart_Handle handle) { | 313 DART_EXPORT bool Dart_IsError(Dart_Handle handle) { |
| 291 return RawObject::IsErrorClassId(Api::ClassId(handle)); | 314 return RawObject::IsErrorClassId(Api::ClassId(handle)); |
| 292 } | 315 } |
| 293 | 316 |
| 294 | 317 |
| 295 DART_EXPORT bool Dart_IsApiError(Dart_Handle object) { | 318 DART_EXPORT bool Dart_IsApiError(Dart_Handle object) { |
| 296 return Api::ClassId(object) == kApiErrorCid; | 319 return Api::ClassId(object) == kApiErrorCid; |
| (...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 Isolate* isolate = Isolate::Current(); | 2477 Isolate* isolate = Isolate::Current(); |
| 2455 DARTSCOPE(isolate); | 2478 DARTSCOPE(isolate); |
| 2456 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); | 2479 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); |
| 2457 if (cls.IsNull()) { | 2480 if (cls.IsNull()) { |
| 2458 RETURN_TYPE_ERROR(isolate, clazz, Class); | 2481 RETURN_TYPE_ERROR(isolate, clazz, Class); |
| 2459 } | 2482 } |
| 2460 | 2483 |
| 2461 #if defined(DEBUG) | 2484 #if defined(DEBUG) |
| 2462 const Library& lib = Library::Handle(cls.library()); | 2485 const Library& lib = Library::Handle(cls.library()); |
| 2463 if (lib.IsNull()) { | 2486 if (lib.IsNull()) { |
| 2464 ASSERT(cls.IsDynamicClass() || cls.IsVoidClass()); | 2487 // ASSERT(cls.IsDynamicClass() || cls.IsVoidClass()); |
| 2488 if (!cls.IsDynamicClass() && !cls.IsVoidClass()) { |
| 2489 fprintf(stderr, "NO LIBRARY: %s\n", cls.ToCString()); |
| 2490 } |
| 2465 } | 2491 } |
| 2466 #endif | 2492 #endif |
| 2467 | 2493 |
| 2468 return Api::NewHandle(isolate, cls.library()); | 2494 return Api::NewHandle(isolate, cls.library()); |
| 2469 } | 2495 } |
| 2470 | 2496 |
| 2471 | 2497 |
| 2472 DART_EXPORT Dart_Handle Dart_ClassGetDefault(Dart_Handle clazz) { | 2498 DART_EXPORT Dart_Handle Dart_ClassGetDefault(Dart_Handle clazz) { |
| 2473 Isolate* isolate = Isolate::Current(); | 2499 Isolate* isolate = Isolate::Current(); |
| 2474 DARTSCOPE(isolate); | 2500 DARTSCOPE(isolate); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2533 if (interface_type.HasResolvedTypeClass()) { | 2559 if (interface_type.HasResolvedTypeClass()) { |
| 2534 return Api::NewHandle(isolate, interface_type.type_class()); | 2560 return Api::NewHandle(isolate, interface_type.type_class()); |
| 2535 } | 2561 } |
| 2536 const String& type_name = | 2562 const String& type_name = |
| 2537 String::Handle(isolate, interface_type.TypeClassName()); | 2563 String::Handle(isolate, interface_type.TypeClassName()); |
| 2538 return Api::NewError("%s: internal error: found unresolved type class '%s'.", | 2564 return Api::NewError("%s: internal error: found unresolved type class '%s'.", |
| 2539 CURRENT_FUNC, type_name.ToCString()); | 2565 CURRENT_FUNC, type_name.ToCString()); |
| 2540 } | 2566 } |
| 2541 | 2567 |
| 2542 | 2568 |
| 2569 DART_EXPORT bool Dart_ClassIsTypedef(Dart_Handle clazz) { |
| 2570 Isolate* isolate = Isolate::Current(); |
| 2571 DARTSCOPE(isolate); |
| 2572 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); |
| 2573 if (cls.IsNull()) { |
| 2574 RETURN_TYPE_ERROR(isolate, clazz, Class); |
| 2575 } |
| 2576 // For now we represent typedefs as non-canonical signature classes. |
| 2577 // I anticipate this may change if we make typedefs more general. |
| 2578 return cls.IsSignatureClass() && !cls.IsCanonicalSignatureClass(); |
| 2579 } |
| 2580 |
| 2581 |
| 2582 DART_EXPORT Dart_Handle Dart_ClassGetTypedefReferent(Dart_Handle clazz) { |
| 2583 Isolate* isolate = Isolate::Current(); |
| 2584 DARTSCOPE(isolate); |
| 2585 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); |
| 2586 if (cls.IsNull()) { |
| 2587 RETURN_TYPE_ERROR(isolate, clazz, Class); |
| 2588 } |
| 2589 |
| 2590 if (!cls.IsSignatureClass() && !cls.IsCanonicalSignatureClass()) { |
| 2591 const String& cls_name = String::Handle(cls.UserVisibleName()); |
| 2592 return Api::NewError("%s: class '%s' is not a typedef class. " |
| 2593 "See Dart_ClassIsTypedef.", |
| 2594 CURRENT_FUNC, cls_name.ToCString()); |
| 2595 } |
| 2596 |
| 2597 const Function& func = Function::Handle(isolate, cls.signature_function()); |
| 2598 return Api::NewHandle(isolate, func.signature_class()); |
| 2599 } |
| 2600 |
| 2601 |
| 2602 DART_EXPORT bool Dart_ClassIsFunctionType(Dart_Handle clazz) { |
| 2603 Isolate* isolate = Isolate::Current(); |
| 2604 DARTSCOPE(isolate); |
| 2605 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); |
| 2606 if (cls.IsNull()) { |
| 2607 RETURN_TYPE_ERROR(isolate, clazz, Class); |
| 2608 } |
| 2609 // A class represents a function type when it is a canonical |
| 2610 // signature class. |
| 2611 return cls.IsCanonicalSignatureClass(); |
| 2612 } |
| 2613 |
| 2614 |
| 2615 DART_EXPORT Dart_Handle Dart_ClassGetFunctionTypeSignature(Dart_Handle clazz) { |
| 2616 Isolate* isolate = Isolate::Current(); |
| 2617 DARTSCOPE(isolate); |
| 2618 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); |
| 2619 if (cls.IsNull()) { |
| 2620 RETURN_TYPE_ERROR(isolate, clazz, Class); |
| 2621 } |
| 2622 if (!cls.IsCanonicalSignatureClass()) { |
| 2623 const String& cls_name = String::Handle(cls.UserVisibleName()); |
| 2624 return Api::NewError("%s: class '%s' is not a function-type class. " |
| 2625 "See Dart_ClassIsFunctionType.", |
| 2626 CURRENT_FUNC, cls_name.ToCString()); |
| 2627 } |
| 2628 return Api::NewHandle(isolate, cls.signature_function()); |
| 2629 } |
| 2630 |
| 2631 |
| 2543 // --- Function and Variable Reflection --- | 2632 // --- Function and Variable Reflection --- |
| 2544 | 2633 |
| 2545 | 2634 |
| 2546 // Outside of the vm, we expose setter names with a trailing '='. | 2635 // Outside of the vm, we expose setter names with a trailing '='. |
| 2547 static bool HasExternalSetterSuffix(const String& name) { | 2636 static bool HasExternalSetterSuffix(const String& name) { |
| 2548 return name.CharAt(name.Length() - 1) == '='; | 2637 return name.CharAt(name.Length() - 1) == '='; |
| 2549 } | 2638 } |
| 2550 | 2639 |
| 2551 | 2640 |
| 2552 static RawString* RemoveExternalSetterSuffix(const String& name) { | 2641 static RawString* RemoveExternalSetterSuffix(const String& name) { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2810 } | 2899 } |
| 2811 const Function& func = Api::UnwrapFunctionHandle(isolate, function); | 2900 const Function& func = Api::UnwrapFunctionHandle(isolate, function); |
| 2812 if (func.IsNull()) { | 2901 if (func.IsNull()) { |
| 2813 RETURN_TYPE_ERROR(isolate, function, Function); | 2902 RETURN_TYPE_ERROR(isolate, function, Function); |
| 2814 } | 2903 } |
| 2815 *is_setter = (func.kind() == RawFunction::kSetterFunction); | 2904 *is_setter = (func.kind() == RawFunction::kSetterFunction); |
| 2816 return Api::Success(isolate); | 2905 return Api::Success(isolate); |
| 2817 } | 2906 } |
| 2818 | 2907 |
| 2819 | 2908 |
| 2909 DART_EXPORT Dart_Handle Dart_FunctionReturnType(Dart_Handle function) { |
| 2910 Isolate* isolate = Isolate::Current(); |
| 2911 DARTSCOPE(isolate); |
| 2912 const Function& func = Api::UnwrapFunctionHandle(isolate, function); |
| 2913 if (func.IsNull()) { |
| 2914 RETURN_TYPE_ERROR(isolate, function, Function); |
| 2915 } |
| 2916 |
| 2917 if (func.kind() == RawFunction::kConstructor) { |
| 2918 // Special case the return type for constructors. Inside the vm |
| 2919 // we mark them as returning Dynamic, but for the purposes of |
| 2920 // reflection, they return the type of the class being |
| 2921 // constructed. |
| 2922 return Api::NewHandle(isolate, func.Owner()); |
| 2923 } else { |
| 2924 const AbstractType& return_type = |
| 2925 AbstractType::Handle(isolate, func.result_type()); |
| 2926 return TypeToHandle(isolate, "Dart_FunctionReturnType", return_type); |
| 2927 } |
| 2928 } |
| 2929 |
| 2930 |
| 2820 DART_EXPORT Dart_Handle Dart_FunctionParameterCounts( | 2931 DART_EXPORT Dart_Handle Dart_FunctionParameterCounts( |
| 2821 Dart_Handle function, | 2932 Dart_Handle function, |
| 2822 int64_t* fixed_param_count, | 2933 int64_t* fixed_param_count, |
| 2823 int64_t* opt_param_count) { | 2934 int64_t* opt_param_count) { |
| 2824 Isolate* isolate = Isolate::Current(); | 2935 Isolate* isolate = Isolate::Current(); |
| 2825 DARTSCOPE(isolate); | 2936 DARTSCOPE(isolate); |
| 2826 if (fixed_param_count == NULL) { | 2937 if (fixed_param_count == NULL) { |
| 2827 RETURN_NULL_ERROR(fixed_param_count); | 2938 RETURN_NULL_ERROR(fixed_param_count); |
| 2828 } | 2939 } |
| 2829 if (opt_param_count == NULL) { | 2940 if (opt_param_count == NULL) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2841 func.NumberOfImplicitParameters()); | 2952 func.NumberOfImplicitParameters()); |
| 2842 *opt_param_count = func.num_optional_parameters(); | 2953 *opt_param_count = func.num_optional_parameters(); |
| 2843 | 2954 |
| 2844 ASSERT(*fixed_param_count >= 0); | 2955 ASSERT(*fixed_param_count >= 0); |
| 2845 ASSERT(*opt_param_count >= 0); | 2956 ASSERT(*opt_param_count >= 0); |
| 2846 | 2957 |
| 2847 return Api::Success(isolate); | 2958 return Api::Success(isolate); |
| 2848 } | 2959 } |
| 2849 | 2960 |
| 2850 | 2961 |
| 2962 DART_EXPORT Dart_Handle Dart_FunctionParameterType(Dart_Handle function, |
| 2963 int parameter_index) { |
| 2964 Isolate* isolate = Isolate::Current(); |
| 2965 DARTSCOPE(isolate); |
| 2966 const Function& func = Api::UnwrapFunctionHandle(isolate, function); |
| 2967 if (func.IsNull()) { |
| 2968 RETURN_TYPE_ERROR(isolate, function, Function); |
| 2969 } |
| 2970 |
| 2971 const intptr_t num_implicit_params = func.NumberOfImplicitParameters(); |
| 2972 const intptr_t num_params = func.NumberOfParameters() - num_implicit_params; |
| 2973 if (parameter_index < 0 || parameter_index >= num_params) { |
| 2974 return Api::NewError( |
| 2975 "%s: argument 'parameter_index' out of range. " |
| 2976 "Expected 0..%d but saw %d.", |
| 2977 CURRENT_FUNC, num_params, parameter_index); |
| 2978 } |
| 2979 const AbstractType& param_type = |
| 2980 AbstractType::Handle(isolate, func.ParameterTypeAt( |
| 2981 num_implicit_params + parameter_index)); |
| 2982 return TypeToHandle(isolate, "Dart_FunctionParameterType", param_type); |
| 2983 } |
| 2984 |
| 2985 |
| 2851 DART_EXPORT Dart_Handle Dart_GetVariableNames(Dart_Handle target) { | 2986 DART_EXPORT Dart_Handle Dart_GetVariableNames(Dart_Handle target) { |
| 2852 Isolate* isolate = Isolate::Current(); | 2987 Isolate* isolate = Isolate::Current(); |
| 2853 DARTSCOPE(isolate); | 2988 DARTSCOPE(isolate); |
| 2854 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target)); | 2989 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target)); |
| 2855 if (obj.IsError()) { | 2990 if (obj.IsError()) { |
| 2856 return target; | 2991 return target; |
| 2857 } | 2992 } |
| 2858 | 2993 |
| 2859 const GrowableObjectArray& names = | 2994 const GrowableObjectArray& names = |
| 2860 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); | 2995 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2964 RETURN_NULL_ERROR(is_final); | 3099 RETURN_NULL_ERROR(is_final); |
| 2965 } | 3100 } |
| 2966 const Field& var = Api::UnwrapFieldHandle(isolate, variable); | 3101 const Field& var = Api::UnwrapFieldHandle(isolate, variable); |
| 2967 if (var.IsNull()) { | 3102 if (var.IsNull()) { |
| 2968 RETURN_TYPE_ERROR(isolate, variable, Field); | 3103 RETURN_TYPE_ERROR(isolate, variable, Field); |
| 2969 } | 3104 } |
| 2970 *is_final = var.is_final(); | 3105 *is_final = var.is_final(); |
| 2971 return Api::Success(isolate); | 3106 return Api::Success(isolate); |
| 2972 } | 3107 } |
| 2973 | 3108 |
| 3109 |
| 3110 DART_EXPORT Dart_Handle Dart_VariableType(Dart_Handle variable) { |
| 3111 Isolate* isolate = Isolate::Current(); |
| 3112 DARTSCOPE(isolate); |
| 3113 const Field& var = Api::UnwrapFieldHandle(isolate, variable); |
| 3114 if (var.IsNull()) { |
| 3115 RETURN_TYPE_ERROR(isolate, variable, Field); |
| 3116 } |
| 3117 |
| 3118 const AbstractType& type = AbstractType::Handle(isolate, var.type()); |
| 3119 return TypeToHandle(isolate, "Dart_VariableType", type); |
| 3120 } |
| 3121 |
| 3122 |
| 3123 DART_EXPORT Dart_Handle Dart_GetTypeVariableNames(Dart_Handle clazz) { |
| 3124 Isolate* isolate = Isolate::Current(); |
| 3125 DARTSCOPE(isolate); |
| 3126 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); |
| 3127 if (cls.IsNull()) { |
| 3128 RETURN_TYPE_ERROR(isolate, clazz, Class); |
| 3129 } |
| 3130 |
| 3131 const intptr_t num_type_params = cls.NumTypeParameters(); |
| 3132 const TypeArguments& type_params = |
| 3133 TypeArguments::Handle(cls.type_parameters()); |
| 3134 |
| 3135 const GrowableObjectArray& names = |
| 3136 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); |
| 3137 TypeParameter& type_param = TypeParameter::Handle(isolate); |
| 3138 String& name = String::Handle(isolate); |
| 3139 for (intptr_t i = 0; i < num_type_params; i++) { |
| 3140 type_param ^= type_params.TypeAt(i); |
| 3141 name = type_param.name(); |
| 3142 names.Add(name); |
| 3143 } |
| 3144 return Api::NewHandle(isolate, Array::MakeArray(names)); |
| 3145 } |
| 3146 |
| 3147 |
| 3148 DART_EXPORT Dart_Handle Dart_LookupTypeVariable( |
| 3149 Dart_Handle clazz, |
| 3150 Dart_Handle type_variable_name) { |
| 3151 Isolate* isolate = Isolate::Current(); |
| 3152 DARTSCOPE(isolate); |
| 3153 const Class& cls = Api::UnwrapClassHandle(isolate, clazz); |
| 3154 if (cls.IsNull()) { |
| 3155 RETURN_TYPE_ERROR(isolate, clazz, Class); |
| 3156 } |
| 3157 const String& var_name = Api::UnwrapStringHandle(isolate, type_variable_name); |
| 3158 if (var_name.IsNull()) { |
| 3159 RETURN_TYPE_ERROR(isolate, type_variable_name, String); |
| 3160 } |
| 3161 |
| 3162 const intptr_t num_type_params = cls.NumTypeParameters(); |
| 3163 const TypeArguments& type_params = |
| 3164 TypeArguments::Handle(cls.type_parameters()); |
| 3165 |
| 3166 TypeParameter& type_param = TypeParameter::Handle(isolate); |
| 3167 String& name = String::Handle(isolate); |
| 3168 for (intptr_t i = 0; i < num_type_params; i++) { |
| 3169 type_param ^= type_params.TypeAt(i); |
| 3170 name = type_param.name(); |
| 3171 if (name.Equals(var_name)) { |
| 3172 return Api::NewHandle(isolate, type_param.raw()); |
| 3173 } |
| 3174 } |
| 3175 const String& cls_name = String::Handle(cls.UserVisibleName()); |
| 3176 return Api::NewError( |
| 3177 "%s: Could not find type variable named '%s' for class %s.\n", |
| 3178 var_name.ToCString(), cls_name.ToCString()); |
| 3179 } |
| 3180 |
| 3181 |
| 3182 DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle) { |
| 3183 return Api::ClassId(handle) == kTypeParameterCid; |
| 3184 } |
| 3185 |
| 3186 DART_EXPORT Dart_Handle Dart_TypeVariableName(Dart_Handle type_variable) { |
| 3187 Isolate* isolate = Isolate::Current(); |
| 3188 DARTSCOPE(isolate); |
| 3189 const TypeParameter& type_var = |
| 3190 Api::UnwrapTypeParameterHandle(isolate, type_variable); |
| 3191 if (type_var.IsNull()) { |
| 3192 RETURN_TYPE_ERROR(isolate, type_variable, TypeParameter); |
| 3193 } |
| 3194 return Api::NewHandle(isolate, type_var.name()); |
| 3195 } |
| 3196 |
| 3197 |
| 3198 DART_EXPORT Dart_Handle Dart_TypeVariableOwner(Dart_Handle type_variable) { |
| 3199 Isolate* isolate = Isolate::Current(); |
| 3200 DARTSCOPE(isolate); |
| 3201 const TypeParameter& type_var = |
| 3202 Api::UnwrapTypeParameterHandle(isolate, type_variable); |
| 3203 if (type_var.IsNull()) { |
| 3204 RETURN_TYPE_ERROR(isolate, type_variable, TypeParameter); |
| 3205 } |
| 3206 const Class& owner = Class::Handle(type_var.parameterized_class()); |
| 3207 ASSERT(!owner.IsNull() && owner.IsClass()); |
| 3208 return Api::NewHandle(isolate, owner.raw()); |
| 3209 } |
| 3210 |
| 3211 |
| 3212 DART_EXPORT Dart_Handle Dart_TypeVariableUpperBound(Dart_Handle type_variable) { |
| 3213 Isolate* isolate = Isolate::Current(); |
| 3214 DARTSCOPE(isolate); |
| 3215 const TypeParameter& type_var = |
| 3216 Api::UnwrapTypeParameterHandle(isolate, type_variable); |
| 3217 if (type_var.IsNull()) { |
| 3218 RETURN_TYPE_ERROR(isolate, type_variable, TypeParameter); |
| 3219 } |
| 3220 const AbstractType& bound = AbstractType::Handle(type_var.bound()); |
| 3221 return TypeToHandle(isolate, "Dart_TypeVariableUpperBound", bound); |
| 3222 } |
| 3223 |
| 3224 |
| 2974 // --- Constructors, Methods, and Fields --- | 3225 // --- Constructors, Methods, and Fields --- |
| 2975 | 3226 |
| 2976 | 3227 |
| 2977 static RawObject* ResolveConstructor(const char* current_func, | 3228 static RawObject* ResolveConstructor(const char* current_func, |
| 2978 const Class& cls, | 3229 const Class& cls, |
| 2979 const String& class_name, | 3230 const String& class_name, |
| 2980 const String& dotted_name, | 3231 const String& dotted_name, |
| 2981 int num_args) { | 3232 int num_args) { |
| 2982 // The constructor must be present in the interface. | 3233 // The constructor must be present in the interface. |
| 2983 String& constr_name = String::Handle(String::Concat(class_name, dotted_name)); | 3234 String& constr_name = String::Handle(String::Concat(class_name, dotted_name)); |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3969 RETURN_TYPE_ERROR(isolate, library, Library); | 4220 RETURN_TYPE_ERROR(isolate, library, Library); |
| 3970 } | 4221 } |
| 3971 | 4222 |
| 3972 const GrowableObjectArray& names = | 4223 const GrowableObjectArray& names = |
| 3973 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); | 4224 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); |
| 3974 ClassDictionaryIterator it(lib); | 4225 ClassDictionaryIterator it(lib); |
| 3975 Class& cls = Class::Handle(); | 4226 Class& cls = Class::Handle(); |
| 3976 String& name = String::Handle(); | 4227 String& name = String::Handle(); |
| 3977 while (it.HasNext()) { | 4228 while (it.HasNext()) { |
| 3978 cls = it.GetNextClass(); | 4229 cls = it.GetNextClass(); |
| 3979 // For now we suppress the signature classes of closures. | 4230 if (cls.IsSignatureClass()) { |
| 3980 // | 4231 if (!cls.IsCanonicalSignatureClass()) { |
| 3981 // TODO(turnidge): Add this to the unit test. | 4232 // This is a typedef. Add it to the list of class names. |
| 3982 const Function& signature_func = Function::Handle(cls.signature_function()); | 4233 name = cls.UserVisibleName(); |
| 3983 if (signature_func.IsNull()) { | 4234 names.Add(name); |
| 4235 } else { |
| 4236 // Skip canonical signature classes. These are not named. |
| 4237 } |
| 4238 } else { |
| 3984 name = cls.UserVisibleName(); | 4239 name = cls.UserVisibleName(); |
| 3985 names.Add(name); | 4240 names.Add(name); |
| 3986 } | 4241 } |
| 3987 } | 4242 } |
| 3988 return Api::NewHandle(isolate, Array::MakeArray(names)); | 4243 return Api::NewHandle(isolate, Array::MakeArray(names)); |
| 3989 } | 4244 } |
| 3990 | 4245 |
| 3991 | 4246 |
| 3992 DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url) { | 4247 DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url) { |
| 3993 Isolate* isolate = Isolate::Current(); | 4248 Isolate* isolate = Isolate::Current(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4174 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { | 4429 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { |
| 4175 Dart::set_perf_events_writer(function); | 4430 Dart::set_perf_events_writer(function); |
| 4176 } | 4431 } |
| 4177 | 4432 |
| 4178 | 4433 |
| 4179 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { | 4434 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { |
| 4180 Dart::set_flow_graph_writer(function); | 4435 Dart::set_flow_graph_writer(function); |
| 4181 } | 4436 } |
| 4182 | 4437 |
| 4183 } // namespace dart | 4438 } // namespace dart |
| OLD | NEW |