aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-12-08 07:17:47 +0100
committerTristan Gingold <tgingold@free.fr>2018-12-08 07:17:47 +0100
commit994cb1d7a6bc09e5adf3667b00e78aeca8f06f3a (patch)
tree8237b6afb296dc2c1b2bbbeb3b5f3ee5250aaeb9 /src/vhdl
parent51178dc5ff0d4a4fde04051b3c6c6705219499a6 (diff)
downloadghdl-994cb1d7a6bc09e5adf3667b00e78aeca8f06f3a.tar.gz
ghdl-994cb1d7a6bc09e5adf3667b00e78aeca8f06f3a.tar.bz2
ghdl-994cb1d7a6bc09e5adf3667b00e78aeca8f06f3a.zip
update_record_constraint: minor refactoring.
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/sem_expr.adb3
-rw-r--r--src/vhdl/sem_types.adb18
-rw-r--r--src/vhdl/sem_types.ads4
3 files changed, 11 insertions, 14 deletions
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb
index 7009411c6..60c2408d3 100644
--- a/src/vhdl/sem_expr.adb
+++ b/src/vhdl/sem_expr.adb
@@ -3190,8 +3190,7 @@ package body Sem_Expr is
end if;
Staticness := Min (Staticness,
Get_Type_Staticness (Rec_El_Type));
- Constraint := Sem_Types.Update_Record_Constraint (Constraint,
- Rec_El_Type);
+ Sem_Types.Update_Record_Constraint (Constraint, Rec_El_Type);
end loop;
Set_Type_Staticness (Rec_Type, Staticness);
Set_Constraint_State (Rec_Type, Constraint);
diff --git a/src/vhdl/sem_types.adb b/src/vhdl/sem_types.adb
index 74c111ed0..ec802b31c 100644
--- a/src/vhdl/sem_types.adb
+++ b/src/vhdl/sem_types.adb
@@ -739,23 +739,21 @@ package body Sem_Types is
-- - [...]
-- - It is a record subtype and each element subtype either is not a
-- composite subtype or is a fully constrained composite subtype.
- function Update_Record_Constraint
- (Constraint : Iir_Constraint; El_Type : Iir) return Iir_Constraint is
+ procedure Update_Record_Constraint
+ (Constraint : in out Iir_Constraint; El_Type : Iir) is
begin
if Get_Kind (El_Type) not in Iir_Kinds_Composite_Type_Definition then
- return Constraint;
+ return;
end if;
case Constraint is
when Fully_Constrained
| Unconstrained =>
- if Get_Constraint_State (El_Type) = Constraint then
- return Constraint;
- else
- return Partially_Constrained;
+ if Get_Constraint_State (El_Type) /= Constraint then
+ Constraint := Partially_Constrained;
end if;
when Partially_Constrained =>
- return Partially_Constrained;
+ Constraint := Partially_Constrained;
end case;
end Update_Record_Constraint;
@@ -896,7 +894,7 @@ package body Sem_Types is
Resolved_Flag and Get_Resolved_Flag (El_Type);
Type_Staticness := Min (Type_Staticness,
Get_Type_Staticness (El_Type));
- Constraint := Update_Record_Constraint (Constraint, El_Type);
+ Update_Record_Constraint (Constraint, El_Type);
else
Type_Staticness := None;
end if;
@@ -2084,7 +2082,7 @@ package body Sem_Types is
Set_Element_Position (El, Get_Element_Position (Tm_El));
end if;
Set_Nth_Element (El_List, I, El);
- Constraint := Update_Record_Constraint (Constraint, El_Type);
+ Update_Record_Constraint (Constraint, El_Type);
Staticness := Min (Staticness, Get_Type_Staticness (El_Type));
end loop;
Set_Constraint_State (Res, Constraint);
diff --git a/src/vhdl/sem_types.ads b/src/vhdl/sem_types.ads
index 715a1199b..4fe6020af 100644
--- a/src/vhdl/sem_types.ads
+++ b/src/vhdl/sem_types.ads
@@ -58,8 +58,8 @@ package Sem_Types is
-- Return the constraint state from CONST (the initial state) and EL_TYPE,
-- as if ATYPE was a new element of a record.
- function Update_Record_Constraint
- (Constraint : Iir_Constraint; El_Type : Iir) return Iir_Constraint;
+ procedure Update_Record_Constraint
+ (Constraint : in out Iir_Constraint; El_Type : Iir);
-- Although a nature is not a type, it is patterned like a type.
function Sem_Subnature_Indication (Def: Iir) return Iir;