aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate/trans-chap2.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-12-10 06:12:33 +0100
committerTristan Gingold <tgingold@free.fr>2016-12-11 07:25:09 +0100
commitb9f0289559e16f788262fb33a29a66253d5bc3ec (patch)
treed32df61b76f0c6f3e37491a24ded64e1cf663231 /src/vhdl/translate/trans-chap2.adb
parente818c1cbbb71c4f406be66e3bd63122fdf69dc98 (diff)
downloadghdl-b9f0289559e16f788262fb33a29a66253d5bc3ec.tar.gz
ghdl-b9f0289559e16f788262fb33a29a66253d5bc3ec.tar.bz2
ghdl-b9f0289559e16f788262fb33a29a66253d5bc3ec.zip
Rework subprograms translation for package instance.
Fix #202
Diffstat (limited to 'src/vhdl/translate/trans-chap2.adb')
-rw-r--r--src/vhdl/translate/trans-chap2.adb18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb
index 6ed07c180..9dd992be3 100644
--- a/src/vhdl/translate/trans-chap2.adb
+++ b/src/vhdl/translate/trans-chap2.adb
@@ -889,12 +889,9 @@ package body Trans.Chap2 is
Translate_Package (Decl, Get_Package_Header (Decl));
if Global_Storage = O_Storage_Public then
- -- If there are package instances declared that were macro-expanded
- -- and if the package has (possibly) no body, translate the bodies
- -- of the instances.
- if Get_Need_Instance_Bodies (Decl)
--- and not Get_Need_Body (Decl)
- then
+ -- If there are package instances declared that were macro-expanded,
+ -- translate the bodies of the instances.
+ if Get_Need_Instance_Bodies (Decl) then
El := Get_Declaration_Chain (Decl);
while Is_Valid (El) loop
if Get_Kind (El) = Iir_Kind_Package_Instantiation_Declaration
@@ -975,7 +972,7 @@ package body Trans.Chap2 is
Info.Package_Body_Scope'Access);
end if;
- if not Is_Nested or else not Is_Spec_Decl then
+ if not Is_Nested then
-- Translate subprograms. For nested package, this has to be called
-- when translating subprograms.
Chap4.Translate_Declaration_Chain_Subprograms (Bod);
@@ -1390,10 +1387,9 @@ package body Trans.Chap2 is
-- Macro-expanded instantiations are translated like a package.
Translate_Package (Inst, Inst);
- -- For top-level package, generate code for the body.
- if Global_Storage = O_Storage_Public
- and then not Is_Nested_Package (Inst)
- then
+ -- For top-level package or nested package not within a package,
+ -- generate code for the body.
+ if Global_Storage = O_Storage_Public then
declare
Bod : constant Iir := Get_Package_Body (Inst);
begin