From b9bd50be737ff13967edf442717673fd9100941f Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 23 Mar 2023 07:25:15 +0100 Subject: vhdl: make instance_package_body forward_ref, adjust --- src/vhdl/vhdl-configuration.adb | 1 - src/vhdl/vhdl-nodes.ads | 2 +- src/vhdl/vhdl-nodes_meta.adb | 2 +- src/vhdl/vhdl-sem_inst.adb | 4 +++- 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/vhdl') diff --git a/src/vhdl/vhdl-configuration.adb b/src/vhdl/vhdl-configuration.adb index a05009c7a..b17a5d2c5 100644 --- a/src/vhdl/vhdl-configuration.adb +++ b/src/vhdl/vhdl-configuration.adb @@ -195,7 +195,6 @@ package body Vhdl.Configuration is end if; end if; if Bod /= Null_Iir then - Set_Package (Get_Library_Unit (Bod), Lib_Unit); Add_Design_Unit (Bod, Loc); end if; end; diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 8601159db..7b1f476e1 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -8149,7 +8149,7 @@ package Vhdl.Nodes is procedure Set_Package_Body (Pkg : Iir; Decl : Iir); -- The package body corresponding to the package declaration. - -- Field: Field4 + -- Field: Field4 Forward_Ref function Get_Instance_Package_Body (Pkg : Iir) return Iir; procedure Set_Instance_Package_Body (Pkg : Iir; Decl : Iir); diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index d3187b7cc..61b9cff37 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -2012,7 +2012,7 @@ package body Vhdl.Nodes_Meta is when Field_Package_Body => return Attr_Forward_Ref; when Field_Instance_Package_Body => - return Attr_None; + return Attr_Forward_Ref; when Field_Need_Body => return Attr_None; when Field_Immediate_Body_Flag => diff --git a/src/vhdl/vhdl-sem_inst.adb b/src/vhdl/vhdl-sem_inst.adb index 66754d91d..02e63836d 100644 --- a/src/vhdl/vhdl-sem_inst.adb +++ b/src/vhdl/vhdl-sem_inst.adb @@ -614,7 +614,9 @@ package body Vhdl.Sem_Inst is -- Do not instantiate the body of a package while -- instantiating a shared package. if not Is_Within_Shared_Instance then - Instantiate_Iir_Field (Res, N, F); + Set_Instance_Package_Body + (Res, Instantiate_Iir (Get_Instance_Package_Body (N), + False)); end if; when Field_Subtype_Definition => -- cgit v1.2.3