diff options
| author | Tristan Gingold <tgingold@free.fr> | 2022-08-07 07:30:26 +0200 | 
|---|---|---|
| committer | Tristan Gingold <tgingold@free.fr> | 2022-08-07 10:00:12 +0200 | 
| commit | cd71ea61f4d103908244bcdc98fbb6770244750f (patch) | |
| tree | c73530df6ead1a73050d7ddff358d1604c9db20e /src | |
| parent | 63c97602af5a19a6e3e48c6c1cafb98f0bb9359d (diff) | |
| download | ghdl-cd71ea61f4d103908244bcdc98fbb6770244750f.tar.gz ghdl-cd71ea61f4d103908244bcdc98fbb6770244750f.tar.bz2 ghdl-cd71ea61f4d103908244bcdc98fbb6770244750f.zip  | |
vhdl-prints: handle default in interface subprogram
Diffstat (limited to 'src')
| -rw-r--r-- | src/vhdl/vhdl-prints.adb | 20 | 
1 files changed, 19 insertions, 1 deletions
diff --git a/src/vhdl/vhdl-prints.adb b/src/vhdl/vhdl-prints.adb index ada2dc15a..c15f55788 100644 --- a/src/vhdl/vhdl-prints.adb +++ b/src/vhdl/vhdl-prints.adb @@ -231,6 +231,7 @@ package body Vhdl.Prints is             | Iir_Kinds_Interface_Object_Declaration             | Iir_Kind_Interface_Terminal_Declaration             | Iir_Kind_Interface_Type_Declaration +           | Iir_Kinds_Interface_Subprogram_Declaration             | Iir_Kind_Constant_Declaration             | Iir_Kind_Signal_Declaration             | Iir_Kind_Guard_Signal_Declaration @@ -1674,6 +1675,7 @@ package body Vhdl.Prints is       (Ctxt : in out Ctxt_Class; Subprg: Iir; Implicit : Boolean := False)     is        Inter : Iir; +      Default : Iir;     begin        if Implicit then           OOB.Put ("-- "); @@ -1715,6 +1717,18 @@ package body Vhdl.Prints is           when others =>              raise Internal_Error;        end case; + +      if Get_Kind (Subprg) in Iir_Kinds_Interface_Subprogram_Declaration then +         Default := Get_Default_Subprogram (Subprg); +         if Default /= Null_Iir then +            Disp_Token (Ctxt, Tok_Is); +            if Get_Kind (Default) = Iir_Kind_Reference_Name then +               Disp_Token (Ctxt, Tok_Box); +            else +               Print (Ctxt, Default); +            end if; +         end if; +      end if;     end Disp_Subprogram_Declaration;     procedure Disp_Subprogram_Body (Ctxt : in out Ctxt_Class; Subprg : Iir) is @@ -3326,7 +3340,10 @@ package body Vhdl.Prints is        El := Chain;        while El /= Null_Iir loop -         if Get_Kind (El) /= Iir_Kind_Association_Element_By_Individual then +         if Get_Kind (El) /= Iir_Kind_Association_Element_By_Individual +           and then not (Get_Kind (El) = Iir_Kind_Association_Element_Open +                           and then Get_Artificial_Flag (El)) +         then              if Need_Comma then                 Disp_Token (Ctxt, Tok_Comma);              end if; @@ -4917,6 +4934,7 @@ package body Vhdl.Prints is             | Iir_Kind_Subtype_Declaration             | Iir_Kind_Unit_Declaration             | Iir_Kinds_Interface_Object_Declaration +           | Iir_Kinds_Interface_Subprogram_Declaration             | Iir_Kind_Variable_Declaration             | Iir_Kind_Constant_Declaration             | Iir_Kind_Function_Declaration  | 
