@@ -601,8 +601,7 @@ package body SC_Obligations is
601601 -- Scope_Traversal --
602602 -- -------------------
603603
604- function Scope_Traversal (CU : CU_Id) return Scope_Traversal_Type
605- is
604+ function Scope_Traversal (CU : CU_Id) return Scope_Traversal_Type is
606605 Result : Scope_Traversal_Type;
607606 begin
608607 if CU = No_CU_Id then
@@ -614,19 +613,15 @@ package body SC_Obligations is
614613 (CU_Vector.Reference (CU).Element.Scope_Entities));
615614 Result.Scope_Stack := Scope_Stacks.Empty_List;
616615 Result.Active_Scopes := Scope_Id_Sets.Empty;
617- Result.Active_Scope_Ent := Result.It.First;
618- Result.Next_Scope_Ent := Result.It.Next (Result.Active_Scope_Ent);
616+ Set_Active_Scope_Ent (Result, Result.It.First);
619617 return Result;
620618 end Scope_Traversal ;
621619
622620 -- ----------------
623621 -- Traverse_SCO --
624622 -- ----------------
625623
626- procedure Traverse_SCO
627- (ST : in out Scope_Traversal_Type;
628- SCO : SCO_Id)
629- is
624+ procedure Traverse_SCO (ST : in out Scope_Traversal_Type; SCO : SCO_Id) is
630625 use Scope_Entities_Trees;
631626 begin
632627 -- In some cases (C metaprogramming instances), e.g.
@@ -662,18 +657,17 @@ package body SC_Obligations is
662657
663658 while SCO > Element (ST.Active_Scope_Ent).To
664659 or else (ST.Next_Scope_Ent /= No_Element
665- and then SCO >= Element (ST.Next_Scope_Ent).From)
660+ and then SCO >= Element (ST.Next_Scope_Ent).From)
666661 loop
667- -- We can enter the next scope only when we have reached its
668- -- parent scope. If the next scope is null, this means that we
669- -- are in the last scope of the unit.
662+ -- We can enter the next scope only when we have reached its parent
663+ -- scope. If the next scope is null, this means that we are in the
664+ -- last scope of the unit.
670665
671666 if ST.Next_Scope_Ent /= No_Element
672667 and then ST.Active_Scope_Ent = Parent (ST.Next_Scope_Ent)
673668 and then SCO >= Element (ST.Next_Scope_Ent).From
674669 then
675- ST.Active_Scope_Ent := ST.Next_Scope_Ent;
676- ST.Next_Scope_Ent := ST.It.Next (ST.Next_Scope_Ent);
670+ Set_Active_Scope_Ent (ST, ST.Next_Scope_Ent);
677671 ST.Scope_Stack.Append (ST.Active_Scope_Ent);
678672 ST.Active_Scopes.Insert
679673 (Element (ST.Active_Scope_Ent).Identifier);
@@ -689,6 +683,18 @@ package body SC_Obligations is
689683 end loop ;
690684 end Traverse_SCO ;
691685
686+ -- ------------------------
687+ -- Set_Active_Scope_Ent --
688+ -- ------------------------
689+
690+ procedure Set_Active_Scope_Ent
691+ (ST : in out Scope_Traversal_Type;
692+ Scope_Ent : Scope_Entities_Trees.Cursor) is
693+ begin
694+ ST.Active_Scope_Ent := Scope_Ent;
695+ ST.Next_Scope_Ent := ST.It.Next (Scope_Ent);
696+ end Set_Active_Scope_Ent ;
697+
692698 -- -------------
693699 -- Is_Active --
694700 -- -------------
@@ -1376,6 +1382,10 @@ package body SC_Obligations is
13761382 end if ;
13771383 end Checkpoint_Load_Unit ;
13781384
1385+ -- --------
1386+ -- Free --
1387+ -- --------
1388+
13791389 procedure Free (CU : in out CU_Info) is
13801390 procedure Free is new Ada.Unchecked_Deallocation
13811391 (Statement_Bit_Map, Statement_Bit_Map_Access);
0 commit comments