aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-09-02 05:07:15 +0200
committerTristan Gingold <tgingold@free.fr>2016-09-02 05:07:15 +0200
commit35a6c9f98a012e50ec7de9e8847235321a4fb35b (patch)
tree6fe3639bb65cdd34d4430a9cceaab241d255ec58 /src/ortho
parent3d73c2660aa6e32d8976f5a73494c425bb9ce73f (diff)
downloadghdl-35a6c9f98a012e50ec7de9e8847235321a4fb35b.tar.gz
ghdl-35a6c9f98a012e50ec7de9e8847235321a4fb35b.tar.bz2
ghdl-35a6c9f98a012e50ec7de9e8847235321a4fb35b.zip
oread: check for duplicate fields in records.
Diffstat (limited to 'src/ortho')
-rw-r--r--src/ortho/oread/ortho_front.adb9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ortho/oread/ortho_front.adb b/src/ortho/oread/ortho_front.adb
index 1ce75a360..13fdc77ae 100644
--- a/src/ortho/oread/ortho_front.adb
+++ b/src/ortho/oread/ortho_front.adb
@@ -969,6 +969,7 @@ package body Ortho_Front is
if Name /= null and then Name.Scope = Scope then
Prev := Name.Inter;
if Prev.Kind = Inter.Kind
+ and then Prev.Kind /= Node_Field
and then Prev.Decl_Dtype = Inter.Decl_Dtype
and then Prev.Decl_Storage = O_Storage_External
and then Inter.Decl_Storage = O_Storage_Public
@@ -1023,6 +1024,8 @@ package body Ortho_Front is
Field : Node_Acc;
Num : Natural;
begin
+ Push_Scope;
+
Last_Field := null;
Num := 0;
loop
@@ -1041,6 +1044,10 @@ package body Ortho_Front is
Field_Type => F_Type,
Field_Next => null,
Field_Hash_Next => null);
+
+ -- Check fields are uniq.
+ Add_Decl (F, Field);
+
case Aggr_Type.Kind is
when Type_Record =>
New_Record_Field (Constr, Field.Field_Fnode, F.Ident,
@@ -1066,6 +1073,8 @@ package body Ortho_Front is
Next_Token;
end loop;
+ Pop_Scope;
+
-- Create a map if there are a lot of fields.
if Num > 16 then
declare