Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Unified Diff: runtime/vm/object.cc

Issue 10103009: Implement implicit interfaces (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 6603)
+++ runtime/vm/object.cc (working copy)
@@ -1535,49 +1535,48 @@
other_type_arguments,
malformed_error);
}
- // Check for 'direct super type' in the case of an interface and check for
- // 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;
- }
+ // Check for 'direct super type' in the case of an interface
+ // (i.e. other.is_interface()) or implicit interface (i.e.
+ // !other.is_interface()) and check for transitivity at the same time.
+ 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()) {
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698