aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch4.adb
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2018-07-31 09:55:16 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-07-31 09:55:16 +0000
commit617709748bf6e8c9590ce8a19a20c57de53a08e2 (patch)
treec88c359d800e7a2645ebbf4321934aafd1de0fdf /gcc/ada/sem_ch4.adb
parente78c79ff53c9370b5438d7f8b9f7096103ee0d44 (diff)
downloadgcc-617709748bf6e8c9590ce8a19a20c57de53a08e2.zip
gcc-617709748bf6e8c9590ce8a19a20c57de53a08e2.tar.gz
gcc-617709748bf6e8c9590ce8a19a20c57de53a08e2.tar.bz2
[Ada] Minor reformattings
2018-07-31 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada * checks.adb, contracts.adb, exp_aggr.adb, exp_ch5.adb, exp_disp.adb, make.adb, sem_ch4.adb, sem_eval.adb, sem_res.adb, usage.adb: Minor reformatting. From-SVN: r263089
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r--gcc/ada/sem_ch4.adb70
1 files changed, 38 insertions, 32 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 597ec1e..89af567 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -8928,44 +8928,49 @@ package body Sem_Ch4 is
(Anc_Type : Entity_Id;
Error : out Boolean)
is
- Candidate : Entity_Id;
- -- If homonym is a renaming, examine the renamed program
-
- Cls_Type : Entity_Id;
- Hom : Entity_Id;
- Hom_Ref : Node_Id;
- Success : Boolean;
-
function First_Formal_Match
- (Typ : Entity_Id) return Boolean;
- -- Predicate to verify that the first formal of a class-wide
- -- candidate matches the type of the prefix.
+ (Subp_Id : Entity_Id;
+ Typ : Entity_Id) return Boolean;
+ -- Predicate to verify that the first foramal of class-wide
+ -- subprogram Subp_Id matches type Typ of the prefix.
------------------------
-- First_Formal_Match --
------------------------
function First_Formal_Match
- (Typ : Entity_Id) return Boolean
+ (Subp_Id : Entity_Id;
+ Typ : Entity_Id) return Boolean
is
- Ctrl : constant Entity_Id := First_Formal (Candidate);
+ Ctrl : constant Entity_Id := First_Formal (Subp_Id);
+
begin
- return Present (Ctrl)
- and then
- (Base_Type (Etype (Ctrl)) = Typ
- or else
- (Ekind (Etype (Ctrl)) = E_Anonymous_Access_Type
- and then
- Base_Type
- (Designated_Type (Etype (Ctrl))) = Typ));
+ return
+ Present (Ctrl)
+ and then
+ (Base_Type (Etype (Ctrl)) = Typ
+ or else
+ (Ekind (Etype (Ctrl)) = E_Anonymous_Access_Type
+ and then
+ Base_Type (Designated_Type (Etype (Ctrl))) =
+ Typ));
end First_Formal_Match;
- begin
- Error := False;
+ -- Local variables
- Cls_Type := Class_Wide_Type (Anc_Type);
+ CW_Typ : constant Entity_Id := Class_Wide_Type (Anc_Type);
- Hom := Current_Entity (Subprog);
+ Candidate : Entity_Id;
+ -- If homonym is a renaming, examine the renamed program
+
+ Hom : Entity_Id;
+ Hom_Ref : Node_Id;
+ Success : Boolean;
+
+ -- Start of processing for Traverse_Homonyms
+
+ begin
+ Error := False;
-- Find a non-hidden operation whose first parameter is of the
-- class-wide type, a subtype thereof, or an anonymous access
@@ -8973,6 +8978,7 @@ package body Sem_Ch4 is
-- even if hidden (it may be hidden because the instantiation
-- is expanded after the containing package has been analyzed).
+ Hom := Current_Entity (Subprog);
while Present (Hom) loop
if Ekind_In (Hom, E_Procedure, E_Function)
and then Present (Renamed_Entity (Hom))
@@ -8983,10 +8989,10 @@ package body Sem_Ch4 is
Candidate := Hom;
end if;
- if Ekind_In (Candidate, E_Procedure, E_Function)
+ if Ekind_In (Candidate, E_Function, E_Procedure)
and then (not Is_Hidden (Candidate) or else In_Instance)
and then Scope (Candidate) = Scope (Base_Type (Anc_Type))
- and then First_Formal_Match (Cls_Type)
+ and then First_Formal_Match (Candidate, CW_Typ)
then
-- If the context is a procedure call, ignore functions
-- in the name of the call.
@@ -9006,16 +9012,16 @@ package body Sem_Ch4 is
goto Next_Hom;
end if;
- Set_Etype (Call_Node, Any_Type);
+ Set_Etype (Call_Node, Any_Type);
Set_Is_Overloaded (Call_Node, False);
Success := False;
if No (Matching_Op) then
Hom_Ref := New_Occurrence_Of (Candidate, Sloc (Subprog));
- Set_Etype (Call_Node, Any_Type);
- Set_Parent (Call_Node, Parent (Node_To_Replace));
- Set_Name (Call_Node, Hom_Ref);
+ Set_Etype (Call_Node, Any_Type);
+ Set_Name (Call_Node, Hom_Ref);
+ Set_Parent (Call_Node, Parent (Node_To_Replace));
Analyze_One_Call
(N => Call_Node,
@@ -9040,7 +9046,7 @@ package body Sem_Ch4 is
-- Check for this case before reporting a real ambiguity.
if Present
- (Valid_Candidate (Success, Call_Node, Candidate))
+ (Valid_Candidate (Success, Call_Node, Candidate))
and then Nkind (Call_Node) /= N_Function_Call
and then Candidate /= Matching_Op
then