begin
while Nkind (Par) = N_Selected_Component
and then Chars (Selector_Name (Par)) /=
- Chars (Cunit_Entity (Unump))
+ Chars (Cunit_Entity (Unump))
loop
Par := Prefix (Par);
end loop;
-- Remove load stack entry and return the entry in the file table
Load_Stack.Decrement_Last;
+
+ -- All done, return unit number
+
return Unum;
-- Case of file not found
Check_Restricted_Unit (Load_Name, Error_Node);
Error_Msg_Unit_1 := Uname_Actual;
- Error_Msg
+ Error_Msg -- CODEFIX
("$$ is not a predefined library unit", Load_Msg_Sloc);
else
end if;
end Load_Unit;
+ --------------------------
+ -- Make_Child_Decl_Unit --
+ --------------------------
+
+ procedure Make_Child_Decl_Unit (N : Node_Id) is
+ Unit_Decl : constant Node_Id := Library_Unit (N);
+
+ begin
+ Units.Increment_Last;
+ Units.Table (Units.Last) := Units.Table (Get_Cunit_Unit_Number (N));
+ Units.Table (Units.Last).Unit_Name :=
+ Get_Spec_Name (Unit_Name (Get_Cunit_Unit_Number (N)));
+ Units.Table (Units.Last).Cunit := Unit_Decl;
+ Units.Table (Units.Last).Cunit_Entity :=
+ Defining_Identifier
+ (Defining_Unit_Name (Specification (Unit (Unit_Decl))));
+
+ -- The library unit created for of a child subprogram unit plays no
+ -- role in code generation and binding, so label it accordingly.
+
+ Units.Table (Units.Last).Generate_Code := False;
+ Set_Has_No_Elaboration_Code (Unit_Decl);
+ end Make_Child_Decl_Unit;
+
------------------------
-- Make_Instance_Unit --
------------------------
procedure Make_Instance_Unit (N : Node_Id; In_Main : Boolean) is
Sind : constant Source_File_Index := Source_Index (Main_Unit);
+
begin
Units.Increment_Last;
Units.Table (Main_Unit).Version := Source_Checksum (Sind);
else
- -- Duplicate information from instance unit, for the body.
- Units.Table (Units.Last) :=
- Units.Table (Get_Cunit_Unit_Number (Library_Unit (N)));
- Units.Table (Units.Last).Cunit := N;
+ -- Duplicate information from instance unit, for the body. The unit
+ -- node N has been rewritten as a body, but it was placed in the
+ -- units table when first loaded as a declaration.
+
+ Units.Table (Units.Last) := Units.Table (Get_Cunit_Unit_Number (N));
+ Units.Table (Units.Last).Cunit := Library_Unit (N);
end if;
end Make_Instance_Unit;
Bunit : constant Node_Id := Cunit (Body_Unit);
begin
- -- The spec is irrelevant if the body is a subprogram body, and the
- -- spec is other than a subprogram spec or generic subprogram spec.
- -- Note that the names must be the same, we don't need to check that,
- -- because we already know that from the fact that the file names are
- -- the same.
+ -- The spec is irrelevant if the body is a subprogram body, and the spec
+ -- is other than a subprogram spec or generic subprogram spec. Note that
+ -- the names must be the same, we don't need to check that, because we
+ -- already know that from the fact that the file names are the same.
return
Nkind (Unit (Bunit)) = N_Subprogram_Body