1 //
2 //	aegis - project change supervisor
3 //	Copyright (C) 1997, 2002-2008 Peter Miller
4 //
5 //	This program is free software; you can redistribute it and/or modify
6 //	it under the terms of the GNU General Public License as published by
7 //	the Free Software Foundation; either version 3 of the License, or
8 //	(at your option) any later version.
9 //
10 //	This program is distributed in the hope that it will be useful,
11 //	but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //	GNU General Public License for more details.
14 //
15 //	You should have received a copy of the GNU General Public License
16 //	along with this program. If not, see
17 //	<http://www.gnu.org/licenses/>.
18 //
19 
20 #include <common/ac/stdio.h>
21 
22 #include <aefind/tree/diadic.h>
23 
24 
~tree_diadic()25 tree_diadic::~tree_diadic()
26 {
27 }
28 
29 
tree_diadic(const tree::pointer & lhs,const tree::pointer & rhs)30 tree_diadic::tree_diadic(const tree::pointer &lhs, const tree::pointer &rhs) :
31     left(lhs),
32     right(rhs)
33 {
34 }
35 
36 
37 void
print() const38 tree_diadic::print()
39     const
40 {
41     printf("( ");
42     left->print();
43     printf(" %s ", name());
44     right->print();
45     printf(" )");
46 }
47 
48 
49 bool
useful() const50 tree_diadic::useful()
51     const
52 {
53     return (left->useful() || right->useful());
54 }
55 
56 
57 bool
constant() const58 tree_diadic::constant()
59     const
60 {
61     return (left->constant() && right->constant());
62 }
63