From 1e2aeb2a4635f24c60384232e319b682b0d99f3c Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 17 Jan 2016 06:53:01 +0100 Subject: Clean up some code and comments about constant declarations. --- src/vhdl/iirs.ads | 8 ++++---- src/vhdl/nodes_meta.adb | 4 ++-- src/vhdl/sem_decls.adb | 5 ----- src/vhdl/sem_expr.adb | 6 ------ 4 files changed, 6 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads index cc7eb83..56a1794 100644 --- a/src/vhdl/iirs.ads +++ b/src/vhdl/iirs.ads @@ -1435,9 +1435,9 @@ package Iirs is -- -- Only for Iir_Kind_Constant_Declaration: -- Summary: - -- | constant C1 : integer; -- Deferred declaration (in a package) - -- | constant C2 : integer := 4; -- Declaration - -- | constant C1 : integer := 3; -- Full declaration (in a body) + -- | constant C1 : integer; -- Deferred declaration (in a package) + -- | constant C2 : integer := 4; -- Declaration + -- | constant C1 : integer := 3; -- Full declaration (in a body) -- | NAME Deferred_declaration Deferred_declaration_flag -- | C1 Null_iir or C1' (*) True -- | C2 Null_Iir False @@ -5656,7 +5656,7 @@ package Iirs is -- declaration for a full constant declaration, or is null_iir for a -- usual or deferred constant declaration. -- Set only during sem. - -- Field: Field6 + -- Field: Field6 Ref function Get_Deferred_Declaration (Target : Iir) return Iir; procedure Set_Deferred_Declaration (Target : Iir; Decl : Iir); diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb index 6c2ccd5..c1725ea 100644 --- a/src/vhdl/nodes_meta.adb +++ b/src/vhdl/nodes_meta.adb @@ -1646,7 +1646,7 @@ package body Nodes_Meta is when Field_Default_Value => return Attr_Maybe_Ref; when Field_Deferred_Declaration => - return Attr_None; + return Attr_Ref; when Field_Deferred_Declaration_Flag => return Attr_None; when Field_Shared_Flag => @@ -2923,11 +2923,11 @@ package body Nodes_Meta is Field_Expr_Staticness, Field_Name_Staticness, Field_Chain, - Field_Deferred_Declaration, Field_Default_Value, Field_Subtype_Indication, Field_Parent, Field_Type, + Field_Deferred_Declaration, -- Iir_Kind_Iterator_Declaration Field_Identifier, Field_Has_Identifier_List, diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb index a155b6f..f70566a 100644 --- a/src/vhdl/sem_decls.adb +++ b/src/vhdl/sem_decls.adb @@ -3042,11 +3042,6 @@ package body Sem_Decls is if Get_Deferred_Declaration (El) = Null_Iir then Error_Msg_Sem ("missing value for constant declared at " & Disp_Location (El), Decl); - else - -- Remove from visibility the full declaration of the - -- constant. - -- FIXME: this is not a check! - Set_Deferred_Declaration (El, Null_Iir); end if; end if; when Iir_Kind_Function_Declaration diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index df2f68d..5568905 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -3993,12 +3993,6 @@ package body Sem_Expr is end if; Lib := Get_Parent (Expr); - if Get_Kind (Lib) = Iir_Kind_Design_Unit then - Lib := Get_Library_Unit (Lib); - -- FIXME: the parent of the constant is the library unit or - -- the design unit ? - raise Internal_Error; - end if; Cur_Lib := Get_Library_Unit (Sem.Get_Current_Design_Unit); if (Get_Kind (Cur_Lib) = Iir_Kind_Package_Declaration and then Lib = Cur_Lib) -- cgit