source: trunk/ada-2012/src/parser/gela-fix_node_factories.adb@ 349

Last change on this file since 349 was 349, checked in by Maxim Reznik, 6 years ago

Rename function_call to auxiliary_apply

This node actually represents several constructs. Exact kind of
construct is known only after resolving overloading rules. So let's
rename it to artifical name.

File size: 3.3 KB
Line 
1with Gela.Nodes.Fixed_Operator_Symbols;
2with Gela.Element_Visiters;
3with Gela.Elements.Auxiliary_Applies;
4with Gela.Elements.Associations;
5with Gela.Elements.Record_Aggregates;
6with Gela.Elements.Prefixes;
7
8package body Gela.Fix_Node_Factories is
9
10 ---------------------
11 -- Operator_Symbol --
12 ---------------------
13
14 overriding function Operator_Symbol
15 (Self : in out Element_Factory;
16 Operator_Symbol_Token : Gela.Lexical_Types.Token_Count)
17 return Gela.Elements.Operator_Symbols.Operator_Symbol_Access
18 is
19 Result : constant Gela.Nodes.Fixed_Operator_Symbols
20 .Operator_Symbol_Access :=
21 new Gela.Nodes.Fixed_Operator_Symbols.Operator_Symbol'
22 (Gela.Nodes.Fixed_Operator_Symbols.Create
23 (Self.Comp,
24 Operator_Symbol_Token));
25 begin
26 return Gela.Elements.Operator_Symbols.Operator_Symbol_Access (Result);
27 end Operator_Symbol;
28
29 overriding function Procedure_Call_Statement
30 (Self : in out Element_Factory;
31 Function_Call : Gela.Elements.Names.Name_Access;
32 Semicolon_Token : Gela.Lexical_Types.Token_Count)
33 return Gela.Elements.Procedure_Call_Statements.
34 Procedure_Call_Statement_Access
35 is
36 package Get is
37 type Visiter is new Gela.Element_Visiters.Visiter with record
38 Result : Gela.Elements.Auxiliary_Applies.Auxiliary_Apply_Access;
39 end record;
40
41 overriding procedure Auxiliary_Apply
42 (Self : in out Visiter;
43 Node : not null Gela.Elements.Auxiliary_Applies.
44 Auxiliary_Apply_Access);
45 end Get;
46
47 package body Get is
48
49 overriding procedure Auxiliary_Apply
50 (Self : in out Visiter;
51 Node : not null Gela.Elements.Auxiliary_Applies.
52 Auxiliary_Apply_Access)
53 is
54 begin
55 Self.Result := Node;
56 end Auxiliary_Apply;
57 end Get;
58
59 use type Gela.Elements.Auxiliary_Applies.Auxiliary_Apply_Access;
60
61 V : Get.Visiter;
62 Parent : Gela.Node_Factories.Element_Factory renames
63 Gela.Node_Factories.Element_Factory (Self);
64 begin
65 Function_Call.Visit (V);
66
67 if V.Result /= null then
68 return Parent. Procedure_Call_Statement
69 (Function_Call, Semicolon_Token);
70 end if;
71
72 declare
73 Prefix : constant Gela.Elements.Prefixes.Prefix_Access :=
74 Gela.Elements.Prefixes.Prefix_Access (Function_Call);
75 Args : constant Gela.Elements.Associations.Association_Sequence_Access
76 := Self.Association_Sequence;
77 RA : constant Gela.Elements.Record_Aggregates.
78 Record_Aggregate_Access :=
79 Self.Record_Aggregate
80 (Left_Token => 0,
81 Record_Component_Associations => Args,
82 Right_Token => 0);
83 Call : constant Gela.Elements.Auxiliary_Applies.Auxiliary_Apply_Access
84 := Self.Auxiliary_Apply
85 (Prefix => Prefix,
86 Function_Call_Parameters => RA);
87 Name : constant Gela.Elements.Names.Name_Access :=
88 Gela.Elements.Names.Name_Access (Call);
89 begin
90 return Parent. Procedure_Call_Statement (Name, Semicolon_Token);
91 end;
92 end Procedure_Call_Statement;
93
94end Gela.Fix_Node_Factories;
Note: See TracBrowser for help on using the repository browser.