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

Unified Diff: runtime/vm/object.h

Issue 103913005: Introduce class TypeRef in the VM to fully support recursive types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 31085)
+++ runtime/vm/object.h (working copy)
@@ -4168,7 +4168,6 @@
virtual RawClass* type_class() const;
void set_type_class(const Object& value) const;
virtual RawUnresolvedClass* unresolved_class() const;
- RawString* TypeClassName() const;
virtual RawAbstractTypeArguments* arguments() const;
void set_arguments(const AbstractTypeArguments& value) const;
virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
@@ -4250,6 +4249,67 @@
};
+// A TypeRef is used to break cycles in the representation of recursive types.
+// Its only field is the recursive AbstractType it refers to.
+// Note that the cycle always involves type arguments.
+class TypeRef : public AbstractType {
+ public:
+ virtual bool IsFinalized() const {
+ return AbstractType::Handle(type()).IsFinalized();
+ }
+ virtual bool IsBeingFinalized() const {
+ return AbstractType::Handle(type()).IsBeingFinalized();
+ }
+ virtual bool IsMalformed() const {
+ return AbstractType::Handle(type()).IsMalformed();
+ }
+ virtual bool IsMalbounded() const {
+ return AbstractType::Handle(type()).IsMalbounded();
+ }
+ virtual bool IsMalformedOrMalbounded() const {
+ return AbstractType::Handle(type()).IsMalformedOrMalbounded();
+ }
+ virtual bool IsResolved() const { return true; }
+ virtual bool HasResolvedTypeClass() const { return true; }
+ RawAbstractType* type() const { return raw_ptr()->type_; }
+ void set_type(const AbstractType& value) const;
+ virtual RawClass* type_class() const {
+ return AbstractType::Handle(type()).type_class();
+ }
+ virtual RawAbstractTypeArguments* arguments() const {
+ return AbstractType::Handle(type()).arguments();
+ }
+ virtual intptr_t token_pos() const {
+ return AbstractType::Handle(type()).token_pos();
+ }
+ virtual bool IsInstantiated() const;
+ virtual bool Equals(const Instance& other) const;
+ virtual RawAbstractType* InstantiateFrom(
+ const AbstractTypeArguments& instantiator_type_arguments,
+ Error* bound_error) const;
+ virtual RawAbstractType* Canonicalize() const;
+
+ virtual intptr_t Hash() const;
+
+ static intptr_t InstanceSize() {
+ return RoundedAllocationSize(sizeof(RawTypeRef));
+ }
+
+ static RawTypeRef* New(const AbstractType& type);
+
+ private:
+ bool is_being_checked() const {
+ return raw_ptr()->is_being_checked_;
+ }
+ void set_is_being_checked(bool value) const;
+
+ static RawTypeRef* New();
+
+ FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeRef, AbstractType);
+ friend class Class;
+};
+
+
// A TypeParameter represents a type parameter of a parameterized class.
// It specifies its index (and its name for debugging purposes), as well as its
// upper bound.
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698