diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-07-22 06:57:46 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-07-22 22:23:00 +0200 |
commit | d8a81db96f512c0d58b554df294f4acb0915d6a9 (patch) | |
tree | 2d1bdd2f3ee9e225adda728e8a3c6eff54ffb78c /src/vhdl/vhdl-evaluation.adb | |
parent | 4b862ddc4d81ff8b60bbc78eeb26d4221bfd52d8 (diff) | |
download | ghdl-d8a81db96f512c0d58b554df294f4acb0915d6a9.tar.gz ghdl-d8a81db96f512c0d58b554df294f4acb0915d6a9.tar.bz2 ghdl-d8a81db96f512c0d58b554df294f4acb0915d6a9.zip |
vhdl: replace base_type with parent_type in nodes
Only for subtype definition and remove base_type in type definitions.
Allows to better track the addition of contraints.
Diffstat (limited to 'src/vhdl/vhdl-evaluation.adb')
-rw-r--r-- | src/vhdl/vhdl-evaluation.adb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/vhdl/vhdl-evaluation.adb b/src/vhdl/vhdl-evaluation.adb index d21288136..65fa9e6ec 100644 --- a/src/vhdl/vhdl-evaluation.adb +++ b/src/vhdl/vhdl-evaluation.adb @@ -392,7 +392,7 @@ package body Vhdl.Evaluation is Error_Kind ("create_range_subtype_by_length", A_Type); end case; Set_Location (Res, Loc); - Set_Base_Type (Res, Get_Base_Type (A_Type)); + Set_Parent_Type (Res, A_Type); Set_Type_Staticness (Res, Locally); return Res; @@ -1199,18 +1199,20 @@ package body Vhdl.Evaluation is Get_Range_Constraint (Left_Index); Ret_Type : constant Iir := Get_Return_Type (Get_Implementation (Orig)); + Rng_Type : constant Iir := Get_Index_Type (Ret_Type, 0); A_Range : Iir; Index_Type : Iir; begin A_Range := Create_Iir (Iir_Kind_Range_Expression); - Set_Type (A_Range, Get_Index_Type (Ret_Type, 0)); + Location_Copy (A_Range, Orig); + Set_Type (A_Range, Rng_Type); Set_Expr_Staticness (A_Range, Locally); Set_Left_Limit (A_Range, Get_Left_Limit (Left_Range)); Set_Direction (A_Range, Get_Direction (Left_Range)); - Location_Copy (A_Range, Orig); Set_Right_Limit_By_Length (A_Range, Int64 (Res_Len)); + Index_Type := Create_Range_Subtype_From_Type - (Left_Index, Get_Location (Orig)); + (Rng_Type, Get_Location (Orig)); Set_Range_Constraint (Index_Type, A_Range); Res_Type := Create_Unidim_Array_From_Index (Origin_Type, Index_Type, Orig); @@ -2350,7 +2352,7 @@ package body Vhdl.Evaluation is Index_Type := Create_Iir (Iir_Kind_Integer_Subtype_Definition); Location_Copy (Index_Type, Conv); Set_Range_Constraint (Index_Type, Rng); - Set_Base_Type (Index_Type, Get_Base_Type (Conv_Index_Type)); + Set_Parent_Type (Index_Type, Conv_Index_Type); Set_Type_Staticness (Index_Type, Locally); end if; Res_Type := Create_Unidim_Array_From_Index |