diff options
-rw-r--r-- | src/vhdl/translate/trans-chap4.adb | 6 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_names.adb | 25 |
2 files changed, 23 insertions, 8 deletions
diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb index 00a14c8b4..37ca1646b 100644 --- a/src/vhdl/translate/trans-chap4.adb +++ b/src/vhdl/translate/trans-chap4.adb @@ -1668,7 +1668,8 @@ package body Trans.Chap4 is when Type_Mode_Bounded_Arrays | Type_Mode_Bounded_Records | Type_Mode_Acc - | Type_Mode_Bounds_Acc => + | Type_Mode_Bounds_Acc + | Type_Mode_Protected => -- Create an object pointer. -- At elaboration: copy base from name. Atype := Tinfo.Ortho_Ptr_Type (Mode); @@ -1762,7 +1763,8 @@ package body Trans.Chap4 is (Decl_Type, T2M (Decl_Type, Mode), Name_Type, N, Decl); when Type_Mode_Acc - | Type_Mode_Bounds_Acc => + | Type_Mode_Bounds_Acc + | Type_Mode_Protected => New_Assign_Stmt (Get_Var (A), M2Addr (N)); when Type_Mode_Scalar => case Mode is diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb index 18051465c..957eb54ce 100644 --- a/src/vhdl/vhdl-sem_names.adb +++ b/src/vhdl/vhdl-sem_names.adb @@ -549,6 +549,8 @@ package body Vhdl.Sem_Names is is Prefix : Iir; Obj : Iir; + Obj_Alias : Iir; + Obj_Type : Iir; begin if Get_Kind (Name) /= Iir_Kind_Selected_Name then return; @@ -556,18 +558,29 @@ package body Vhdl.Sem_Names is Prefix := Get_Prefix (Name); Obj := Get_Named_Entity (Prefix); - if Obj /= Null_Iir - and then Kind_In (Obj, Iir_Kind_Variable_Declaration, - Iir_Kind_Interface_Variable_Declaration) - and then Get_Type (Obj) /= Null_Iir + if Obj = Null_Iir then + return; + end if; + if Get_Kind (Obj) = Iir_Kind_Object_Alias_Declaration then + Obj_Alias := Get_Named_Entity (Get_Name (Obj)); + else + Obj_Alias := Obj; + end if; + + if Kind_In (Obj_Alias, Iir_Kind_Variable_Declaration, + Iir_Kind_Interface_Variable_Declaration) then - if Get_Kind (Get_Type (Obj)) /= Iir_Kind_Protected_Type_Declaration + Obj_Type := Get_Type (Obj_Alias); + if Obj_Type = Null_Iir then + return; + end if; + if Get_Kind (Obj_Type) /= Iir_Kind_Protected_Type_Declaration then Error_Msg_Sem (+Prefix, "type of the prefix should be a protected type"); return; end if; - Set_Method_Object (Call, Obj); + Set_Method_Object (Call, Obj_Alias); Set_Use_Flag (Obj, True); end if; end Name_To_Method_Object; |