diff options
author | Vincent Pucci <pucci@adacore.com> | 2012-10-01 13:23:22 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-01 15:23:22 +0200 |
commit | ba9144840f5b72697946060758bdde386d4a6292 (patch) | |
tree | b81300a66fd5db2e8413835a87c72c2a03cabbcc /gcc/ada/sem_dim.adb | |
parent | 804fc056d55a4098d7a4a1fc895579aaf1bb3080 (diff) | |
download | gcc-ba9144840f5b72697946060758bdde386d4a6292.zip gcc-ba9144840f5b72697946060758bdde386d4a6292.tar.gz gcc-ba9144840f5b72697946060758bdde386d4a6292.tar.bz2 |
sem_aggr.adb (New_Copy_Tree_And_Copy_Dimensions): New routine.
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.
From-SVN: r191922
Diffstat (limited to 'gcc/ada/sem_dim.adb')
-rw-r--r-- | gcc/ada/sem_dim.adb | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb index 4902ae3..e25c158 100644 --- a/gcc/ada/sem_dim.adb +++ b/gcc/ada/sem_dim.adb @@ -336,6 +336,9 @@ package body Sem_Dim is function Is_Invalid (Position : Dimension_Position) return Boolean; -- Return True if Pos denotes the invalid position + procedure Move_Dimensions (From : Node_Id; To : Node_Id); + -- Copy dimension vector of From to To and delete dimension vector of From + procedure Remove_Dimensions (N : Node_Id); -- Remove the dimension vector of node N @@ -1718,10 +1721,6 @@ package body Sem_Dim is Error_Dim_Msg_For_Component_Declaration (N, Etyp, Expr); end if; end if; - - -- Removal of dimensions in expression - - Remove_Dimensions (Expr); end if; end Analyze_Dimension_Component_Declaration; @@ -2199,6 +2198,25 @@ package body Sem_Dim is end case; end Analyze_Dimension_Unary_Op; + --------------------- + -- Copy_Dimensions -- + --------------------- + + procedure Copy_Dimensions (From, To : Node_Id) is + Dims_Of_From : constant Dimension_Type := Dimensions_Of (From); + + begin + if Ada_Version < Ada_2012 then + return; + end if; + + -- Copy the dimension of 'From to 'To' + + if Exists (Dims_Of_From) then + Set_Dimensions (To, Dims_Of_From); + end if; + end Copy_Dimensions; + -------------------------- -- Create_Rational_From -- -------------------------- @@ -3221,8 +3239,6 @@ package body Sem_Dim is --------------------- procedure Move_Dimensions (From, To : Node_Id) is - Dims_Of_From : constant Dimension_Type := Dimensions_Of (From); - begin if Ada_Version < Ada_2012 then return; @@ -3230,10 +3246,8 @@ package body Sem_Dim is -- Copy the dimension of 'From to 'To' and remove dimension of 'From' - if Exists (Dims_Of_From) then - Set_Dimensions (To, Dims_Of_From); - Remove_Dimensions (From); - end if; + Copy_Dimensions (From, To); + Remove_Dimensions (From); end Move_Dimensions; ------------ |