@@ -8346,16 +8346,14 @@ package body Test.Skeleton is
83468346 procedure Get_Units_To_Stub
83478347 (The_Unit : Compilation_Unit; Data : in out Data_Holder)
83488348 is
8349- Body_N : Body_Node;
8350- Body_Unit : Compilation_Unit;
8351-
8352- Parent : Ada_Node;
8353-
83548349 Already_Stubbing : String_Set.Set := String_Set.Empty_Set;
83558350 -- It is generally easier to store units to stub in a list, however
83568351 -- to avoid duplications we use this local set since it is easier
83578352 -- and faster to check membership in a set.
83588353
8354+ procedure Do_Get_Stub_Units (The_Unit : Compilation_Unit);
8355+ -- Recursive implementation helper.
8356+
83598357 function Good_To_Stub (Check_Unit : Analysis_Unit) return Boolean;
83608358 -- Checks that given unit is suitable for stubbing
83618359
@@ -8364,7 +8362,7 @@ package body Test.Skeleton is
83648362 -- units to stub.
83658363
83668364 procedure Iterate_Separates (The_Unit : Compilation_Unit);
8367- -- Looks for inuts withed in separate bodies
8365+ -- Looks for inputs withed in separate bodies
83688366
83698367 -- ---------------------
83708368 -- Add_Units_To_Stub --
@@ -8401,6 +8399,15 @@ package body Test.Skeleton is
84018399 Data.Units_To_Stub.Append
84028400 (Withed_Spec.As_Ada_Node);
84038401 Trace (Me, Withed_Spec_Image);
8402+
8403+ -- Recursively stub
8404+
8405+ if Recursive_Stubbing_ON then
8406+ Trace (Me, " Recursively stub" );
8407+ Do_Get_Stub_Units
8408+ (Withed_Spec.Unit.Root.As_Compilation_Unit);
8409+ end if ;
8410+
84048411 end if ;
84058412 end ;
84068413
@@ -8511,55 +8518,73 @@ package body Test.Skeleton is
85118518 return True;
85128519 end Good_To_Stub ;
85138520
8514- begin
8515- Trace
8516- (Me, " units to stub for " & Base_Name (The_Unit.Unit.Get_Filename));
8517- Increase_Indent (Me);
8518-
8519- -- Gathering with clauses from spec
8520- Add_Units_To_Stub (The_Unit);
8521-
8522- Body_N :=
8523- The_Unit
8524- .F_Body
8525- .As_Library_Item
8526- .F_Item
8527- .As_Basic_Decl
8528- .P_Body_Part_For_Decl;
8529-
8530- -- Gathering with clauses from body
8531- if Body_N /= No_Body_Node
8532- and then Body_N.Unit.Root.Kind = Ada_Compilation_Unit
8533- then
8534- Body_Unit := Body_N.Unit.Root.As_Compilation_Unit;
8535- Add_Units_To_Stub (Body_Unit);
8536- Iterate_Separates (Body_Unit);
8537- end if ;
8521+ -- ---------------------
8522+ -- Do_Get_Stub_Units --
8523+ -- ---------------------
85388524
8539- -- Gathering parent packages
8540- Parent :=
8541- The_Unit.F_Body.As_Library_Item.F_Item.As_Ada_Node.P_Semantic_Parent;
8542- while not Parent.Is_Null and then Parent.Unit /= Parent.P_Standard_Unit
8543- loop
8544- if Parent.Kind = Ada_Package_Decl then
8545- declare
8546- Parent_File : constant String := Parent.Unit.Get_Filename;
8547- begin
8548- if Good_To_Stub (Parent.Unit)
8549- and then not Already_Stubbing.Contains (Parent_File)
8550- then
8551- Already_Stubbing.Include (Parent_File);
8552- Data.Units_To_Stub.Append (Parent);
8553- Trace (Me, Parent_File);
8554- end if ;
8555- end ;
8525+ procedure Do_Get_Stub_Units (The_Unit : Compilation_Unit) is
8526+ Body_N : Body_Node;
8527+ Body_Unit : Compilation_Unit;
8528+
8529+ Parent : Ada_Node;
8530+ begin
8531+ Trace
8532+ (Me, " units to stub for " & Base_Name (The_Unit.Unit.Get_Filename));
8533+ Increase_Indent (Me);
8534+
8535+ -- Gathering with clauses from spec
8536+ Add_Units_To_Stub (The_Unit);
8537+
8538+ Body_N :=
8539+ The_Unit
8540+ .F_Body
8541+ .As_Library_Item
8542+ .F_Item
8543+ .As_Basic_Decl
8544+ .P_Body_Part_For_Decl;
8545+
8546+ -- Gathering with clauses from body
8547+ if Body_N /= No_Body_Node
8548+ and then Body_N.Unit.Root.Kind = Ada_Compilation_Unit
8549+ then
8550+ Body_Unit := Body_N.Unit.Root.As_Compilation_Unit;
8551+ Add_Units_To_Stub (Body_Unit);
8552+ Iterate_Separates (Body_Unit);
85568553 end if ;
85578554
8558- Parent := Parent.P_Semantic_Parent;
8559- end loop ;
8555+ -- Gathering parent packages
8556+ Parent :=
8557+ The_Unit
8558+ .F_Body
8559+ .As_Library_Item
8560+ .F_Item
8561+ .As_Ada_Node
8562+ .P_Semantic_Parent;
8563+ while not Parent.Is_Null
8564+ and then Parent.Unit /= Parent.P_Standard_Unit
8565+ loop
8566+ if Parent.Kind = Ada_Package_Decl then
8567+ declare
8568+ Parent_File : constant String := Parent.Unit.Get_Filename;
8569+ begin
8570+ if Good_To_Stub (Parent.Unit)
8571+ and then not Already_Stubbing.Contains (Parent_File)
8572+ then
8573+ Already_Stubbing.Include (Parent_File);
8574+ Data.Units_To_Stub.Append (Parent);
8575+ Trace (Me, Parent_File);
8576+ end if ;
8577+ end ;
8578+ end if ;
8579+
8580+ Parent := Parent.P_Semantic_Parent;
8581+ end loop ;
85608582
8561- Decrease_Indent (Me);
8562- Already_Stubbing.Clear;
8583+ Decrease_Indent (Me);
8584+ Already_Stubbing.Clear;
8585+ end Do_Get_Stub_Units ;
8586+ begin
8587+ Do_Get_Stub_Units (The_Unit);
85638588 end Get_Units_To_Stub ;
85648589
85658590 -- --------------------
0 commit comments