]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Simplify detection of local types
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 6 Apr 2021 11:10:01 +0000 (13:10 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 29 Jun 2021 14:23:47 +0000 (14:23 +0000)
gcc/ada/

* sem_ch3.adb (Is_Local_Type): Simplify by reusing Scope_Within.

gcc/ada/sem_ch3.adb

index 98cbef483db13a29d2fa976389599d8c1d0ae553..70e1dfdb71dae222133f997ed8945b0a3e99de9d 100644 (file)
@@ -19133,21 +19133,8 @@ package body Sem_Ch3 is
       -------------------
 
       function Is_Local_Type (Typ : Entity_Id) return Boolean is
-         Scop : Entity_Id;
-
       begin
-         Scop := Scope (Typ);
-         while Present (Scop)
-           and then Scop /= Standard_Standard
-         loop
-            if Scop = Scope (Current_Scope) then
-               return True;
-            end if;
-
-            Scop := Scope (Scop);
-         end loop;
-
-         return False;
+         return Scope_Within (Inner => Typ, Outer => Scope (Current_Scope));
       end Is_Local_Type;
 
    --  Start of processing for Is_Visible_Component