aboutsummaryrefslogtreecommitdiffstats
path: root/sem_expr.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-06-28 03:47:31 +0200
committerTristan Gingold <tgingold@free.fr>2014-06-28 03:47:31 +0200
commitcde6aede1c8851fa0b64e548c5b9a391c1d6af8a (patch)
tree2f06ba4433b24d32e2c0dec7de3af2b06483af70 /sem_expr.adb
parent218d1abbe771abb57a91f17eb4ce9395df86ad67 (diff)
downloadghdl-cde6aede1c8851fa0b64e548c5b9a391c1d6af8a.tar.gz
ghdl-cde6aede1c8851fa0b64e548c5b9a391c1d6af8a.tar.bz2
ghdl-cde6aede1c8851fa0b64e548c5b9a391c1d6af8a.zip
Resolve expression in variable assignment when target is an aggregate.
Diffstat (limited to 'sem_expr.adb')
-rw-r--r--sem_expr.adb39
1 files changed, 39 insertions, 0 deletions
diff --git a/sem_expr.adb b/sem_expr.adb
index 33addfde6..e29ce8796 100644
--- a/sem_expr.adb
+++ b/sem_expr.adb
@@ -4000,6 +4000,45 @@ package body Sem_Expr is
return Res;
end Sem_Expression;
+ function Sem_Composite_Expression (Expr : Iir) return Iir
+ is
+ Res : Iir;
+ begin
+ Res := Sem_Expression_Ov (Expr, Null_Iir);
+ if Is_Overloaded (Res) then
+ declare
+ List : constant Iir_List := Get_Overload_List (Get_Type (Res));
+ Res_Type : Iir;
+ Atype : Iir;
+ begin
+ Res_Type := Null_Iir;
+ for I in Natural loop
+ Atype := Get_Nth_Element (List, I);
+ exit when Atype = Null_Iir;
+ if Is_Aggregate_Type (Atype) then
+ Add_Result (Res_Type, Atype);
+ end if;
+ end loop;
+
+ if Res_Type = Null_Iir then
+ Error_Overload (Expr);
+ return Null_Iir;
+ elsif Is_Overload_List (Res_Type) then
+ Error_Overload (Expr);
+ Disp_Overload_List (Get_Overload_List (Res_Type), Expr);
+ Free_Overload_List (Res_Type);
+ return Null_Iir;
+ else
+ return Sem_Expression_Ov (Expr, Res_Type);
+ end if;
+ end;
+ else
+ -- Either an error (already handled) or not overloaded. Type
+ -- matching will be done later (when the target is analyzed).
+ return Res;
+ end if;
+ end Sem_Composite_Expression;
+
function Sem_Expression_Universal (Expr : Iir) return Iir
is
Expr1 : Iir;