diff mbox series

[Ada] Remove duplicated Has_Null_Abstract_State routines

Message ID 20170925085458.GA57949@adacore.com
State New
Headers show
Series [Ada] Remove duplicated Has_Null_Abstract_State routines | expand

Commit Message

Pierre-Marie de Rodat Sept. 25, 2017, 8:54 a.m. UTC
Cleanup only; semantics unaffected.

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-09-25  Piotr Trojanek  <trojanek@adacore.com>

	* sem_util.adb (Has_Null_Abstract_State): Remove, as an exactly same
	routine is already provided by Einfo.
	* einfo.adb (Has_Null_Abstract_State): Replace with the body from
	Sem_Util, which had better comments and avoided double calls to
	Abstract_State.
diff mbox series

Patch

Index: einfo.adb
===================================================================
--- einfo.adb	(revision 253134)
+++ einfo.adb	(working copy)
@@ -7707,12 +7707,17 @@ 
    -----------------------------
 
    function Has_Null_Abstract_State (Id : E) return B is
-   begin
       pragma Assert (Ekind_In (Id, E_Generic_Package, E_Package));
 
+      States : constant Elist_Id := Abstract_States (Id);
+
+   begin
+      --  Check first available state of related package. A null abstract
+      --  state always appears as the sole element of the state list.
+
       return
-        Present (Abstract_States (Id))
-          and then Is_Null_State (Node (First_Elmt (Abstract_States (Id))));
+        Present (States)
+          and then Is_Null_State (Node (First_Elmt (States)));
    end Has_Null_Abstract_State;
 
    ---------------------------------
Index: sem_util.adb
===================================================================
--- sem_util.adb	(revision 253134)
+++ sem_util.adb	(working copy)
@@ -3138,34 +3138,10 @@ 
    ---------------------------
 
    procedure Check_No_Hidden_State (Id : Entity_Id) is
-      function Has_Null_Abstract_State (Pkg : Entity_Id) return Boolean;
-      --  Determine whether the entity of a package denoted by Pkg has a null
-      --  abstract state.
-
-      -----------------------------
-      -- Has_Null_Abstract_State --
-      -----------------------------
-
-      function Has_Null_Abstract_State (Pkg : Entity_Id) return Boolean is
-         States : constant Elist_Id := Abstract_States (Pkg);
-
-      begin
-         --  Check first available state of related package. A null abstract
-         --  state always appears as the sole element of the state list.
-
-         return
-           Present (States)
-             and then Is_Null_State (Node (First_Elmt (States)));
-      end Has_Null_Abstract_State;
-
-      --  Local variables
-
       Context     : Entity_Id := Empty;
       Not_Visible : Boolean   := False;
       Scop        : Entity_Id;
 
-   --  Start of processing for Check_No_Hidden_State
-
    begin
       pragma Assert (Ekind_In (Id, E_Abstract_State, E_Variable));