Chromium Code Reviews| Index: runtime/vm/object.cc |
| =================================================================== |
| --- runtime/vm/object.cc (revision 6603) |
| +++ runtime/vm/object.cc (working copy) |
| @@ -1537,47 +1537,45 @@ |
| } |
| // Check for 'direct super type' in the case of an interface and check for |
|
regis
2012/04/16 22:14:52
You could clarify the comment:
... in the case of
hausner
2012/04/16 23:19:09
Done.
|
| // transitivity at the same time. |
| - if (other.is_interface()) { |
| - Array& interfaces = Array::Handle(this->interfaces()); |
| - AbstractType& interface = AbstractType::Handle(); |
| - Class& interface_class = Class::Handle(); |
| - AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle(); |
| - for (intptr_t i = 0; i < interfaces.Length(); i++) { |
| - interface ^= interfaces.At(i); |
| - interface_class = interface.type_class(); |
| - interface_args = interface.arguments(); |
| - if (!interface_args.IsNull() && !interface_args.IsInstantiated()) { |
| - // This type class implements an interface that is parameterized with |
| - // generic type(s), e.g. it implements List<T>. |
| - // The uninstantiated type T must be instantiated using the type |
| - // parameters of this type before performing the type test. |
| - // The type arguments of this type that are referred to by the type |
| - // parameters of the interface are at the end of the type vector, |
| - // after the type arguments of the super type of this type. |
| - // The index of the type parameters is adjusted upon finalization. |
| - ASSERT(interface.IsFinalized()); |
| - interface_args = interface_args.InstantiateFrom(type_arguments); |
| - // In checked mode, verify that the instantiated interface type |
| - // arguments are within the bounds specified by the interface class. |
| - // Note that the additional bounds check in checked mode may lead to a |
| - // dynamic type error, but it will never change the result of the type |
| - // check from true in production mode to false in checked mode. |
| - if (FLAG_enable_type_checks && !interface_args.IsNull()) { |
| - // Pass type_arguments as bounds instantiator. |
| - if (!interface_args.IsWithinBoundsOf(interface_class, |
| - type_arguments, |
| - malformed_error)) { |
| - continue; |
| - } |
| + Array& interfaces = Array::Handle(this->interfaces()); |
| + AbstractType& interface = AbstractType::Handle(); |
| + Class& interface_class = Class::Handle(); |
| + AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle(); |
| + for (intptr_t i = 0; i < interfaces.Length(); i++) { |
| + interface ^= interfaces.At(i); |
| + interface_class = interface.type_class(); |
| + interface_args = interface.arguments(); |
| + if (!interface_args.IsNull() && !interface_args.IsInstantiated()) { |
| + // This type class implements an interface that is parameterized with |
| + // generic type(s), e.g. it implements List<T>. |
| + // The uninstantiated type T must be instantiated using the type |
| + // parameters of this type before performing the type test. |
| + // The type arguments of this type that are referred to by the type |
| + // parameters of the interface are at the end of the type vector, |
| + // after the type arguments of the super type of this type. |
| + // The index of the type parameters is adjusted upon finalization. |
| + ASSERT(interface.IsFinalized()); |
| + interface_args = interface_args.InstantiateFrom(type_arguments); |
| + // In checked mode, verify that the instantiated interface type |
| + // arguments are within the bounds specified by the interface class. |
| + // Note that the additional bounds check in checked mode may lead to a |
| + // dynamic type error, but it will never change the result of the type |
| + // check from true in production mode to false in checked mode. |
| + if (FLAG_enable_type_checks && !interface_args.IsNull()) { |
| + // Pass type_arguments as bounds instantiator. |
| + if (!interface_args.IsWithinBoundsOf(interface_class, |
| + type_arguments, |
| + malformed_error)) { |
| + continue; |
| } |
| } |
| - if (interface_class.IsSubtypeOf(interface_args, |
| - other, |
| - other_type_arguments, |
| - malformed_error)) { |
| - return true; |
| - } |
| } |
| + if (interface_class.IsSubtypeOf(interface_args, |
| + other, |
| + other_type_arguments, |
| + malformed_error)) { |
| + return true; |
| + } |
| } |
| // Check the interface case. |
| if (is_interface()) { |