diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-01 13:23:22 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-01 13:23:22 +0000 |
commit | cf4089a8eb480cd4e6f1f5e78e249072a4b986c9 (patch) | |
tree | b81300a66fd5db2e8413835a87c72c2a03cabbcc /gcc/ada/sem_aggr.adb | |
parent | e6281d47053107016083c88e259e1451d8a2ea13 (diff) | |
download | gcc-cf4089a8eb480cd4e6f1f5e78e249072a4b986c9.tar.gz |
2012-10-01 Vincent Pucci <pucci@adacore.com>
* sem_aggr.adb (New_Copy_Tree_And_Copy_Dimensions): New routine.
(Resolve_Record_Aggregate): New_Copy_Tree calls replaced by
New_Copy_Tree_And_Copy_Dimensions calls. Move_Dimensions call
replaced by Copy_Dimensions call.
* sem_dim.adb (Analyze_Dimension_Component_Declaration): Don't
remove the dimensions of expression in component declaration anymore.
(Copy_Dimensions): New routine.
(Move_Dimensions): Add call to Copy_Dimensions.
* sem_dim.ads (Copy_Dimensions): New routine.
(Move_Dimensions): Spec moved to body of Sem_Dim.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191922 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_aggr.adb')
-rw-r--r-- | gcc/ada/sem_aggr.adb | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index c8167f1ed26..dc03b66002d 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -2933,6 +2933,14 @@ package body Sem_Aggr is -- An error message is emitted if the components taking their value from -- the others choice do not have same type. + function New_Copy_Tree_And_Copy_Dimensions + (Source : Node_Id; + Map : Elist_Id := No_Elist; + New_Sloc : Source_Ptr := No_Location; + New_Scope : Entity_Id := Empty) return Node_Id; + -- Same as New_Copy_Tree (defined in Sem_Util), except that this routine + -- also copies the dimensions of Source to the returned node. + procedure Resolve_Aggr_Expr (Expr : Node_Id; Component : Node_Id); -- Analyzes and resolves expression Expr against the Etype of the -- Component. This routine also applies all appropriate checks to Expr. @@ -3134,7 +3142,7 @@ package body Sem_Aggr is if Expander_Active then return - New_Copy_Tree + New_Copy_Tree_And_Copy_Dimensions (Expression (Parent (Compon)), New_Sloc => Sloc (Assoc)); else @@ -3153,7 +3161,9 @@ package body Sem_Aggr is Others_Etype := Etype (Compon); if Expander_Active then - return New_Copy_Tree (Expression (Assoc)); + return + New_Copy_Tree_And_Copy_Dimensions + (Expression (Assoc)); else return Expression (Assoc); end if; @@ -3189,18 +3199,20 @@ package body Sem_Aggr is -- order to create a proper association for the -- expanded aggregate. - Expr := New_Copy_Tree (Expression (Parent (Compon))); - -- Component may have no default, in which case the -- expression is empty and the component is default- -- initialized, but an association for the component -- exists, and it is not covered by an others clause. - return Expr; + return + New_Copy_Tree_And_Copy_Dimensions + (Expression (Parent (Compon))); else if Present (Next (Selector_Name)) then - Expr := New_Copy_Tree (Expression (Assoc)); + Expr := + New_Copy_Tree_And_Copy_Dimensions + (Expression (Assoc)); else Expr := Expression (Assoc); end if; @@ -3225,6 +3237,25 @@ package body Sem_Aggr is return Expr; end Get_Value; + --------------------------------------- + -- New_Copy_Tree_And_Copy_Dimensions -- + --------------------------------------- + + function New_Copy_Tree_And_Copy_Dimensions + (Source : Node_Id; + Map : Elist_Id := No_Elist; + New_Sloc : Source_Ptr := No_Location; + New_Scope : Entity_Id := Empty) return Node_Id + is + New_Copy : constant Node_Id := + New_Copy_Tree (Source, Map, New_Sloc, New_Scope); + begin + -- Move the dimensions of Source to New_Copy + + Copy_Dimensions (Source, New_Copy); + return New_Copy; + end New_Copy_Tree_And_Copy_Dimensions; + ----------------------- -- Resolve_Aggr_Expr -- ----------------------- @@ -3391,7 +3422,7 @@ package body Sem_Aggr is -- Since New_Expr is not gonna be analyzed later on, we need to -- propagate here the dimensions form Expr to New_Expr. - Move_Dimensions (Expr, New_Expr); + Copy_Dimensions (Expr, New_Expr); else New_Expr := Expr; @@ -3986,7 +4017,7 @@ package body Sem_Aggr is and then Present (Expression (Parent (Component))) then Expr := - New_Copy_Tree + New_Copy_Tree_And_Copy_Dimensions (Expression (Parent (Component)), New_Scope => Current_Scope, New_Sloc => Sloc (N)); |