text
stringlengths
0
234
---------------
function Get_Props
(F : aliased in out Ada_Pretty.Factory;
Name : Ada_Pretty.Node_Access;
Props : Meta.Classes.Property_Array;
Prefix : Ada_Pretty.Node_Access;
Is_Abstr : Boolean := True) return Ada_Pretty.Node_Access
is
Next : Ada_Pretty.Node_Access;
Result : Ada_Pretty.Node_Access := Prefix;
begin
for P of Props loop
Next := F.New_Subprogram_Declaration
(Specification => F.New_Subprogram_Specification
(Is_Overriding => Map (not Is_Abstr),
Name => F.New_Name (P.Name),
Parameters => F.New_Parameter
(Name => F.New_Name (+"Self"),
Type_Definition => Name),
Result => Property_Type (F, P)),
Is_Abstract => Is_Abstr);
Result := F.New_List (Result, Next);
end loop;
return Result;
end Get_Props;
----------------------
-- Get_With_Clauses --
----------------------
function Get_With_Clauses
(F : access Ada_Pretty.Factory;
Vector : Meta.Read.Class_Vectors.Vector;
Is_Limited : Boolean;
With_Abstract : Boolean := True;
Skip : Natural := 1) return Ada_Pretty.Node_Access
is
Result : Ada_Pretty.Node_Access;
begin
for J in 1 + Skip .. Vector.Last_Index loop
declare
Item : constant Meta.Classes.Class := Vector (J);
Name : constant League.Strings.Universal_String := Item.Name;
Package_Name : constant League.Strings.Universal_String :=
Get_Package_Name (Name);
Next : constant Ada_Pretty.Node_Access :=
F.New_With (F.New_Name (Package_Name), Is_Limited);
begin
if With_Abstract or else not Item.Is_Abstract then
Result := F.New_List (Result, Next);
end if;
Function Definition: function Visit_Spec
Function Body: (F : aliased in out Ada_Pretty.Factory;
Name : Ada_Pretty.Node_Access;
Is_Abstract : Boolean := True)
return Ada_Pretty.Node_Access
is
Visit : constant Ada_Pretty.Node_Access :=
F.New_Subprogram_Specification
(Is_Overriding => Map (not Is_Abstract),
Name => F.New_Name (+"Visit"),
Parameters => F.New_List
(F.New_Parameter
(Name => F.New_Name (+"Self"),
Type_Definition => F.New_Null_Exclusion
(F.New_Access
(Target => Name))),
F.New_Parameter
(Name => F.New_Name (+"Visitor"),
Type_Definition => F.New_Selected_Name
(Full_Record_Name (Element_Visitor) & "'Class"),
Is_In => True,
Is_Out => True)));
begin
return Visit;
end Visit_Spec;
--------------------
-- Write_Elements --
--------------------
procedure Write_Elements (Vector : Meta.Read.Class_Vectors.Vector) is
F : aliased Ada_Pretty.Factory;
function Element_Classifications return Ada_Pretty.Node_Access;
function Element_Casts return Ada_Pretty.Node_Access;
-------------------
-- Element_Casts --
-------------------
function Element_Casts return Ada_Pretty.Node_Access is
Result : Ada_Pretty.Node_Access;
begin