text stringlengths 0 234 |
|---|
end Vector_Args; |
-------------- |
-- Get_Inst -- |
-------------- |
function Get_Inst |
(Item : Classes.Class; |
P : Classes.Property; |
Index : Positive) return Ada_Pretty.Node_Access |
is |
Template : constant Wide_Wide_String := |
(if Is_Vector (P) |
then "Vector" |
else "Child"); |
Result : constant Ada_Pretty.Node_Access := |
(F.New_Apply |
(Prefix => F.New_Name |
(+"function " & Get_Name (Index) & |
" is new Generic_" & Template), |
Arguments => |
(if Is_Vector (P) then Vector_Args (Item, P) |
else Child_Args (Item, P)))); |
begin |
return Result; |
end Get_Inst; |
----------------- |
-- Method_Spec -- |
----------------- |
function Method_Spec |
(Item : Classes.Class) return Ada_Pretty.Node_Access |
is |
Element_Name : constant League.Strings.Universal_String := |
To_Element_Name (Item.Name); |
Funct : constant Ada_Pretty.Node_Access := |
F.New_Subprogram_Specification |
(Is_Overriding => Ada_Pretty.True, |
Name => F.New_Name (Element_Name), |
Parameters => F.New_List |
(F.New_Parameter |
(Name => F.New_Name (+"Self"), |
Is_In => True, |
Is_Out => True, |
Type_Definition => F.New_Name (+"Visitor")), |
F.New_Parameter |
(Name => F.New_Name (Element), |
Type_Definition => F.New_Null_Exclusion |
(F.New_Selected_Name |
(Full_Access_Name (Item.Name)))))); |
begin |
return Funct; |
end Method_Spec; |
------------------- |
-- Method_Bodies -- |
------------------- |
function Method_Bodies return Ada_Pretty.Node_Access is |
Result : Ada_Pretty.Node_Access; |
Bodies : Ada_Pretty.Node_Access; |
Map : constant array (Boolean) of Ada_Pretty.Node_Access := |
(False => F.New_Name (+"False"), |
True => F.New_Name (+"True")); |
begin |
for Item of Vector loop |
if not Item.Is_Abstract then |
declare |
Props : constant Meta.Classes.Property_Array := |
Only_Objects (Item.Properties); |
Funct : constant Ada_Pretty.Node_Access := |
F.New_Subprogram_Body |
(Specification => Method_Spec (Item), |
Declarations => F.New_Pragma |
(Name => F.New_Name (+"Unreferenced"), |
Arguments => F.New_Name (+"Element")), |
Statements => F.New_Assignment |
(Left => F.New_Selected_Name (+"Self.Result"), |
Right => F.New_Name (+Get_Name (0) & "'Access"))); |
Index : Positive := 1; |
List : Ada_Pretty.Node_Access; |
begin |
for P of Props loop |
declare |
Inst : constant Ada_Pretty.Node_Access := |
F.New_Subprogram_Declaration |
(Get_Inst (Item, P, Index)); |
Data : constant Ada_Pretty.Node_Access_Array := |
(Map (Is_Vector (P)), |
F.New_Name (P.Name), |
F.New_Name (+Get_Name (Index) & "'Access")); |
begin |
Bodies := F.New_List (Bodies, Inst); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.