@@ -721,7 +721,8 @@ package body GNATdoc.Frontend is
721721 Name : constant Defining_Name := Node.F_Name;
722722 Entity : constant not null GNATdoc.Entities.Entity_Information_Access :=
723723 new GNATdoc.Entities.Entity_Information'
724- (Location => GNATdoc.Utilities.Location (Name),
724+ (Kind => GNATdoc.Entities.Ada_Other_Type,
725+ Location => GNATdoc.Utilities.Location (Name),
725726 Name => To_Virtual_String (Name.Text),
726727 Qualified_Name => To_Virtual_String (Name.P_Fully_Qualified_Name),
727728 Signature => Signature (Name),
@@ -748,7 +749,8 @@ package body GNATdoc.Frontend is
748749 Name : constant Defining_Name := Node.F_Name;
749750 Entity : constant not null GNATdoc.Entities.Entity_Information_Access :=
750751 new GNATdoc.Entities.Entity_Information'
751- (Location => GNATdoc.Utilities.Location (Name),
752+ (Kind => GNATdoc.Entities.Ada_Other_Type,
753+ Location => GNATdoc.Utilities.Location (Name),
752754 Name => To_Virtual_String (Name.Text),
753755 Qualified_Name => To_Virtual_String (Name.P_Fully_Qualified_Name),
754756 Signature => Signature (Name),
@@ -1539,7 +1541,8 @@ package body GNATdoc.Frontend is
15391541 Entity : constant not null
15401542 GNATdoc.Entities.Entity_Information_Access :=
15411543 new GNATdoc.Entities.Entity_Information'
1542- (Location => GNATdoc.Utilities.Location (Name),
1544+ (Kind => GNATdoc.Entities.Ada_Exception,
1545+ Location => GNATdoc.Utilities.Location (Name),
15431546 Name => To_Virtual_String (Name.Text),
15441547 Qualified_Name =>
15451548 To_Virtual_String (Name.P_Fully_Qualified_Name),
@@ -1573,7 +1576,14 @@ package body GNATdoc.Frontend is
15731576 else Node.As_Generic_Subp_Instantiation.F_Subp_Name);
15741577 Entity : constant not null GNATdoc.Entities.Entity_Information_Access :=
15751578 new GNATdoc.Entities.Entity_Information'
1576- (Location => GNATdoc.Utilities.Location (Name),
1579+ (Kind =>
1580+ (case Node.Kind is
1581+ when Ada_Generic_Package_Instantiation =>
1582+ GNATdoc.Entities.Ada_Generic_Package_Instantiation,
1583+ when Ada_Generic_Subp_Instantiation =>
1584+ GNATdoc.Entities.Ada_Generic_Subprogram_Instantiation,
1585+ when others => raise Program_Error),
1586+ Location => GNATdoc.Utilities.Location (Name),
15771587 Name => To_Virtual_String (Name.Text),
15781588 Qualified_Name => To_Virtual_String (Name.P_Fully_Qualified_Name),
15791589 Signature => Signature (Name),
@@ -1591,6 +1601,10 @@ package body GNATdoc.Frontend is
15911601 Global.Generic_Instantiations.Insert (Entity);
15921602 end if ;
15931603
1604+ Entity.RSTPT_Instpkg :=
1605+ VSS.Strings.To_Virtual_String
1606+ (Node.P_Designated_Generic_Decl.P_Fully_Qualified_Name);
1607+
15941608 Check_Undocumented (Entity);
15951609 end Process_Generic_Instantiation ;
15961610
@@ -1768,22 +1782,56 @@ package body GNATdoc.Frontend is
17681782 (Node : Object_Decl'Class;
17691783 Enclosing : not null GNATdoc.Entities.Entity_Information_Access)
17701784 is
1785+ Objects_Parent : constant Basic_Decl := Node.P_Parent_Basic_Decl;
1786+ Type_Name : Defining_Name;
1787+ Type_Signature : GNATdoc.Entities.Entity_Signature;
1788+ Type_Parent : Basic_Decl;
1789+
1790+ RSTPT_Objtype : VSS.Strings.Virtual_String;
1791+ RSTPT_Defval : VSS.Strings.Virtual_String;
1792+
17711793 Template : constant VSS.Strings.Templates.Virtual_String_Template :=
17721794 " {} : constant {}" ;
17731795
17741796 begin
1797+ case Node.F_Type_Expr.Kind is
1798+ when Ada_Subtype_Indication =>
1799+ Type_Name :=
1800+ Node.F_Type_Expr.As_Subtype_Indication.P_Type_Name
1801+ .P_Referenced_Defining_Name;
1802+ Type_Signature := Signature (Type_Name);
1803+ Type_Parent := Type_Name.P_Parent_Basic_Decl.P_Parent_Basic_Decl;
1804+
1805+ RSTPT_Objtype :=
1806+ VSS.Strings.To_Virtual_String (Type_Name.P_Fully_Qualified_Name);
1807+
1808+ when Ada_Anonymous_Type =>
1809+ null ;
1810+
1811+ when others =>
1812+ raise Program_Error;
1813+ end case ;
1814+
1815+ if not Node.F_Default_Expr.Is_Null then
1816+ RSTPT_Defval :=
1817+ VSS.Strings.To_Virtual_String (Node.F_Default_Expr.Text);
1818+ end if ;
1819+
17751820 for Name of Node.F_Ids loop
17761821 declare
1777- Entity : constant not null
1822+ Entity : constant not null
17781823 GNATdoc.Entities.Entity_Information_Access :=
17791824 new GNATdoc.Entities.Entity_Information'
1780- (Location => GNATdoc.Utilities.Location (Name),
1825+ (Kind => GNATdoc.Entities.Ada_Object,
1826+ Location => GNATdoc.Utilities.Location (Name),
17811827 Name => To_Virtual_String (Name.Text),
17821828 Qualified_Name =>
17831829 To_Virtual_String (Name.P_Fully_Qualified_Name),
17841830 Signature => Signature (Name),
1831+ RSTPT_Objtype => RSTPT_Objtype,
1832+ RSTPT_Defval => RSTPT_Defval,
17851833 others => <>);
1786- Belongs : GNATdoc.Entities.Entity_Information_Access;
1834+ Belongs : GNATdoc.Entities.Entity_Information_Access;
17871835
17881836 begin
17891837 Extract
@@ -1801,6 +1849,30 @@ package body GNATdoc.Frontend is
18011849 Belongs => Belongs,
18021850 Entity => Entity);
18031851
1852+ -- If there is not explicitly defined @belongs-to tag, and
1853+ -- type is a "class", and both type and object are declared in
1854+ -- the same package, mark constant object as belongs to type.
1855+
1856+ if Belongs = null
1857+ and Node.F_Type_Expr.Kind = Ada_Subtype_Indication
1858+ then
1859+
1860+ if Type_Parent = Objects_Parent
1861+ and then GNATdoc.Entities.To_Entity.Contains
1862+ (Type_Signature)
1863+ and then GNATdoc.Entities.To_Entity (Type_Signature).Kind
1864+ in GNATdoc.Entities.Ada_Tagged_Type
1865+ | GNATdoc.Entities.Ada_Interface_Type
1866+ then
1867+ Belongs :=
1868+ GNATdoc.Entities.To_Entity (Signature (Type_Name));
1869+ end if ;
1870+
1871+ Entity.RSTPT_Objtype :=
1872+ VSS.Strings.To_Virtual_String
1873+ (Type_Name.P_Fully_Qualified_Name);
1874+ end if ;
1875+
18041876 if Belongs = null then
18051877 Enclosing.Belongs_Constants.Insert (Entity.Reference);
18061878
@@ -1956,7 +2028,8 @@ package body GNATdoc.Frontend is
19562028 Name : constant Defining_Name := Node.F_Name;
19572029 Entity : constant not null GNATdoc.Entities.Entity_Information_Access :=
19582030 new GNATdoc.Entities.Entity_Information'
1959- (Location => GNATdoc.Utilities.Location (Name),
2031+ (Kind => GNATdoc.Entities.Ada_Other_Type,
2032+ Location => GNATdoc.Utilities.Location (Name),
19602033 Name => To_Virtual_String (Name.Text),
19612034 Qualified_Name => To_Virtual_String (Name.P_Fully_Qualified_Name),
19622035 Signature => Signature (Name),
@@ -2081,7 +2154,8 @@ package body GNATdoc.Frontend is
20812154 Name : constant Defining_Name := Node.F_Name;
20822155 Entity : constant not null GNATdoc.Entities.Entity_Information_Access :=
20832156 new GNATdoc.Entities.Entity_Information'
2084- (Location => GNATdoc.Utilities.Location (Name),
2157+ (Kind => GNATdoc.Entities.Ada_Other_Type,
2158+ Location => GNATdoc.Utilities.Location (Name),
20852159 Name => To_Virtual_String (Name.Text),
20862160 Qualified_Name => To_Virtual_String (Name.P_Fully_Qualified_Name),
20872161 Signature => Signature (Name),
@@ -2096,6 +2170,7 @@ package body GNATdoc.Frontend is
20962170 GNATdoc.Entities.To_Entity.Insert (Entity.Signature, Entity);
20972171
20982172 if Node.F_Type_Def.As_Record_Type_Def.F_Has_Tagged then
2173+ Entity.Kind := GNATdoc.Entities.Ada_Tagged_Type;
20992174 Enclosing.Tagged_Types.Insert (Entity);
21002175 GNATdoc.Entities.Globals.Tagged_Types.Insert (Entity);
21012176
@@ -2117,7 +2192,8 @@ package body GNATdoc.Frontend is
21172192 Name : constant Defining_Name := Node.F_Name;
21182193 Entity : constant not null GNATdoc.Entities.Entity_Information_Access :=
21192194 new GNATdoc.Entities.Entity_Information'
2120- (Location => GNATdoc.Utilities.Location (Name),
2195+ (Kind => GNATdoc.Entities.Ada_Other_Type,
2196+ Location => GNATdoc.Utilities.Location (Name),
21212197 Name => To_Virtual_String (Name.Text),
21222198 Qualified_Name => To_Virtual_String (Name.P_Fully_Qualified_Name),
21232199 Signature => Signature (Name),
@@ -2144,7 +2220,8 @@ package body GNATdoc.Frontend is
21442220 Name : constant Defining_Name := Node.F_Name;
21452221 Entity : constant not null GNATdoc.Entities.Entity_Information_Access :=
21462222 new GNATdoc.Entities.Entity_Information'
2147- (Location => GNATdoc.Utilities.Location (Name),
2223+ (Kind => GNATdoc.Entities.Ada_Other_Type,
2224+ Location => GNATdoc.Utilities.Location (Name),
21482225 Name => To_Virtual_String (Name.Text),
21492226 Qualified_Name => To_Virtual_String (Name.P_Fully_Qualified_Name),
21502227 Signature => Signature (Name),
0 commit comments