diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-04-20 18:00:40 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-04-20 18:00:40 +0200 |
commit | 6ee12be2bd560a9b50f40d501b443759d204230a (patch) | |
tree | 36f0a120a028cdcc478bb9cc54fffad888897554 /src/vhdl/translate | |
parent | ff31302288cf477b8d4c7d353692f29872bc2789 (diff) | |
download | ghdl-6ee12be2bd560a9b50f40d501b443759d204230a.tar.gz ghdl-6ee12be2bd560a9b50f40d501b443759d204230a.tar.bz2 ghdl-6ee12be2bd560a9b50f40d501b443759d204230a.zip |
translate: fix handling of nested generic package. Fix #1246
Diffstat (limited to 'src/vhdl/translate')
-rw-r--r-- | src/vhdl/translate/trans-chap2.adb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb index 84fa35a94..6016a4c6e 100644 --- a/src/vhdl/translate/trans-chap2.adb +++ b/src/vhdl/translate/trans-chap2.adb @@ -1299,17 +1299,20 @@ package body Trans.Chap2 is Instantiate_Var (Src.Package_Instance_Body_Var), Package_Instance_Elab_Subprg => Src.Package_Instance_Elab_Subprg, - Package_Instance_Spec_Scope => - Instantiate_Var_Scope (Src.Package_Instance_Spec_Scope), + Package_Instance_Spec_Scope => Null_Var_Scope, Package_Instance_Body_Scope => Instantiate_Var_Scope (Src.Package_Instance_Body_Scope)); - Push_Instantiate_Var_Scope - (Dest.Package_Instance_Spec_Scope'Access, - Src.Package_Instance_Spec_Scope'Access); + -- The body scope needs to be instantiated before instantiating + -- the spec scope, as the spec scope is a field of the body + -- scope. Push_Instantiate_Var_Scope (Dest.Package_Instance_Body_Scope'Access, Src.Package_Instance_Body_Scope'Access); - + Dest.Package_Instance_Spec_Scope := + Instantiate_Var_Scope (Src.Package_Instance_Spec_Scope); + Push_Instantiate_Var_Scope + (Dest.Package_Instance_Spec_Scope'Access, + Src.Package_Instance_Spec_Scope'Access); when Kind_Field => Dest.all := (Kind => Kind_Field, Mark => False, @@ -1358,10 +1361,12 @@ package body Trans.Chap2 is null; end case; when Kind_Package_Instance => - Pop_Instantiate_Var_Scope - (Info.Package_Instance_Body_Scope'Access); + -- The order is important: it must be the reverse order of the + -- push. Pop_Instantiate_Var_Scope (Info.Package_Instance_Spec_Scope'Access); + Pop_Instantiate_Var_Scope + (Info.Package_Instance_Body_Scope'Access); when others => null; end case; |