diff options
Diffstat (limited to 'src/vhdl/sem.adb')
-rw-r--r-- | src/vhdl/sem.adb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb index 1664d67e1..b89e1f005 100644 --- a/src/vhdl/sem.adb +++ b/src/vhdl/sem.adb @@ -2867,9 +2867,14 @@ package body Sem is -- FIXME: unless the parent is a package declaration library unit, the -- design unit depends on the body. - if Get_Need_Body (Pkg) then - Bod := Libraries.Load_Secondary_Unit - (Get_Design_Unit (Pkg), Null_Identifier, Decl); + if Get_Need_Body (Pkg) and then not Is_Nested_Package (Pkg) then + Bod := Get_Package_Body (Pkg); + if Is_Null (Bod) then + Bod := Libraries.Load_Secondary_Unit + (Get_Design_Unit (Pkg), Null_Identifier, Decl); + else + Bod := Get_Design_Unit (Bod); + end if; if Is_Null (Bod) then Error_Msg_Sem (+Decl, "cannot find package body of %n", +Pkg); else |