@@ -369,6 +369,10 @@ class Type
369
369
// / are returned without modification.
370
370
virtual TypeResult interfaceType (bool /* _inLibrary*/ ) const { return nullptr ; }
371
371
372
+ // / @returns the declaration of a user defined type (enum, struct, user defined value type).
373
+ // / Returns nullptr otherwise.
374
+ virtual Declaration const * typeDefinition () const { return nullptr ; }
375
+
372
376
// / Clears all internally cached values (if any).
373
377
virtual void clearCache () const ;
374
378
@@ -1004,6 +1008,8 @@ class StructType: public ReferenceType
1004
1008
Type const * encodingType () const override ;
1005
1009
TypeResult interfaceType (bool _inLibrary) const override ;
1006
1010
1011
+ Declaration const * typeDefinition () const override ;
1012
+
1007
1013
BoolResult validForLocation (DataLocation _loc) const override ;
1008
1014
1009
1015
bool recursive () const ;
@@ -1069,6 +1075,8 @@ class EnumType: public Type
1069
1075
return _inLibrary ? this : encodingType ();
1070
1076
}
1071
1077
1078
+ Declaration const * typeDefinition () const override ;
1079
+
1072
1080
EnumDefinition const & enumDefinition () const { return m_enum; }
1073
1081
// / @returns the value that the string has in the Enum
1074
1082
unsigned int memberValue (ASTString const & _member) const ;
@@ -1101,6 +1109,9 @@ class UserDefinedValueType: public Type
1101
1109
TypeResult binaryOperatorResult (Token, Type const *) const override { return nullptr ; }
1102
1110
Type const * encodingType () const override { return &underlyingType (); }
1103
1111
TypeResult interfaceType (bool /* _inLibrary */ ) const override {return &underlyingType (); }
1112
+
1113
+ Declaration const * typeDefinition () const override ;
1114
+
1104
1115
std::string richIdentifier () const override ;
1105
1116
bool operator ==(Type const & _other) const override ;
1106
1117
0 commit comments