sem_ch4.adb (Try_Object_Operation): Reformat the code to expand in-line the code...
authorJavier Miranda <miranda@gnat.com>
Mon, 4 Oct 2004 15:01:03 +0000 (15:01 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 4 Oct 2004 15:01:03 +0000 (17:01 +0200)
2004-10-04  Javier Miranda  <miranda@gnat.com>

* sem_ch4.adb (Try_Object_Operation): Reformat the code to expand
in-line the code corresponding to subprogram Analyze_Actuals. In
addition, analyze the actuals only in case of subprogram call.

From-SVN: r88506

gcc/ada/ChangeLog
gcc/ada/sem_ch4.adb

index 0200474..85551cb 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-04  Javier Miranda  <miranda@gnat.com>
+
+       * sem_ch4.adb (Try_Object_Operation): Reformat the code to expand
+       in-line the code corresponding to subprogram Analyze_Actuals. In
+       addition, analyze the actuals only in case of subprogram call.
+
 2004-10-04  Ed Falis  <falis@gnat.com>
 
        * s-vxwork-x86.ads: (FP_CONTEXT): Defined to be correct size
index ba7e46a..a63d78e 100644 (file)
@@ -4637,19 +4637,19 @@ package body Sem_Ch4 is
    --------------------------
 
    function Try_Object_Operation (N : Node_Id) return Boolean is
-      Loc      : constant Source_Ptr := Sloc (N);
-      Obj      : constant Node_Id := Prefix (N);
-      Obj_Type : Entity_Id := Etype (Obj);
-      Subprog  : constant Node_Id := Selector_Name (N);
-
+      K               : constant Node_Kind  := Nkind (Parent (N));
+      Loc             : constant Source_Ptr := Sloc (N);
+      Is_Subprg_Call  : constant Boolean    := K = N_Procedure_Call_Statement
+                                                or else K = N_Function_Call;
+      Obj             : constant Node_Id    := Prefix (N);
+      Subprog         : constant Node_Id    := Selector_Name (N);
+
+      Actual          : Node_Id;
       Call_Node       : Node_Id;
       Call_Node_Case  : Node_Id := Empty;
       First_Actual    : Node_Id;
       Node_To_Replace : Node_Id;
-
-      procedure Analyze_Actuals;
-      --  If the parent of N is a subprogram call, then analyze the actual
-      --  parameters of the parent of N.
+      Obj_Type        : Entity_Id := Etype (Obj);
 
       procedure Complete_Object_Operation
         (Call_Node       : Node_Id;
@@ -4681,32 +4681,6 @@ package body Sem_Ch4 is
       --  Traverse the list of primitive subprograms looking for a subprogram
       --  than matches Subprog.
 
-      ---------------------
-      -- Analyze_Actuals --
-      ---------------------
-
-      procedure Analyze_Actuals is
-         Actual : Node_Id;
-
-      begin
-         if (Nkind (Parent (N)) = N_Procedure_Call_Statement
-               or else
-             Nkind (Parent (N)) = N_Function_Call)
-
-            --  Avoid recursive calls
-
-           and then N /= First (Parameter_Associations (Parent (N)))
-         then
-            Actual := First (Parameter_Associations (Parent (N)));
-            while Present (Actual) loop
-               Analyze (Actual);
-               Check_Parameterless_Call (Actual);
-               Next (Actual);
-
-            end loop;
-         end if;
-      end Analyze_Actuals;
-
       -------------------------------
       -- Complete_Object_Operation --
       -------------------------------
@@ -4993,7 +4967,16 @@ package body Sem_Ch4 is
          Obj_Type := Etype (Class_Wide_Type (Obj_Type));
       end if;
 
-      Analyze_Actuals;
+      --  Analyze the actuals in case of subprogram call
+
+      if Is_Subprg_Call and then N = Name (Parent (N)) then
+         Actual := First (Parameter_Associations (Parent (N)));
+         while Present (Actual) loop
+            Analyze (Actual);
+            Check_Parameterless_Call (Actual);
+            Next (Actual);
+         end loop;
+      end if;
 
       --  If the object is of an Access type, explicit dereference is
       --  required.