mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:27:39 +00:00
Change trail from GrowableObjectArray to ZoneGrowableArray.
BUG= R=regis@google.com Review URL: https://codereview.chromium.org//1309113004 .
This commit is contained in:
parent
7624ec59da
commit
42f32322cb
|
@ -655,7 +655,7 @@ void ClassFinalizer::FinalizeTypeArguments(
|
|||
intptr_t num_uninitialized_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* pending_types,
|
||||
GrowableObjectArray* trail) {
|
||||
TrailPtr trail) {
|
||||
ASSERT(arguments.Length() >= cls.NumTypeArguments());
|
||||
if (!cls.is_type_finalized()) {
|
||||
FinalizeTypeParameters(cls, pending_types);
|
||||
|
@ -1092,10 +1092,9 @@ RawAbstractType* ClassFinalizer::FinalizeType(
|
|||
owner_class = type_class.raw();
|
||||
}
|
||||
if (offset > 0) {
|
||||
GrowableObjectArray& trail =
|
||||
GrowableObjectArray::Handle(isolate, GrowableObjectArray::New());
|
||||
TrailPtr trail = new Trail(4);
|
||||
FinalizeTypeArguments(owner_class, full_arguments, offset,
|
||||
&bound_error, pending_types, &trail);
|
||||
&bound_error, pending_types, trail);
|
||||
}
|
||||
if (full_arguments.IsRaw(0, num_type_arguments)) {
|
||||
// The parameterized_type is raw. Set its argument vector to null, which
|
||||
|
|
|
@ -7,23 +7,10 @@
|
|||
|
||||
#include "vm/allocation.h"
|
||||
#include "vm/growable_array.h"
|
||||
#include "vm/object.h"
|
||||
|
||||
namespace dart {
|
||||
|
||||
class AbstractType;
|
||||
class Class;
|
||||
class Error;
|
||||
class Function;
|
||||
class GrowableObjectArray;
|
||||
class MixinAppType;
|
||||
class RawAbstractType;
|
||||
class RawClass;
|
||||
class RawType;
|
||||
class Script;
|
||||
class Type;
|
||||
class TypeArguments;
|
||||
class UnresolvedClass;
|
||||
|
||||
// Traverses all pending, unfinalized classes, validates and marks them as
|
||||
// finalized.
|
||||
class ClassFinalizer : public AllStatic {
|
||||
|
@ -149,7 +136,7 @@ class ClassFinalizer : public AllStatic {
|
|||
intptr_t num_uninitialized_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* pending_types,
|
||||
GrowableObjectArray* trail);
|
||||
TrailPtr trail);
|
||||
static void CheckRecursiveType(const Class& cls,
|
||||
const Type& type,
|
||||
GrowableObjectArray* pending_types);
|
||||
|
|
|
@ -4459,7 +4459,7 @@ RawString* TypeArguments::SubvectorName(intptr_t from_index,
|
|||
bool TypeArguments::IsSubvectorEquivalent(const TypeArguments& other,
|
||||
intptr_t from_index,
|
||||
intptr_t len,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
if (this->raw() == other.raw()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -4656,7 +4656,7 @@ bool TypeArguments::IsResolved() const {
|
|||
|
||||
bool TypeArguments::IsSubvectorInstantiated(intptr_t from_index,
|
||||
intptr_t len,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
ASSERT(!IsNull());
|
||||
AbstractType& type = AbstractType::Handle();
|
||||
for (intptr_t i = 0; i < len; i++) {
|
||||
|
@ -4814,7 +4814,7 @@ bool TypeArguments::IsBounded() const {
|
|||
RawTypeArguments* TypeArguments::InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
ASSERT(!IsInstantiated());
|
||||
if (!instantiator_type_arguments.IsNull() &&
|
||||
IsUninstantiatedIdentity() &&
|
||||
|
@ -5048,7 +5048,7 @@ RawTypeArguments* TypeArguments::CloneUnfinalized() const {
|
|||
|
||||
RawTypeArguments* TypeArguments::CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
ASSERT(!IsNull());
|
||||
ASSERT(IsFinalized());
|
||||
ASSERT(!IsInstantiated());
|
||||
|
@ -5068,8 +5068,7 @@ RawTypeArguments* TypeArguments::CloneUninstantiated(
|
|||
}
|
||||
|
||||
|
||||
RawTypeArguments* TypeArguments::Canonicalize(
|
||||
GrowableObjectArray* trail) const {
|
||||
RawTypeArguments* TypeArguments::Canonicalize(TrailPtr trail) const {
|
||||
if (IsNull() || IsCanonical()) {
|
||||
ASSERT(IsOld());
|
||||
return this->raw();
|
||||
|
@ -14806,7 +14805,7 @@ intptr_t AbstractType::token_pos() const {
|
|||
}
|
||||
|
||||
|
||||
bool AbstractType::IsInstantiated(GrowableObjectArray* trail) const {
|
||||
bool AbstractType::IsInstantiated(TrailPtr trail) const {
|
||||
// AbstractType is an abstract class.
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
|
@ -14861,8 +14860,7 @@ void AbstractType::set_error(const LanguageError& value) const {
|
|||
}
|
||||
|
||||
|
||||
bool AbstractType::IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail) const {
|
||||
bool AbstractType::IsEquivalent(const Instance& other, TrailPtr trail) const {
|
||||
// AbstractType is an abstract class.
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
|
@ -14879,7 +14877,7 @@ bool AbstractType::IsRecursive() const {
|
|||
RawAbstractType* AbstractType::InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
// AbstractType is an abstract class.
|
||||
UNREACHABLE();
|
||||
return NULL;
|
||||
|
@ -14894,46 +14892,49 @@ RawAbstractType* AbstractType::CloneUnfinalized() const {
|
|||
|
||||
|
||||
RawAbstractType* AbstractType::CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail) const {
|
||||
const Class& new_owner, TrailPtr trail) const {
|
||||
// AbstractType is an abstract class.
|
||||
UNREACHABLE();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
RawAbstractType* AbstractType::Canonicalize(GrowableObjectArray* trail) const {
|
||||
RawAbstractType* AbstractType::Canonicalize(TrailPtr trail) const {
|
||||
// AbstractType is an abstract class.
|
||||
UNREACHABLE();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
RawObject* AbstractType::OnlyBuddyInTrail(GrowableObjectArray* trail) const {
|
||||
RawAbstractType* AbstractType::OnlyBuddyInTrail(TrailPtr trail) const {
|
||||
if (trail == NULL) {
|
||||
return Object::null();
|
||||
return AbstractType::null();
|
||||
}
|
||||
const intptr_t len = trail->Length();
|
||||
const intptr_t len = trail->length();
|
||||
ASSERT((len % 2) == 0);
|
||||
for (intptr_t i = 0; i < len; i += 2) {
|
||||
if (trail->At(i) == this->raw()) {
|
||||
ASSERT(trail->At(i + 1) != Object::null());
|
||||
return trail->At(i + 1);
|
||||
ASSERT(trail->At(i)->IsZoneHandle());
|
||||
ASSERT(trail->At(i + 1)->IsZoneHandle());
|
||||
if (trail->At(i)->raw() == this->raw()) {
|
||||
ASSERT(!trail->At(i + 1)->IsNull());
|
||||
return trail->At(i + 1)->raw();
|
||||
}
|
||||
}
|
||||
return Object::null();
|
||||
return AbstractType::null();
|
||||
}
|
||||
|
||||
|
||||
void AbstractType::AddOnlyBuddyToTrail(GrowableObjectArray** trail,
|
||||
const Object& buddy) const {
|
||||
void AbstractType::AddOnlyBuddyToTrail(TrailPtr* trail,
|
||||
const AbstractType& buddy) const {
|
||||
if (*trail == NULL) {
|
||||
*trail = &GrowableObjectArray::ZoneHandle(GrowableObjectArray::New());
|
||||
*trail = new Trail(4);
|
||||
} else {
|
||||
ASSERT(OnlyBuddyInTrail(*trail) == Object::null());
|
||||
ASSERT(OnlyBuddyInTrail(*trail) == AbstractType::null());
|
||||
}
|
||||
(*trail)->Add(*this);
|
||||
(*trail)->Add(buddy);
|
||||
AbstractType& t = AbstractType::ZoneHandle(this->raw());
|
||||
AbstractType& b = AbstractType::ZoneHandle(buddy.raw());
|
||||
(*trail)->Add(&t);
|
||||
(*trail)->Add(&b);
|
||||
}
|
||||
|
||||
|
||||
|
@ -15438,7 +15439,7 @@ RawTypeArguments* Type::arguments() const {
|
|||
}
|
||||
|
||||
|
||||
bool Type::IsInstantiated(GrowableObjectArray* trail) const {
|
||||
bool Type::IsInstantiated(TrailPtr trail) const {
|
||||
if (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) {
|
||||
return true;
|
||||
}
|
||||
|
@ -15472,7 +15473,7 @@ bool Type::IsInstantiated(GrowableObjectArray* trail) const {
|
|||
RawAbstractType* Type::InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
ASSERT(IsFinalized() || IsBeingFinalized());
|
||||
ASSERT(!IsInstantiated());
|
||||
// Return the uninstantiated type unchanged if malformed. No copy needed.
|
||||
|
@ -15518,8 +15519,7 @@ RawAbstractType* Type::InstantiateFrom(
|
|||
}
|
||||
|
||||
|
||||
bool Type::IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail) const {
|
||||
bool Type::IsEquivalent(const Instance& other, TrailPtr trail) const {
|
||||
ASSERT(!IsNull());
|
||||
if (raw() == other.raw()) {
|
||||
return true;
|
||||
|
@ -15614,7 +15614,7 @@ RawAbstractType* Type::CloneUnfinalized() const {
|
|||
|
||||
|
||||
RawAbstractType* Type::CloneUninstantiated(const Class& new_owner,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
ASSERT(IsFinalized());
|
||||
ASSERT(!IsMalformed());
|
||||
if (IsInstantiated()) {
|
||||
|
@ -15641,7 +15641,7 @@ RawAbstractType* Type::CloneUninstantiated(const Class& new_owner,
|
|||
}
|
||||
|
||||
|
||||
RawAbstractType* Type::Canonicalize(GrowableObjectArray* trail) const {
|
||||
RawAbstractType* Type::Canonicalize(TrailPtr trail) const {
|
||||
ASSERT(IsFinalized());
|
||||
if (IsCanonical() || IsMalformed()) {
|
||||
ASSERT(IsMalformed() || TypeArguments::Handle(arguments()).IsOld());
|
||||
|
@ -15889,7 +15889,7 @@ void Type::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
|||
}
|
||||
|
||||
|
||||
bool TypeRef::IsInstantiated(GrowableObjectArray* trail) const {
|
||||
bool TypeRef::IsInstantiated(TrailPtr trail) const {
|
||||
if (TestAndAddToTrail(&trail)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -15897,12 +15897,14 @@ bool TypeRef::IsInstantiated(GrowableObjectArray* trail) const {
|
|||
}
|
||||
|
||||
|
||||
bool TypeRef::IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail) const {
|
||||
bool TypeRef::IsEquivalent(const Instance& other, TrailPtr trail) const {
|
||||
if (raw() == other.raw()) {
|
||||
return true;
|
||||
}
|
||||
if (TestAndAddBuddyToTrail(&trail, other)) {
|
||||
if (!other.IsAbstractType()) {
|
||||
return false;
|
||||
}
|
||||
if (TestAndAddBuddyToTrail(&trail, AbstractType::Cast(other))) {
|
||||
return true;
|
||||
}
|
||||
return AbstractType::Handle(type()).IsEquivalent(other, trail);
|
||||
|
@ -15912,7 +15914,7 @@ bool TypeRef::IsEquivalent(const Instance& other,
|
|||
RawTypeRef* TypeRef::InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
TypeRef& instantiated_type_ref = TypeRef::Handle();
|
||||
instantiated_type_ref ^= OnlyBuddyInTrail(trail);
|
||||
if (!instantiated_type_ref.IsNull()) {
|
||||
|
@ -15931,7 +15933,7 @@ RawTypeRef* TypeRef::InstantiateFrom(
|
|||
|
||||
|
||||
RawTypeRef* TypeRef::CloneUninstantiated(const Class& new_owner,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
TypeRef& cloned_type_ref = TypeRef::Handle();
|
||||
cloned_type_ref ^= OnlyBuddyInTrail(trail);
|
||||
if (!cloned_type_ref.IsNull()) {
|
||||
|
@ -15959,7 +15961,7 @@ void TypeRef::set_type(const AbstractType& value) const {
|
|||
// Consider the type Derived, where class Derived extends Base<Derived>.
|
||||
// The first type argument of its flattened type argument vector is Derived,
|
||||
// represented by a TypeRef pointing to itself.
|
||||
RawAbstractType* TypeRef::Canonicalize(GrowableObjectArray* trail) const {
|
||||
RawAbstractType* TypeRef::Canonicalize(TrailPtr trail) const {
|
||||
if (TestAndAddToTrail(&trail)) {
|
||||
return raw();
|
||||
}
|
||||
|
@ -15980,38 +15982,43 @@ intptr_t TypeRef::Hash() const {
|
|||
}
|
||||
|
||||
|
||||
bool TypeRef::TestAndAddToTrail(GrowableObjectArray** trail) const {
|
||||
bool TypeRef::TestAndAddToTrail(TrailPtr* trail) const {
|
||||
if (*trail == NULL) {
|
||||
*trail = &GrowableObjectArray::ZoneHandle(GrowableObjectArray::New());
|
||||
*trail = new Trail(4);
|
||||
} else {
|
||||
const intptr_t len = (*trail)->Length();
|
||||
const intptr_t len = (*trail)->length();
|
||||
for (intptr_t i = 0; i < len; i++) {
|
||||
if ((*trail)->At(i) == this->raw()) {
|
||||
if ((*trail)->At(i)->raw() == this->raw()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
(*trail)->Add(*this);
|
||||
AbstractType& t = AbstractType::ZoneHandle(this->raw());
|
||||
(*trail)->Add(&t);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool TypeRef::TestAndAddBuddyToTrail(GrowableObjectArray** trail,
|
||||
const Object& buddy) const {
|
||||
bool TypeRef::TestAndAddBuddyToTrail(TrailPtr* trail,
|
||||
const AbstractType& buddy) const {
|
||||
if (*trail == NULL) {
|
||||
*trail = &GrowableObjectArray::ZoneHandle(GrowableObjectArray::New());
|
||||
*trail = new Trail(4);
|
||||
} else {
|
||||
const intptr_t len = (*trail)->Length();
|
||||
const intptr_t len = (*trail)->length();
|
||||
ASSERT((len % 2) == 0);
|
||||
for (intptr_t i = 0; i < len; i += 2) {
|
||||
if (((*trail)->At(i) == this->raw()) &&
|
||||
((*trail)->At(i + 1) == buddy.raw())) {
|
||||
ASSERT((*trail)->At(i)->IsZoneHandle());
|
||||
ASSERT((*trail)->At(i + 1)->IsZoneHandle());
|
||||
if (((*trail)->At(i)->raw() == this->raw()) &&
|
||||
((*trail)->At(i + 1)->raw() == buddy.raw())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
(*trail)->Add(*this);
|
||||
(*trail)->Add(buddy);
|
||||
AbstractType& t = AbstractType::ZoneHandle(this->raw());
|
||||
AbstractType& b = AbstractType::ZoneHandle(buddy.raw());
|
||||
(*trail)->Add(&t);
|
||||
(*trail)->Add(&b);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -16074,8 +16081,7 @@ void TypeParameter::set_is_finalized() const {
|
|||
}
|
||||
|
||||
|
||||
bool TypeParameter::IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail) const {
|
||||
bool TypeParameter::IsEquivalent(const Instance& other, TrailPtr trail) const {
|
||||
if (raw() == other.raw()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -16127,7 +16133,7 @@ void TypeParameter::set_bound(const AbstractType& value) const {
|
|||
RawAbstractType* TypeParameter::InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
ASSERT(IsFinalized());
|
||||
if (instantiator_type_arguments.IsNull()) {
|
||||
return Type::DynamicType();
|
||||
|
@ -16203,8 +16209,7 @@ RawAbstractType* TypeParameter::CloneUnfinalized() const {
|
|||
|
||||
|
||||
RawAbstractType* TypeParameter::CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail) const {
|
||||
const Class& new_owner, TrailPtr trail) const {
|
||||
ASSERT(IsFinalized());
|
||||
AbstractType& upper_bound = AbstractType::Handle(bound());
|
||||
upper_bound = upper_bound.CloneUninstantiated(new_owner, trail);
|
||||
|
@ -16327,8 +16332,7 @@ RawLanguageError* BoundedType::error() const {
|
|||
}
|
||||
|
||||
|
||||
bool BoundedType::IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail) const {
|
||||
bool BoundedType::IsEquivalent(const Instance& other, TrailPtr trail) const {
|
||||
// BoundedType are not canonicalized, because their bound may get finalized
|
||||
// after the BoundedType is created and initialized.
|
||||
if (raw() == other.raw()) {
|
||||
|
@ -16392,7 +16396,7 @@ void BoundedType::set_type_parameter(const TypeParameter& value) const {
|
|||
RawAbstractType* BoundedType::InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail) const {
|
||||
TrailPtr trail) const {
|
||||
ASSERT(IsFinalized());
|
||||
AbstractType& bounded_type = AbstractType::Handle(type());
|
||||
ASSERT(bounded_type.IsFinalized());
|
||||
|
@ -16448,8 +16452,7 @@ RawAbstractType* BoundedType::CloneUnfinalized() const {
|
|||
|
||||
|
||||
RawAbstractType* BoundedType::CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail) const {
|
||||
const Class& new_owner, TrailPtr trail) const {
|
||||
if (IsInstantiated()) {
|
||||
return raw();
|
||||
}
|
||||
|
|
|
@ -1527,6 +1527,9 @@ class UnresolvedClass : public Object {
|
|||
};
|
||||
|
||||
|
||||
typedef ZoneGrowableArray<const AbstractType*> Trail;
|
||||
typedef ZoneGrowableArray<const AbstractType*>* TrailPtr;
|
||||
|
||||
// A TypeArguments is an array of AbstractType.
|
||||
class TypeArguments : public Object {
|
||||
public:
|
||||
|
@ -1592,22 +1595,21 @@ class TypeArguments : public Object {
|
|||
return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length());
|
||||
}
|
||||
|
||||
bool IsEquivalent(const TypeArguments& other,
|
||||
GrowableObjectArray* trail = NULL) const {
|
||||
bool IsEquivalent(const TypeArguments& other, TrailPtr trail = NULL) const {
|
||||
return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length(), trail);
|
||||
}
|
||||
bool IsSubvectorEquivalent(const TypeArguments& other,
|
||||
intptr_t from_index,
|
||||
intptr_t len,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
|
||||
// Check if the vector is instantiated (it must not be null).
|
||||
bool IsInstantiated(GrowableObjectArray* trail = NULL) const {
|
||||
bool IsInstantiated(TrailPtr trail = NULL) const {
|
||||
return IsSubvectorInstantiated(0, Length(), trail);
|
||||
}
|
||||
bool IsSubvectorInstantiated(intptr_t from_index,
|
||||
intptr_t len,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
bool IsUninstantiatedIdentity() const;
|
||||
bool CanShareInstantiatorTypeArguments(const Class& instantiator_class) const;
|
||||
|
||||
|
@ -1628,11 +1630,10 @@ class TypeArguments : public Object {
|
|||
// arguments, changing the class owner of type parameters.
|
||||
// Instantiated type arguments are shared.
|
||||
RawTypeArguments* CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
const Class& new_owner, TrailPtr trail = NULL) const;
|
||||
|
||||
// Canonicalize only if instantiated, otherwise returns 'this'.
|
||||
RawTypeArguments* Canonicalize(GrowableObjectArray* trail = NULL) const;
|
||||
RawTypeArguments* Canonicalize(TrailPtr trail = NULL) const;
|
||||
|
||||
// Return 'this' if this type argument vector is instantiated, i.e. if it does
|
||||
// not refer to type parameters. Otherwise, return a new type argument vector
|
||||
|
@ -1642,7 +1643,7 @@ class TypeArguments : public Object {
|
|||
RawTypeArguments* InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
|
||||
// Runtime instantiation with canonicalization. Not to be used during type
|
||||
// finalization at compile time.
|
||||
|
@ -4971,15 +4972,14 @@ class AbstractType : public Instance {
|
|||
virtual RawUnresolvedClass* unresolved_class() const;
|
||||
virtual RawTypeArguments* arguments() const;
|
||||
virtual intptr_t token_pos() const;
|
||||
virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
|
||||
virtual bool IsInstantiated(TrailPtr trail = NULL) const;
|
||||
virtual bool CanonicalizeEquals(const Instance& other) const {
|
||||
return Equals(other);
|
||||
}
|
||||
virtual bool Equals(const Instance& other) const {
|
||||
return IsEquivalent(other);
|
||||
}
|
||||
virtual bool IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
|
||||
virtual bool IsRecursive() const;
|
||||
|
||||
// Instantiate this type using the given type argument vector.
|
||||
|
@ -4988,7 +4988,7 @@ class AbstractType : public Instance {
|
|||
virtual RawAbstractType* InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
|
||||
// Return a clone of this unfinalized type or the type itself if it is
|
||||
// already finalized. Apply recursively to type arguments, i.e. finalized
|
||||
|
@ -5001,25 +5001,22 @@ class AbstractType : public Instance {
|
|||
// Apply recursively to type arguments, i.e. instantiated type arguments of
|
||||
// an uninstantiated type are not cloned, but shared.
|
||||
virtual RawAbstractType* CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
const Class& new_owner, TrailPtr trail = NULL) const;
|
||||
|
||||
virtual RawInstance* CheckAndCanonicalize(const char** error_str) const {
|
||||
return Canonicalize();
|
||||
}
|
||||
|
||||
// Return the canonical version of this type.
|
||||
virtual RawAbstractType* Canonicalize(
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const;
|
||||
|
||||
// Return the object associated with the receiver in the trail or
|
||||
// Object::null() if the receiver is not contained in the trail.
|
||||
RawObject* OnlyBuddyInTrail(GrowableObjectArray* trail) const;
|
||||
// AbstractType::null() if the receiver is not contained in the trail.
|
||||
RawAbstractType* OnlyBuddyInTrail(TrailPtr trail) const;
|
||||
|
||||
// If the trail is null, allocate a trail, add the pair <receiver, buddy> to
|
||||
// the trail. The receiver may only be added once with its only buddy.
|
||||
void AddOnlyBuddyToTrail(GrowableObjectArray** trail,
|
||||
const Object& buddy) const;
|
||||
void AddOnlyBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const;
|
||||
|
||||
// The name of this type, including the names of its type arguments, if any.
|
||||
virtual RawString* Name() const {
|
||||
|
@ -5158,20 +5155,18 @@ class Type : public AbstractType {
|
|||
virtual RawTypeArguments* arguments() const;
|
||||
void set_arguments(const TypeArguments& value) const;
|
||||
virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
|
||||
virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
|
||||
virtual bool IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
virtual bool IsInstantiated(TrailPtr trail = NULL) const;
|
||||
virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
|
||||
virtual bool IsRecursive() const;
|
||||
virtual RawAbstractType* InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* malformed_error,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
virtual RawAbstractType* CloneUnfinalized() const;
|
||||
virtual RawAbstractType* CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
virtual RawAbstractType* Canonicalize(
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const;
|
||||
|
||||
virtual intptr_t Hash() const;
|
||||
|
||||
|
@ -5280,33 +5275,31 @@ class TypeRef : public AbstractType {
|
|||
virtual intptr_t token_pos() const {
|
||||
return AbstractType::Handle(type()).token_pos();
|
||||
}
|
||||
virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
|
||||
virtual bool IsInstantiated(TrailPtr trail = NULL) const;
|
||||
virtual bool IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
virtual bool IsRecursive() const { return true; }
|
||||
virtual RawTypeRef* InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
virtual RawTypeRef* CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
virtual RawAbstractType* Canonicalize(
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const;
|
||||
|
||||
virtual intptr_t Hash() const;
|
||||
|
||||
// Return true if the receiver is contained in the trail.
|
||||
// Otherwise, if the trail is null, allocate a trail, then add the receiver to
|
||||
// the trail and return false.
|
||||
bool TestAndAddToTrail(GrowableObjectArray** trail) const;
|
||||
bool TestAndAddToTrail(TrailPtr* trail) const;
|
||||
|
||||
// Return true if the pair <receiver, buddy> is contained in the trail.
|
||||
// Otherwise, if the trail is null, allocate a trail, add the pair <receiver,
|
||||
// buddy> to the trail and return false.
|
||||
// The receiver may be added several times, each time with a different buddy.
|
||||
bool TestAndAddBuddyToTrail(GrowableObjectArray** trail,
|
||||
const Object& buddy) const;
|
||||
bool TestAndAddBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const;
|
||||
|
||||
static intptr_t InstanceSize() {
|
||||
return RoundedAllocationSize(sizeof(RawTypeRef));
|
||||
|
@ -5361,22 +5354,19 @@ class TypeParameter : public AbstractType {
|
|||
const AbstractType& upper_bound,
|
||||
Error* bound_error) const;
|
||||
virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
|
||||
virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const {
|
||||
virtual bool IsInstantiated(TrailPtr trail = NULL) const {
|
||||
return false;
|
||||
}
|
||||
virtual bool IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
|
||||
virtual bool IsRecursive() const { return false; }
|
||||
virtual RawAbstractType* InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
virtual RawAbstractType* CloneUnfinalized() const;
|
||||
virtual RawAbstractType* CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
virtual RawAbstractType* Canonicalize(
|
||||
GrowableObjectArray* trail = NULL) const {
|
||||
const Class& new_owner, TrailPtr trail = NULL) const;
|
||||
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const {
|
||||
return raw();
|
||||
}
|
||||
|
||||
|
@ -5444,26 +5434,23 @@ class BoundedType : public AbstractType {
|
|||
virtual intptr_t token_pos() const {
|
||||
return AbstractType::Handle(type()).token_pos();
|
||||
}
|
||||
virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const {
|
||||
virtual bool IsInstantiated(TrailPtr trail = NULL) const {
|
||||
// It is not possible to encounter an instantiated bounded type with an
|
||||
// uninstantiated upper bound. Therefore, we do not need to check if the
|
||||
// bound is instantiated. Moreover, doing so could lead into cycles, as in
|
||||
// class C<T extends C<C>> { }.
|
||||
return AbstractType::Handle(type()).IsInstantiated();
|
||||
}
|
||||
virtual bool IsEquivalent(const Instance& other,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
|
||||
virtual bool IsRecursive() const;
|
||||
virtual RawAbstractType* InstantiateFrom(
|
||||
const TypeArguments& instantiator_type_arguments,
|
||||
Error* bound_error,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
TrailPtr trail = NULL) const;
|
||||
virtual RawAbstractType* CloneUnfinalized() const;
|
||||
virtual RawAbstractType* CloneUninstantiated(
|
||||
const Class& new_owner,
|
||||
GrowableObjectArray* trail = NULL) const;
|
||||
virtual RawAbstractType* Canonicalize(
|
||||
GrowableObjectArray* trail = NULL) const {
|
||||
const Class& new_owner, TrailPtr trail = NULL) const;
|
||||
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const {
|
||||
return raw();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue