diff options
Diffstat (limited to 'gcc/ada/a-ciorse.adb')
-rw-r--r-- | gcc/ada/a-ciorse.adb | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/gcc/ada/a-ciorse.adb b/gcc/ada/a-ciorse.adb index 7a782189708..673cd510a3c 100644 --- a/gcc/ada/a-ciorse.adb +++ b/gcc/ada/a-ciorse.adb @@ -42,16 +42,21 @@ package body Ada.Containers.Indefinite_Ordered_Sets is type Iterator is new Ordered_Set_Iterator_Interfaces.Reversible_Iterator with record - Container : access constant Set; - Node : Node_Access; - end record; + Container : access constant Set; + Node : Node_Access; + end record; overriding function First (Object : Iterator) return Cursor; - overriding function Last (Object : Iterator) return Cursor; - overriding function Next (Object : Iterator; Position : Cursor) - return Cursor; - overriding function Previous (Object : Iterator; Position : Cursor) - return Cursor; + + overriding function Last (Object : Iterator) return Cursor; + + overriding function Next + (Object : Iterator; + Position : Cursor) return Cursor; + + overriding function Previous + (Object : Iterator; + Position : Cursor) return Cursor; ----------------------- -- Local Subprograms -- @@ -582,7 +587,7 @@ package body Ada.Containers.Indefinite_Ordered_Sets is function First (Object : Iterator) return Cursor is begin return Cursor'( - Object.Container.all'Unrestricted_Access, Object.Container.Tree.First); + Object.Container.all'Unrestricted_Access, Object.Container.Tree.First); end First; ------------------- @@ -593,9 +598,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is begin if Container.Tree.First = null then raise Constraint_Error with "set is empty"; + else + return Container.Tree.First.Element.all; end if; - - return Container.Tree.First.Element.all; end First_Element; ----------- @@ -605,13 +610,12 @@ package body Ada.Containers.Indefinite_Ordered_Sets is function Floor (Container : Set; Item : Element_Type) return Cursor is Node : constant Node_Access := Element_Keys.Floor (Container.Tree, Item); - begin if Node = null then return No_Element; + else + return Cursor'(Container'Unrestricted_Access, Node); end if; - - return Cursor'(Container'Unrestricted_Access, Node); end Floor; ---------- @@ -1209,8 +1213,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is B := B - 1; end Iterate; - function Iterate (Container : Set) - return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class + function Iterate + (Container : Set) + return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class is It : constant Iterator := (Container'Unchecked_Access, Container.Tree.First); @@ -1218,8 +1223,10 @@ package body Ada.Containers.Indefinite_Ordered_Sets is return It; end Iterate; - function Iterate (Container : Set; Start : Cursor) - return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class + function Iterate + (Container : Set; + Start : Cursor) + return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class is It : constant Iterator := (Container'Unchecked_Access, Start.Node); begin @@ -1234,19 +1241,20 @@ package body Ada.Containers.Indefinite_Ordered_Sets is begin if Container.Tree.Last = null then return No_Element; + else + return Cursor'(Container'Unrestricted_Access, Container.Tree.Last); end if; - - return Cursor'(Container'Unrestricted_Access, Container.Tree.Last); end Last; function Last (Object : Iterator) return Cursor is begin if Object.Container.Tree.Last = null then return No_Element; + else + return Cursor'( + Object.Container.all'Unrestricted_Access, + Object.Container.Tree.Last); end if; - - return Cursor'( - Object.Container.all'Unrestricted_Access, Object.Container.Tree.Last); end Last; ------------------ @@ -1257,9 +1265,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is begin if Container.Tree.Last = null then raise Constraint_Error with "set is empty"; + else + return Container.Tree.Last.Element.all; end if; - - return Container.Tree.Last.Element.all; end Last_Element; ---------- @@ -1327,8 +1335,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is end; end Next; - function Next (Object : Iterator; Position : Cursor) - return Cursor + function Next + (Object : Iterator; + Position : Cursor) return Cursor is pragma Unreferenced (Object); begin @@ -1388,8 +1397,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is end; end Previous; - function Previous (Object : Iterator; Position : Cursor) - return Cursor + function Previous + (Object : Iterator; + Position : Cursor) return Cursor is pragma Unreferenced (Object); begin |