| 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 "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2063 return field.raw(); | 2063 return field.raw(); |
| 2064 } | 2064 } |
| 2065 } | 2065 } |
| 2066 // No field found. | 2066 // No field found. |
| 2067 return Field::null(); | 2067 return Field::null(); |
| 2068 } | 2068 } |
| 2069 | 2069 |
| 2070 | 2070 |
| 2071 RawLibraryPrefix* Class::LookupLibraryPrefix(const String& name) const { | 2071 RawLibraryPrefix* Class::LookupLibraryPrefix(const String& name) const { |
| 2072 Isolate* isolate = Isolate::Current(); | 2072 Isolate* isolate = Isolate::Current(); |
| 2073 LibraryPrefix& lib_prefix = LibraryPrefix::Handle(isolate, | |
| 2074 LibraryPrefix::null()); | |
| 2075 const Library& lib = Library::Handle(isolate, library()); | 2073 const Library& lib = Library::Handle(isolate, library()); |
| 2076 Object& obj = Object::Handle(isolate, lib.LookupLocalObject(name)); | 2074 const Object& obj = Object::Handle(isolate, lib.LookupLocalObject(name)); |
| 2077 if (!obj.IsNull()) { | 2075 if (!obj.IsNull() && obj.IsLibraryPrefix()) { |
| 2078 if (obj.IsLibraryPrefix()) { | 2076 const LibraryPrefix& lib_prefix = LibraryPrefix::Cast(obj); |
| 2079 lib_prefix ^= obj.raw(); | 2077 return lib_prefix.raw(); |
| 2080 } | |
| 2081 } | 2078 } |
| 2082 return lib_prefix.raw(); | 2079 return LibraryPrefix::null(); |
| 2083 } | 2080 } |
| 2084 | 2081 |
| 2085 | 2082 |
| 2086 const char* Class::ToCString() const { | 2083 const char* Class::ToCString() const { |
| 2087 const char* format = is_interface() | 2084 const char* format = is_interface() |
| 2088 ? "%s Interface: %s" : "%s Class: %s"; | 2085 ? "%s Interface: %s" : "%s Class: %s"; |
| 2089 const Library& lib = Library::Handle(library()); | 2086 const Library& lib = Library::Handle(library()); |
| 2090 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); | 2087 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); |
| 2091 const char* class_name = String::Handle(Name()).ToCString(); | 2088 const char* class_name = String::Handle(Name()).ToCString(); |
| 2092 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; | 2089 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2435 // is a subtype of V, or vice versa. We only return true if K == V, i.e. if | 2432 // is a subtype of V, or vice versa. We only return true if K == V, i.e. if |
| 2436 // they have the same index (both are finalized, so their indices are | 2433 // they have the same index (both are finalized, so their indices are |
| 2437 // comparable). | 2434 // comparable). |
| 2438 // The same rule applies When checking the upper bound of a still | 2435 // The same rule applies When checking the upper bound of a still |
| 2439 // uninstantiated type at compile time. Returning false will defer the test | 2436 // uninstantiated type at compile time. Returning false will defer the test |
| 2440 // to run time. But there are cases where it can be decided at compile time. | 2437 // to run time. But there are cases where it can be decided at compile time. |
| 2441 // For example, with class A<K, V extends K>, new A<T, T> called from within | 2438 // For example, with class A<K, V extends K>, new A<T, T> called from within |
| 2442 // a class B<T> will never require a run time bounds check, even it T is | 2439 // a class B<T> will never require a run time bounds check, even it T is |
| 2443 // uninstantiated at compile time. | 2440 // uninstantiated at compile time. |
| 2444 if (IsTypeParameter()) { | 2441 if (IsTypeParameter()) { |
| 2445 // TODO(regis): Introduce and use TypeParameter::Cast(). | 2442 const TypeParameter& type_param = TypeParameter::Cast(*this); |
| 2446 const TypeParameter* type_param = | |
| 2447 reinterpret_cast<const TypeParameter*>(this); | |
| 2448 if (other.IsTypeParameter()) { | 2443 if (other.IsTypeParameter()) { |
| 2449 const TypeParameter* other_type_param = | 2444 const TypeParameter& other_type_param = TypeParameter::Cast(other); |
| 2450 reinterpret_cast<const TypeParameter*>(&other); | 2445 return type_param.index() == other_type_param.index(); |
| 2451 return type_param->index() == other_type_param->index(); | |
| 2452 } else if (FLAG_enable_type_checks) { | 2446 } else if (FLAG_enable_type_checks) { |
| 2453 // In checked mode, if the upper bound of this type is more specific than | 2447 // In checked mode, if the upper bound of this type is more specific than |
| 2454 // the other type, then this type is more specific than the other type. | 2448 // the other type, then this type is more specific than the other type. |
| 2455 const AbstractType& type_param_bound = | 2449 const AbstractType& type_param_bound = |
| 2456 AbstractType::Handle(type_param->bound()); | 2450 AbstractType::Handle(type_param.bound()); |
| 2457 if (type_param_bound.IsMoreSpecificThan(other, malformed_error)) { | 2451 if (type_param_bound.IsMoreSpecificThan(other, malformed_error)) { |
| 2458 return true; | 2452 return true; |
| 2459 } | 2453 } |
| 2460 } | 2454 } |
| 2461 return false; | 2455 return false; |
| 2462 } | 2456 } |
| 2463 if (other.IsTypeParameter()) { | 2457 if (other.IsTypeParameter()) { |
| 2464 return false; | 2458 return false; |
| 2465 } | 2459 } |
| 2466 const Class& cls = Class::Handle(type_class()); | 2460 const Class& cls = Class::Handle(type_class()); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2837 } | 2831 } |
| 2838 | 2832 |
| 2839 | 2833 |
| 2840 bool TypeParameter::Equals(const AbstractType& other) const { | 2834 bool TypeParameter::Equals(const AbstractType& other) const { |
| 2841 if (raw() == other.raw()) { | 2835 if (raw() == other.raw()) { |
| 2842 return true; | 2836 return true; |
| 2843 } | 2837 } |
| 2844 if (!other.IsTypeParameter()) { | 2838 if (!other.IsTypeParameter()) { |
| 2845 return false; | 2839 return false; |
| 2846 } | 2840 } |
| 2847 TypeParameter& other_type_param = TypeParameter::Handle(); | 2841 const TypeParameter& other_type_param = TypeParameter::Cast(other); |
| 2848 other_type_param ^= other.raw(); | |
| 2849 if (IsFinalized() != other_type_param.IsFinalized()) { | 2842 if (IsFinalized() != other_type_param.IsFinalized()) { |
| 2850 return false; | 2843 return false; |
| 2851 } | 2844 } |
| 2852 if (parameterized_class() != other_type_param.parameterized_class()) { | 2845 if (parameterized_class() != other_type_param.parameterized_class()) { |
| 2853 return false; | 2846 return false; |
| 2854 } | 2847 } |
| 2855 if (index() != other_type_param.index()) { | 2848 if (index() != other_type_param.index()) { |
| 2856 return false; | 2849 return false; |
| 2857 } | 2850 } |
| 2858 const String& name = String::Handle(Name()); | 2851 const String& name = String::Handle(Name()); |
| 2859 const String& other_type_param_name = String::Handle(other_type_param.Name()); | 2852 const String& other_type_param_name = String::Handle(other_type_param.Name()); |
| 2860 return name.Equals(other_type_param_name); | 2853 return name.Equals(other_type_param_name); |
| 2861 } | 2854 } |
| 2862 | 2855 |
| 2863 | 2856 |
| 2864 bool TypeParameter::IsIdentical(const AbstractType& other, | 2857 bool TypeParameter::IsIdentical(const AbstractType& other, |
| 2865 bool check_type_parameter_bound) const { | 2858 bool check_type_parameter_bound) const { |
| 2866 if (raw() == other.raw()) { | 2859 if (raw() == other.raw()) { |
| 2867 return true; | 2860 return true; |
| 2868 } | 2861 } |
| 2869 if (!other.IsTypeParameter()) { | 2862 if (!other.IsTypeParameter()) { |
| 2870 return false; | 2863 return false; |
| 2871 } | 2864 } |
| 2872 TypeParameter& other_type_param = TypeParameter::Handle(); | 2865 const TypeParameter& other_type_param = TypeParameter::Cast(other); |
| 2873 other_type_param ^= other.raw(); | |
| 2874 // IsIdentical may be called on type parameters belonging to different | 2866 // IsIdentical may be called on type parameters belonging to different |
| 2875 // classes, e.g. to an interface and to its default factory class. | 2867 // classes, e.g. to an interface and to its default factory class. |
| 2876 // Therefore, both type parameters may have different parameterized classes | 2868 // Therefore, both type parameters may have different parameterized classes |
| 2877 // and different indices. Compare the type parameter names only, and their | 2869 // and different indices. Compare the type parameter names only, and their |
| 2878 // bounds if requested. | 2870 // bounds if requested. |
| 2879 String& name = String::Handle(Name()); | 2871 String& name = String::Handle(Name()); |
| 2880 String& other_name = String::Handle(other_type_param.Name()); | 2872 String& other_name = String::Handle(other_type_param.Name()); |
| 2881 if (!name.Equals(other_name)) { | 2873 if (!name.Equals(other_name)) { |
| 2882 return false; | 2874 return false; |
| 2883 } | 2875 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3095 if (arguments.IsNull() || other_arguments.IsNull()) { | 3087 if (arguments.IsNull() || other_arguments.IsNull()) { |
| 3096 return false; | 3088 return false; |
| 3097 } | 3089 } |
| 3098 intptr_t num_types = arguments.Length(); | 3090 intptr_t num_types = arguments.Length(); |
| 3099 if (num_types != other_arguments.Length()) { | 3091 if (num_types != other_arguments.Length()) { |
| 3100 return false; | 3092 return false; |
| 3101 } | 3093 } |
| 3102 AbstractType& type = AbstractType::Handle(); | 3094 AbstractType& type = AbstractType::Handle(); |
| 3103 AbstractType& other_type = AbstractType::Handle(); | 3095 AbstractType& other_type = AbstractType::Handle(); |
| 3104 for (intptr_t i = 0; i < num_types; i++) { | 3096 for (intptr_t i = 0; i < num_types; i++) { |
| 3105 type ^= arguments.TypeAt(i); | 3097 type = arguments.TypeAt(i); |
| 3106 ASSERT(!type.IsNull()); | 3098 ASSERT(!type.IsNull()); |
| 3107 other_type ^= other_arguments.TypeAt(i); | 3099 other_type = other_arguments.TypeAt(i); |
| 3108 if (!type.IsIdentical(other_type, check_type_parameter_bounds)) { | 3100 if (!type.IsIdentical(other_type, check_type_parameter_bounds)) { |
| 3109 return false; | 3101 return false; |
| 3110 } | 3102 } |
| 3111 } | 3103 } |
| 3112 return true; | 3104 return true; |
| 3113 } | 3105 } |
| 3114 | 3106 |
| 3115 | 3107 |
| 3116 RawAbstractTypeArguments* AbstractTypeArguments::InstantiateFrom( | 3108 RawAbstractTypeArguments* AbstractTypeArguments::InstantiateFrom( |
| 3117 const AbstractTypeArguments& instantiator_type_arguments) const { | 3109 const AbstractTypeArguments& instantiator_type_arguments) const { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3166 const Class& cls, | 3158 const Class& cls, |
| 3167 const AbstractTypeArguments& bounds_instantiator, | 3159 const AbstractTypeArguments& bounds_instantiator, |
| 3168 Error* malformed_error) const { | 3160 Error* malformed_error) const { |
| 3169 ASSERT(FLAG_enable_type_checks); | 3161 ASSERT(FLAG_enable_type_checks); |
| 3170 // This function may be called at compile time on (partially) uninstantiated | 3162 // This function may be called at compile time on (partially) uninstantiated |
| 3171 // type arguments and may return true, in which case a run time bounds check | 3163 // type arguments and may return true, in which case a run time bounds check |
| 3172 // can be avoided. | 3164 // can be avoided. |
| 3173 ASSERT(Length() >= cls.NumTypeArguments()); | 3165 ASSERT(Length() >= cls.NumTypeArguments()); |
| 3174 const intptr_t num_type_params = cls.NumTypeParameters(); | 3166 const intptr_t num_type_params = cls.NumTypeParameters(); |
| 3175 const intptr_t offset = cls.NumTypeArguments() - num_type_params; | 3167 const intptr_t offset = cls.NumTypeArguments() - num_type_params; |
| 3176 AbstractType& type = AbstractType::Handle(); | 3168 AbstractType& this_type_arg = AbstractType::Handle(); |
| 3177 TypeParameter& type_param = TypeParameter::Handle(); | 3169 AbstractType& cls_type_arg = AbstractType::Handle(); |
| 3178 AbstractType& bound = AbstractType::Handle(); | 3170 AbstractType& bound = AbstractType::Handle(); |
| 3179 const TypeArguments& type_params = | 3171 const TypeArguments& cls_type_params = |
| 3180 TypeArguments::Handle(cls.type_parameters()); | 3172 TypeArguments::Handle(cls.type_parameters()); |
| 3181 ASSERT((type_params.IsNull() && (num_type_params == 0)) || | 3173 ASSERT((cls_type_params.IsNull() && (num_type_params == 0)) || |
| 3182 (type_params.Length() == num_type_params)); | 3174 (cls_type_params.Length() == num_type_params)); |
| 3183 for (intptr_t i = 0; i < num_type_params; i++) { | 3175 for (intptr_t i = 0; i < num_type_params; i++) { |
| 3184 type_param ^= type_params.TypeAt(i); | 3176 cls_type_arg = cls_type_params.TypeAt(i); |
| 3185 bound = type_param.bound(); | 3177 const TypeParameter& cls_type_param = TypeParameter::Cast(cls_type_arg); |
| 3178 bound = cls_type_param.bound(); |
| 3186 if (!bound.IsDynamicType()) { | 3179 if (!bound.IsDynamicType()) { |
| 3187 type = TypeAt(offset + i); | 3180 this_type_arg = TypeAt(offset + i); |
| 3188 Error& malformed_bound_error = Error::Handle(); | 3181 Error& malformed_bound_error = Error::Handle(); |
| 3189 if (bound.IsMalformed()) { | 3182 if (bound.IsMalformed()) { |
| 3190 malformed_bound_error = bound.malformed_error(); | 3183 malformed_bound_error = bound.malformed_error(); |
| 3191 } else if (!bound.IsInstantiated()) { | 3184 } else if (!bound.IsInstantiated()) { |
| 3192 bound = bound.InstantiateFrom(bounds_instantiator); | 3185 bound = bound.InstantiateFrom(bounds_instantiator); |
| 3193 } | 3186 } |
| 3194 if (!malformed_bound_error.IsNull() || | 3187 if (!malformed_bound_error.IsNull() || |
| 3195 !type.IsSubtypeOf(bound, malformed_error)) { | 3188 !this_type_arg.IsSubtypeOf(bound, malformed_error)) { |
| 3196 // Ignore this bound error if another malformed error was already | 3189 // Ignore this bound error if another malformed error was already |
| 3197 // reported for this type test. | 3190 // reported for this type test. |
| 3198 if (malformed_error->IsNull()) { | 3191 if (malformed_error->IsNull()) { |
| 3199 const String& type_argument_name = String::Handle(type.Name()); | 3192 const String& type_arg_name = String::Handle(this_type_arg.Name()); |
| 3200 const String& class_name = String::Handle(cls.Name()); | 3193 const String& class_name = String::Handle(cls.Name()); |
| 3201 const String& bound_name = String::Handle(bound.Name()); | 3194 const String& bound_name = String::Handle(bound.Name()); |
| 3202 const Script& script = Script::Handle(cls.script()); | 3195 const Script& script = Script::Handle(cls.script()); |
| 3203 // Since the bound was canonicalized, its token index was lost, | 3196 // Since the bound was canonicalized, its token index was lost, |
| 3204 // therefore, use the token index of the corresponding type parameter. | 3197 // therefore, use the token index of the corresponding type parameter. |
| 3205 const TypeArguments& type_parameters = | |
| 3206 TypeArguments::Handle(cls.type_parameters()); | |
| 3207 type = type_parameters.TypeAt(i); | |
| 3208 *malformed_error ^= FormatError(malformed_bound_error, | 3198 *malformed_error ^= FormatError(malformed_bound_error, |
| 3209 script, type.token_pos(), | 3199 script, cls_type_param.token_pos(), |
| 3210 "type argument '%s' does not " | 3200 "type argument '%s' does not " |
| 3211 "extend bound '%s' of '%s'\n", | 3201 "extend bound '%s' of '%s'\n", |
| 3212 type_argument_name.ToCString(), | 3202 type_arg_name.ToCString(), |
| 3213 bound_name.ToCString(), | 3203 bound_name.ToCString(), |
| 3214 class_name.ToCString()); | 3204 class_name.ToCString()); |
| 3215 } | 3205 } |
| 3216 return false; | 3206 return false; |
| 3217 } | 3207 } |
| 3218 } | 3208 } |
| 3219 } | 3209 } |
| 3220 const Class& super_class = Class::Handle(cls.SuperClass()); | 3210 const Class& super_class = Class::Handle(cls.SuperClass()); |
| 3221 if (!super_class.IsNull() && | 3211 if (!super_class.IsNull() && |
| 3222 !IsWithinBoundsOf(super_class, bounds_instantiator, malformed_error)) { | 3212 !IsWithinBoundsOf(super_class, bounds_instantiator, malformed_error)) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3306 | 3296 |
| 3307 bool TypeArguments::IsUninstantiatedIdentity() const { | 3297 bool TypeArguments::IsUninstantiatedIdentity() const { |
| 3308 ASSERT(!IsInstantiated()); | 3298 ASSERT(!IsInstantiated()); |
| 3309 AbstractType& type = AbstractType::Handle(); | 3299 AbstractType& type = AbstractType::Handle(); |
| 3310 intptr_t num_types = Length(); | 3300 intptr_t num_types = Length(); |
| 3311 for (intptr_t i = 0; i < num_types; i++) { | 3301 for (intptr_t i = 0; i < num_types; i++) { |
| 3312 type = TypeAt(i); | 3302 type = TypeAt(i); |
| 3313 if (!type.IsTypeParameter()) { | 3303 if (!type.IsTypeParameter()) { |
| 3314 return false; | 3304 return false; |
| 3315 } | 3305 } |
| 3316 // TODO(regis): Introduce and use TypeParameter::Cast(). | 3306 const TypeParameter& type_param = TypeParameter::Cast(type); |
| 3317 TypeParameter* type_param = reinterpret_cast<TypeParameter*>(&type); | 3307 if ((type_param.index() != i)) { |
| 3318 if ((type_param->index() != i)) { | |
| 3319 return false; | 3308 return false; |
| 3320 } | 3309 } |
| 3321 } | 3310 } |
| 3322 return true; | 3311 return true; |
| 3323 } | 3312 } |
| 3324 | 3313 |
| 3325 | 3314 |
| 3326 RawAbstractTypeArguments* TypeArguments::InstantiateFrom( | 3315 RawAbstractTypeArguments* TypeArguments::InstantiateFrom( |
| 3327 const AbstractTypeArguments& instantiator_type_arguments) const { | 3316 const AbstractTypeArguments& instantiator_type_arguments) const { |
| 3328 ASSERT(!IsInstantiated()); | 3317 ASSERT(!IsInstantiated()); |
| (...skipping 3880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7209 ASSERT(other.IsFinalized()); | 7198 ASSERT(other.IsFinalized()); |
| 7210 ASSERT(!other.IsDynamicType()); | 7199 ASSERT(!other.IsDynamicType()); |
| 7211 ASSERT(!other.IsVoidType()); | 7200 ASSERT(!other.IsVoidType()); |
| 7212 ASSERT(!other.IsMalformed()); | 7201 ASSERT(!other.IsMalformed()); |
| 7213 if (IsNull()) { | 7202 if (IsNull()) { |
| 7214 Class& other_class = Class::Handle(); | 7203 Class& other_class = Class::Handle(); |
| 7215 if (other.IsTypeParameter()) { | 7204 if (other.IsTypeParameter()) { |
| 7216 if (other_instantiator.IsNull()) { | 7205 if (other_instantiator.IsNull()) { |
| 7217 return true; // Other type is uninstantiated, i.e. Dynamic. | 7206 return true; // Other type is uninstantiated, i.e. Dynamic. |
| 7218 } | 7207 } |
| 7219 // TODO(regis): Introduce and use TypeParameter::Cast(). | 7208 const TypeParameter& other_type_param = TypeParameter::Cast(other); |
| 7220 const TypeParameter* other_type_param = | |
| 7221 reinterpret_cast<const TypeParameter*>(&other); | |
| 7222 const AbstractType& instantiated_other = AbstractType::Handle( | 7209 const AbstractType& instantiated_other = AbstractType::Handle( |
| 7223 other_instantiator.TypeAt(other_type_param->index())); | 7210 other_instantiator.TypeAt(other_type_param.index())); |
| 7224 ASSERT(instantiated_other.IsInstantiated()); | 7211 ASSERT(instantiated_other.IsInstantiated()); |
| 7225 other_class = instantiated_other.type_class(); | 7212 other_class = instantiated_other.type_class(); |
| 7226 } else { | 7213 } else { |
| 7227 other_class = other.type_class(); | 7214 other_class = other.type_class(); |
| 7228 } | 7215 } |
| 7229 return other_class.IsObjectClass() || other_class.IsDynamicClass(); | 7216 return other_class.IsObjectClass() || other_class.IsDynamicClass(); |
| 7230 } | 7217 } |
| 7231 const Class& cls = Class::Handle(clazz()); | 7218 const Class& cls = Class::Handle(clazz()); |
| 7232 // We must not encounter Object::sentinel() or Object::transition_sentinel(), | 7219 // We must not encounter Object::sentinel() or Object::transition_sentinel(), |
| 7233 // both instances of class NullClass, but not instance Object::null(). | 7220 // both instances of class NullClass, but not instance Object::null(). |
| (...skipping 20 matching lines...) Expand all Loading... |
| 7254 Class& other_class = Class::Handle(); | 7241 Class& other_class = Class::Handle(); |
| 7255 AbstractTypeArguments& other_type_arguments = AbstractTypeArguments::Handle(); | 7242 AbstractTypeArguments& other_type_arguments = AbstractTypeArguments::Handle(); |
| 7256 // In case 'other' is not instantiated, we could simply call | 7243 // In case 'other' is not instantiated, we could simply call |
| 7257 // other.InstantiateFrom(other_instantiator), however, we can save the | 7244 // other.InstantiateFrom(other_instantiator), however, we can save the |
| 7258 // allocation of a new AbstractType by inlining the code. | 7245 // allocation of a new AbstractType by inlining the code. |
| 7259 if (other.IsTypeParameter()) { | 7246 if (other.IsTypeParameter()) { |
| 7260 if (other_instantiator.IsNull()) { | 7247 if (other_instantiator.IsNull()) { |
| 7261 // An uninstantiated type parameter is equivalent to Dynamic. | 7248 // An uninstantiated type parameter is equivalent to Dynamic. |
| 7262 return true; | 7249 return true; |
| 7263 } | 7250 } |
| 7264 const TypeParameter* other_type_param = | 7251 const TypeParameter& other_type_param = TypeParameter::Cast(other); |
| 7265 reinterpret_cast<const TypeParameter*>(&other); | |
| 7266 AbstractType& instantiated_other = AbstractType::Handle( | 7252 AbstractType& instantiated_other = AbstractType::Handle( |
| 7267 other_instantiator.TypeAt(other_type_param->index())); | 7253 other_instantiator.TypeAt(other_type_param.index())); |
| 7268 if (instantiated_other.IsDynamicType() || | 7254 if (instantiated_other.IsDynamicType() || |
| 7269 instantiated_other.IsTypeParameter()) { | 7255 instantiated_other.IsTypeParameter()) { |
| 7270 return true; | 7256 return true; |
| 7271 } | 7257 } |
| 7272 other_class = instantiated_other.type_class(); | 7258 other_class = instantiated_other.type_class(); |
| 7273 other_type_arguments = instantiated_other.arguments(); | 7259 other_type_arguments = instantiated_other.arguments(); |
| 7274 } else { | 7260 } else { |
| 7275 other_class = other.type_class(); | 7261 other_class = other.type_class(); |
| 7276 other_type_arguments = other.arguments(); | 7262 other_type_arguments = other.arguments(); |
| 7277 if (!other_type_arguments.IsNull() && | 7263 if (!other_type_arguments.IsNull() && |
| (...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10272 const String& str = String::Handle(pattern()); | 10258 const String& str = String::Handle(pattern()); |
| 10273 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10259 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10274 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10260 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10275 char* chars = reinterpret_cast<char*>( | 10261 char* chars = reinterpret_cast<char*>( |
| 10276 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10262 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10277 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10263 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10278 return chars; | 10264 return chars; |
| 10279 } | 10265 } |
| 10280 | 10266 |
| 10281 } // namespace dart | 10267 } // namespace dart |
| OLD | NEW |