2015-07-03 Christophe Lyon <christophe.lyon@linaro.org>
[official-gcc.git] / gcc / testsuite / gnat.dg / opt27_pkg.adb
blob17ffb731db25c9235bda97bcdcb3570b6fcb0797
1 package body Opt27_Pkg is
3 type Node_Rec_T is record
4 Element : Element_T;
5 Left : Node_T;
6 Right : Node_T;
7 end record;
9 function Is_Null (Node : in Node_T) return Boolean is
10 begin
11 return (Node = null);
12 end Is_Null;
14 function Find_Elem (Template : Template_T; List : List_T) return Node_T is
15 Element_Found : Boolean := False;
16 Node_Walker : Node_T := null;
17 begin
18 Node_Walker := List.First_Node;
20 while not Element_Found and (Node_Walker /= null) loop
22 if Is_Match (Node_Walker.Element, Template) then
23 Element_Found := True;
24 else
25 Node_Walker := Node_Walker.Right;
26 end if;
27 end loop;
29 return Node_Walker;
30 end;
32 end Opt27_Pkg;