diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-03-24 19:28:04 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-03-26 16:53:50 +0200 |
commit | b95cc40ac667768cd0ae03adb8c9c8c21ad35a30 (patch) | |
tree | 3d71143278ef285a66107e3dd4861f21358ce562 /src/vhdl/vhdl-sem_inst.adb | |
parent | cff00f7c56fe0bdcc05c302c679e22ad04c097f7 (diff) | |
download | ghdl-b95cc40ac667768cd0ae03adb8c9c8c21ad35a30.tar.gz ghdl-b95cc40ac667768cd0ae03adb8c9c8c21ad35a30.tar.bz2 ghdl-b95cc40ac667768cd0ae03adb8c9c8c21ad35a30.zip |
vhdl: add Owned_Instance_Package_Body to handle ownership
of package body.
Diffstat (limited to 'src/vhdl/vhdl-sem_inst.adb')
-rw-r--r-- | src/vhdl/vhdl-sem_inst.adb | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/vhdl/vhdl-sem_inst.adb b/src/vhdl/vhdl-sem_inst.adb index 02e63836d..75d0cc678 100644 --- a/src/vhdl/vhdl-sem_inst.adb +++ b/src/vhdl/vhdl-sem_inst.adb @@ -605,20 +605,32 @@ package body Vhdl.Sem_Inst is -- case set the forward link. -- Or it can be the body of an instantiated package; in -- that case there is no forward link. - if Get_Kind (Pkg) = Iir_Kind_Package_Declaration then - Set_Package_Body (Get_Package (Res), Res); - end if; + case Get_Kind (Pkg) is + when Iir_Kind_Package_Declaration => + Set_Package_Body (Pkg, Res); + when Iir_Kind_Package_Instantiation_Declaration => + Set_Instance_Package_Body (Pkg, Res); + when others => + raise Internal_Error; + end case; end; - when Field_Instance_Package_Body => + when Field_Owned_Instance_Package_Body => -- Do not instantiate the body of a package while -- instantiating a shared package. if not Is_Within_Shared_Instance then - Set_Instance_Package_Body - (Res, Instantiate_Iir (Get_Instance_Package_Body (N), - False)); + declare + Bod : Iir; + begin + Bod := Instantiate_Iir (Get_Instance_Package_Body (N), + False); + Set_Owned_Instance_Package_Body (Res, Bod); + end; end if; + when Field_Instance_Package_Body => + null; + when Field_Subtype_Definition => -- TODO null; |