summaryrefslogtreecommitdiff
path: root/src/astbranch.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-12-27 00:04:28 -0700
committerMike Buland <eichlan@xagasoft.com>2011-12-27 00:04:28 -0700
commitf33fdd93ef93fdbb0e6b3a8e2ecb80b78f1b2816 (patch)
tree3e62207265b4efbbe1565ea885a615e5a910671c /src/astbranch.cpp
parent32c32bc48c8fd7cffca301b8919fb26726f6467e (diff)
downloadstage-f33fdd93ef93fdbb0e6b3a8e2ecb80b78f1b2816.tar.gz
stage-f33fdd93ef93fdbb0e6b3a8e2ecb80b78f1b2816.tar.bz2
stage-f33fdd93ef93fdbb0e6b3a8e2ecb80b78f1b2816.tar.xz
stage-f33fdd93ef93fdbb0e6b3a8e2ecb80b78f1b2816.zip
Branch building has started.
Diffstat (limited to 'src/astbranch.cpp')
-rw-r--r--src/astbranch.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/astbranch.cpp b/src/astbranch.cpp
index 7b31426..a422a62 100644
--- a/src/astbranch.cpp
+++ b/src/astbranch.cpp
@@ -1,7 +1,10 @@
1#include "astbranch.h" 1#include "astbranch.h"
2 2
3#include <bu/formatter.h>
4
3AstBranch::AstBranch( AstNode::Type eType ) : 5AstBranch::AstBranch( AstNode::Type eType ) :
4 AstNode( eType ) 6 AstNode( eType ),
7 pParent( NULL )
5{ 8{
6} 9}
7 10
@@ -13,4 +16,27 @@ AstBranch::~AstBranch()
13 } 16 }
14} 17}
15 18
19AstNode *AstBranch::addNode( AstNode *pNode )
20{
21 AstBranch *pBranch = dynamic_cast<AstBranch *>(pNode);
22 if( pBranch )
23 {
24 pBranch->pParent = this;
25 }
26 lNodes.append( pNode );
27 return pNode;
28}
29
30Bu::Formatter &operator<<( Bu::Formatter &f, const AstBranch &b )
31{
32 f << "(Branch " << b.getType() << ": ";
33 f.incIndent();
34 for( typename AstBranch::NodeList::const_iterator i = b.lNodes.begin();
35 i; i++ )
36 {
37 f << f.nl << *(*i);
38 }
39 f.decIndent();
40 return f << f.nl << ")";
41}
16 42