Index: runtime/vm/object.h |
=================================================================== |
--- runtime/vm/object.h (revision 463) |
+++ runtime/vm/object.h (working copy) |
@@ -391,6 +391,13 @@ |
return OFFSET_OF(RawClass, signature_function_); |
} |
+ // Return the signature type of this signature class. |
+ // For example, if this class represents a signature of the form |
+ // '<T, R>(T, [b: B, c: C]) => R', then its signature type is a parameterized |
+ // type with this class as the type class and type parameters 'T' and 'R' |
+ // as its type argument vector. |
+ RawType* SignatureType() const; |
+ |
RawLibrary* library() const { return raw_ptr()->library_; } |
void set_library(const Library& value) const; |
@@ -590,6 +597,7 @@ |
void set_name(const String& value) const; |
void set_script(const Script& value) const; |
void set_signature_function(const Function& value) const; |
+ void set_signature_type(const Type& value) const; |
void set_class_state(int8_t state) const; |
void set_constants(const Array& value) const; |
@@ -654,6 +662,7 @@ |
class Type : public Object { |
public: |
virtual bool IsFinalized() const; |
+ virtual bool IsBeingFinalized() const; |
virtual bool IsResolved() const; |
virtual bool HasResolvedTypeClass() const; |
virtual RawClass* type_class() const; |
@@ -798,7 +807,7 @@ |
return raw_ptr()->type_state_ == RawParameterizedType::kFinalized; |
} |
void set_is_finalized() const; |
- bool is_being_finalized() const { |
+ virtual bool IsBeingFinalized() const { |
return raw_ptr()->type_state_ == RawParameterizedType::kBeingFinalized; |
} |
void set_is_being_finalized() const; |
@@ -839,6 +848,7 @@ |
class TypeParameter : public Type { |
public: |
virtual bool IsFinalized() const { return true; } |
+ virtual bool IsBeingFinalized() const { return false; } |
virtual bool IsResolved() const { return true; } |
virtual bool HasResolvedTypeClass() const { return false; } |
virtual RawString* Name() const { return raw_ptr()->name_; } |
@@ -876,6 +886,7 @@ |
class InstantiatedType : public Type { |
public: |
virtual bool IsFinalized() const { return true; } |
+ virtual bool IsBeingFinalized() const { return false; } |
virtual bool IsResolved() const { return true; } |
virtual bool HasResolvedTypeClass() const { return true; } |
virtual RawClass* type_class() const; |
@@ -1041,8 +1052,26 @@ |
class Function : public Object { |
public: |
RawString* name() const { return raw_ptr()->name_; } |
- RawString* Signature() const; |
+ // Build a string of the form '<T, R>(T, [b: B, c: C]) => R' representing the |
+ // signature of the given function. |
+ RawString* Signature() const { |
+ return BuildSignature(false, TypeArguments::Handle(), 0); |
+ } |
+ |
+ // Build a string of the form '(A, [b: B, c: C]) => D' representing the |
+ // signature of the given function, where all generic types (e.g. '<T, R>' in |
+ // '<T, R>(T, [b: B, c: C]) => R') are instantiated using the given |
+ // instantiator type argument vector (e.g. '<A, D>'). |
+ RawString* InstantiatedSignatureFrom(const TypeArguments& instantiator, |
+ intptr_t offset) const { |
+ return BuildSignature(true, instantiator, offset); |
+ } |
+ |
+ // Returns true if the signature of this function is instantiated, i.e. if it |
+ // does not involve generic parameter types or generic result type. |
+ bool HasInstantiatedSignature() const; |
+ |
RawClass* owner() const { return raw_ptr()->owner_; } |
void set_owner(const Class& value) const; |
@@ -1232,6 +1261,10 @@ |
void set_implicit_closure_function(const Function& value) const; |
static RawFunction* New(); |
+ RawString* BuildSignature(bool instantiate, |
+ const TypeArguments& instantiator, |
+ intptr_t offset) const; |
+ |
// Checks the subtype or assignability relationship between the type of this |
// function and the type of the other function. |
bool TestType(TypeTestKind test, const Function& other) const; |