diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-09-23 09:31:54 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-09-25 18:32:45 +0200 |
commit | 7510e8a3d9a6b00b634addf41ea07a5e0b1f9cb0 (patch) | |
tree | bc5c97bc9a2aecc37df9ef8db1ef5401cc08f60b | |
parent | 6a82fea317eaa9befab7e8d5c78d4cb2ea5b7fdf (diff) | |
download | ghdl-7510e8a3d9a6b00b634addf41ea07a5e0b1f9cb0.tar.gz ghdl-7510e8a3d9a6b00b634addf41ea07a5e0b1f9cb0.tar.bz2 ghdl-7510e8a3d9a6b00b634addf41ea07a5e0b1f9cb0.zip |
sem_assocs: always cleanup formals if not finishing.
-rw-r--r-- | src/vhdl/sem_assocs.adb | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/src/vhdl/sem_assocs.adb b/src/vhdl/sem_assocs.adb index 70a6af9c4..1b0910469 100644 --- a/src/vhdl/sem_assocs.adb +++ b/src/vhdl/sem_assocs.adb @@ -2114,30 +2114,6 @@ package body Sem_Assocs is Loc : Iir; Match : out Compatibility_Level) is - First_Named_Assoc : Iir; - Last_Named_Assoc : Iir; - - procedure Cleanup_Formals - is - Assoc : Iir; - Formal : Iir; - begin - if Finish or First_Named_Assoc = Null_Iir then - return; - end if; - Assoc := First_Named_Assoc; - while Assoc /= Null_Iir loop - Formal := Get_Formal (Assoc); - -- User may have used by position assoc after named - -- assocs. - if Is_Valid (Formal) then - Sem_Name_Clean (Formal); - end if; - exit when Assoc = Last_Named_Assoc; - Assoc := Get_Chain (Assoc); - end loop; - end Cleanup_Formals; - Assoc : Iir; Inter : Iir; @@ -2152,6 +2128,9 @@ package body Sem_Assocs is Pos : Integer; Formal : Iir; + First_Named_Assoc : Iir; + Last_Named_Assoc : Iir; + Formal_Name : Iir; Formal_Conv : Iir; begin @@ -2479,17 +2458,33 @@ package body Sem_Assocs is Sem_Scopes.Close_Declarative_Region; + if Finish and Has_Individual and Match /= Not_Compatible then + Sem_Individual_Association (Assoc_Chain); + end if; + + if not Finish then + -- Always cleanup if not finishing: there can be other tries in + -- case of overloading. + Assoc := First_Named_Assoc; + while Assoc /= Null_Iir loop + Formal := Get_Formal (Assoc); + -- User may have used by position assoc after named + -- assocs. + if Is_Valid (Formal) then + Sem_Name_Clean (Formal); + end if; + exit when Assoc = Last_Named_Assoc; + Assoc := Get_Chain (Assoc); + end loop; + end if; + if Match = Not_Compatible then - Cleanup_Formals; return; end if; end if; - if Finish and then Has_Individual then - Sem_Individual_Association (Assoc_Chain); - end if; - if Missing = Missing_Allowed then + -- No need to check for missing associations. return; end if; @@ -2533,7 +2528,6 @@ package body Sem_Assocs is if Finish then Error_Msg_Sem (+Loc, "no actual for %n", +Inter); end if; - Cleanup_Formals; Match := Not_Compatible; return; when Missing_Port => @@ -2575,7 +2569,6 @@ package body Sem_Assocs is | Iir_Kind_Interface_Function_Declaration | Iir_Kind_Interface_Procedure_Declaration => Error_Msg_Sem (+Loc, "%n must be associated", +Inter); - Cleanup_Formals; Match := Not_Compatible; when others => Error_Kind ("sem_association_chain", Inter); |