diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-12-12 21:15:14 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-12-13 20:12:40 +0100 |
commit | 15cc8103e06050484e357a3928dedcc691c59535 (patch) | |
tree | 04714993b4077f64f6d171a3446281fb713f8114 /src/vhdl/sem_names.adb | |
parent | 36b5b63ef90d7311c483e6adcbf22adf3e31174c (diff) | |
download | ghdl-15cc8103e06050484e357a3928dedcc691c59535.tar.gz ghdl-15cc8103e06050484e357a3928dedcc691c59535.tar.bz2 ghdl-15cc8103e06050484e357a3928dedcc691c59535.zip |
select_name: consider subtype.
For #191
Diffstat (limited to 'src/vhdl/sem_names.adb')
-rw-r--r-- | src/vhdl/sem_names.adb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb index 0d03b8d4f..6e7315bb7 100644 --- a/src/vhdl/sem_names.adb +++ b/src/vhdl/sem_names.adb @@ -1898,27 +1898,31 @@ package body Sem_Names is -- Analyze SUB_NAME.NAME as a selected element. procedure Sem_As_Selected_Element (Sub_Name : Iir) is - Base_Type : Iir; + Name_Type : Iir; Ptr_Type : Iir; Rec_El : Iir; R : Iir; Se : Iir; begin -- FIXME: if not is_expr (sub_name) return. - Base_Type := Get_Base_Type (Get_Type (Sub_Name)); - if Get_Kind (Base_Type) = Iir_Kind_Access_Type_Definition then - Ptr_Type := Base_Type; - Base_Type := Get_Base_Type (Get_Designated_Type (Base_Type)); + Name_Type := Get_Type (Sub_Name); + if Kind_In (Name_Type, Iir_Kind_Access_Type_Definition, + Iir_Kind_Access_Subtype_Definition) + then + Ptr_Type := Name_Type; + Name_Type := Get_Designated_Type (Name_Type); else Ptr_Type := Null_Iir; end if; - if Get_Kind (Base_Type) /= Iir_Kind_Record_Type_Definition then + if not Kind_In (Name_Type, Iir_Kind_Record_Type_Definition, + Iir_Kind_Record_Subtype_Definition) + then return; end if; Rec_El := Find_Name_In_List - (Get_Elements_Declaration_List (Base_Type), Suffix); + (Get_Elements_Declaration_List (Name_Type), Suffix); if Rec_El = Null_Iir then return; end if; |