aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/sem_types.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-10-17 06:18:36 +0200
committerTristan Gingold <tgingold@free.fr>2018-10-21 08:03:37 +0200
commited7ad157dbecc784bb2df44684442e88431db561 (patch)
tree491533354ca2add405e08869f66c1c74622f97d7 /src/vhdl/sem_types.adb
parent13000af67c96c2a3417fa321daa3fbf50165f54f (diff)
downloadghdl-ed7ad157dbecc784bb2df44684442e88431db561.tar.gz
ghdl-ed7ad157dbecc784bb2df44684442e88431db561.tar.bz2
ghdl-ed7ad157dbecc784bb2df44684442e88431db561.zip
Rework translation of unbounded and complex types.
Diffstat (limited to 'src/vhdl/sem_types.adb')
-rw-r--r--src/vhdl/sem_types.adb36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/vhdl/sem_types.adb b/src/vhdl/sem_types.adb
index 843f549e4..47432e140 100644
--- a/src/vhdl/sem_types.adb
+++ b/src/vhdl/sem_types.adb
@@ -1394,6 +1394,31 @@ package body Sem_Types is
(Def : Iir; Type_Mark : Iir; Resolution : Iir)
return Iir;
+ function Copy_Record_Element_Declaration (El : Iir; Parent : Iir) return Iir
+ is
+ New_El : Iir;
+ begin
+ case Get_Kind (El) is
+ when Iir_Kind_Element_Declaration =>
+ New_El := Create_Iir (Iir_Kind_Element_Declaration);
+ -- As this is a copy, it has no subtype indication.
+ Set_Subtype_Indication (New_El, Null_Iir);
+ when Iir_Kind_Record_Element_Constraint =>
+ New_El := Create_Iir (Iir_Kind_Record_Element_Constraint);
+ Set_Element_Declaration (New_El, Get_Element_Declaration (El));
+ when others =>
+ Error_Kind ("copy_record_element_declaration", El);
+ end case;
+ Location_Copy (New_El, El);
+ Set_Parent (New_El, Parent);
+ Set_Identifier (New_El, Get_Identifier (El));
+ Set_Type (New_El, Get_Type (El));
+ Set_Base_Element_Declaration
+ (New_El, Get_Base_Element_Declaration (El));
+ Set_Element_Position (New_El, Get_Element_Position (El));
+ return New_El;
+ end Copy_Record_Element_Declaration;
+
-- Create a copy of elements_declaration_list of SRC and set it to DST.
procedure Copy_Record_Elements_Declaration_List (Dst : Iir; Src : Iir)
is
@@ -1405,14 +1430,7 @@ package body Sem_Types is
Set_Elements_Declaration_List (Dst, New_El_List);
for I in Flist_First .. Flist_Last (El_List) loop
El := Get_Nth_Element (El_List, I);
- New_El := Create_Iir (Iir_Kind_Element_Declaration);
- Location_Copy (New_El, El);
- Set_Parent (New_El, Dst);
- Set_Identifier (New_El, Get_Identifier (El));
- Set_Type (New_El, Get_Type (El));
- Set_Base_Element_Declaration (New_El,
- Get_Base_Element_Declaration (El));
- Set_Element_Position (New_El, Get_Element_Position (El));
+ New_El := Copy_Record_Element_Declaration (El, Dst);
Set_Nth_Element (New_El_List, I, New_El);
end loop;
end Copy_Record_Elements_Declaration_List;
@@ -2030,7 +2048,7 @@ package body Sem_Types is
if Els (I) = Null_Iir and Res_Els (I) = Null_Iir then
-- No new record element constraints. Copy the element from
-- the type mark.
- El := Tm_El;
+ El := Copy_Record_Element_Declaration (Tm_El, Res);
El_Type := Get_Type (El);
else
if Els (I) = Null_Iir then