aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-decls.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-07-01 20:35:00 +0200
committerTristan Gingold <tgingold@free.fr>2019-07-01 20:35:00 +0200
commit1c59818d0a07f10781abb565e7941e0a3411926f (patch)
treeb9cea65b45ceff8d01948412ae72085deeae8d7b /src/synth/synth-decls.adb
parentc675324384a2c1b6904e73bf0ed58687479fb351 (diff)
downloadghdl-1c59818d0a07f10781abb565e7941e0a3411926f.tar.gz
ghdl-1c59818d0a07f10781abb565e7941e0a3411926f.tar.bz2
ghdl-1c59818d0a07f10781abb565e7941e0a3411926f.zip
synth: destroy iterator after for-loop.
Diffstat (limited to 'src/synth/synth-decls.adb')
-rw-r--r--src/synth/synth-decls.adb23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb
index 0726cfa6d..0166a07b8 100644
--- a/src/synth/synth-decls.adb
+++ b/src/synth/synth-decls.adb
@@ -160,15 +160,14 @@ package body Synth.Decls is
Synth_Subtype_Indication (Syn_Inst, Atype);
end Synth_Anonymous_Subtype_Indication;
- procedure Synth_Declaration_Type
- (Syn_Inst : Synth_Instance_Acc; Decl : Node)
+ function Get_Declaration_Type (Decl : Node) return Node
is
Ind : constant Node := Get_Subtype_Indication (Decl);
Atype : Node;
begin
if Ind = Null_Node then
-- No subtype indication; use the same type.
- return;
+ return Null_Node;
end if;
Atype := Ind;
loop
@@ -177,18 +176,28 @@ package body Synth.Decls is
Atype := Get_Named_Entity (Atype);
when Iir_Kind_Subtype_Declaration
| Iir_Kind_Type_Declaration =>
- return;
+ return Null_Node;
when Iir_Kind_Array_Subtype_Definition
| Iir_Kind_Integer_Subtype_Definition
| Iir_Kind_Floating_Subtype_Definition
| Iir_Kind_Physical_Subtype_Definition
| Iir_Kind_Enumeration_Subtype_Definition =>
- Synth_Subtype_Indication (Syn_Inst, Atype);
- return;
+ return Atype;
when others =>
- Error_Kind ("synth_declaration_type", Atype);
+ Error_Kind ("get_declaration_type", Atype);
end case;
end loop;
+ end Get_Declaration_Type;
+
+ procedure Synth_Declaration_Type
+ (Syn_Inst : Synth_Instance_Acc; Decl : Node)
+ is
+ Atype : constant Node := Get_Declaration_Type (Decl);
+ begin
+ if Atype = Null_Node then
+ return;
+ end if;
+ Synth_Subtype_Indication (Syn_Inst, Atype);
end Synth_Declaration_Type;
procedure Synth_Constant_Declaration