text stringlengths 0 234 |
|---|
for J in 2 .. Vector.Last_Index loop |
declare |
Item : constant Meta.Classes.Class := Vector (J); |
Name : constant League.Strings.Universal_String := |
"To_" & Item.Name; |
Type_Name : constant Ada_Pretty.Node_Access := |
F.New_Selected_Name (Full_Access_Name (Item.Name)); |
Funct : constant Ada_Pretty.Node_Access := |
F.New_Subprogram_Declaration |
(F.New_Subprogram_Specification |
(Name => F.New_Name (Name), |
Parameters => F.New_Parameter |
(Name => F.New_Name (+"Self"), |
Type_Definition => F.New_Access |
(Target => F.New_Name (+"Element'Class"))), |
Result => Type_Name), |
Aspects => F.New_Aspect |
(Name => F.New_Name (+"Pre"), |
Value => F.New_Name ("Self.Is_" & Item.Name))); |
begin |
Result := F.New_List (Result, Funct); |
Function Definition: function Prop_Parameters is new Generic_List_Reduce |
Function Body: (Classes.Property, Classes.Property_Array, Prop_Parameter, F); |
function Get_Params |
(Item : Classes.Class) return Ada_Pretty.Node_Access; |
function Prop_List (Item : Classes.Class) return Classes.Property_Array; |
---------------- |
-- Get_Params -- |
---------------- |
function Get_Params |
(Item : Classes.Class) return Ada_Pretty.Node_Access |
is |
List : constant Ada_Pretty.Node_Access := |
Prop_Parameters (Prop_List (Item)); |
Self : constant Ada_Pretty.Node_Access := F.New_Parameter |
(Name => F.New_Name (+"Self"), |
Type_Definition => Type_Name); |
begin |
if List in null then |
return Self; |
else |
return F.New_List (Self, List); |
end if; |
end Get_Params; |
------------- |
-- Methods -- |
------------- |
function Methods return Ada_Pretty.Node_Access is |
Result : Ada_Pretty.Node_Access; |
begin |
for Item of Vector loop |
if not Item.Is_Abstract then |
declare |
Funct : constant Ada_Pretty.Node_Access := |
F.New_Subprogram_Declaration |
(F.New_Subprogram_Specification |
(Is_Overriding => Ada_Pretty.False, |
Name => F.New_Name ("Create_" & Item.Name), |
Parameters => Get_Params (Item), |
Result => F.New_Null_Exclusion |
(F.New_Selected_Name |
(Full_Access_Name (Item.Name))))); |
begin |
Result := F.New_List (Result, Funct); |
Function Definition: function Prop_List |
Function Body: (Item : Classes.Class) return Classes.Property_Array |
is |
use type Classes.Property_Array; |
Parent_Props : constant Classes.Property_Array := |
Get_Parent_Props (Item, Vector); |
begin |
if Implicit then |
return Skip_Texts (Skip_Tokens (Item.Properties)) |
& Only_Booleans |
(Vector.First_Element.Properties & Parent_Props); |
else |
return Skip_Texts (Skip_Booleans (Item.Properties)) |
& Only_Booleans (Parent_Props); |
end if; |
end Prop_List; |
Pure : constant Ada_Pretty.Node_Access := |
F.New_Pragma (F.New_Name (+"Preelaborate")); |
Public_Part : constant Ada_Pretty.Node_Access := |
F.New_List ((Pure, Type_Decl, Methods)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.