summaryrefslogtreecommitdiff
path: root/include/chillAST/chillAST_node.hh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2016-09-23 22:02:47 -0600
committerTuowen Zhao <ztuowen@gmail.com>2016-09-23 22:02:47 -0600
commitddf5a43a66a91009e7fa33a689aac45e73c4dc97 (patch)
treedbb1376238c94d2a4a18a52b75f336ae61654d99 /include/chillAST/chillAST_node.hh
parent2f96d12dd05213276875d56fec361ff99ec9bd76 (diff)
downloadchill-ddf5a43a66a91009e7fa33a689aac45e73c4dc97.tar.gz
chill-ddf5a43a66a91009e7fa33a689aac45e73c4dc97.tar.bz2
chill-ddf5a43a66a91009e7fa33a689aac45e73c4dc97.zip
staging
Diffstat (limited to 'include/chillAST/chillAST_node.hh')
-rw-r--r--include/chillAST/chillAST_node.hh17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/chillAST/chillAST_node.hh b/include/chillAST/chillAST_node.hh
index f0afe17..ed155b2 100644
--- a/include/chillAST/chillAST_node.hh
+++ b/include/chillAST/chillAST_node.hh
@@ -8,6 +8,7 @@
//! generic node of the actual chillAST, a multiway tree node.
class chillAST_Node {
public:
+ // TODO decide how to hide some data
//! this Node's parent
chillAST_Node *parent;
//! this node's children
@@ -26,8 +27,18 @@ public:
static int chill_array_counter;
//! for manufactured pointer
static int chill_pointer_counter;
+
+ //! Base constructor for all inherited class
+ chillAST_Node() {
+ parent = NULL;
+ metacomment = NULL;
+ isFromSourceFile = true;
+ filename = NULL;
+ }
//! the type of this current node
virtual CHILLAST_NODE_TYPE getType() {return CHILLAST_NODE_UNKNOWN;};
+ //! the precedence of the current node, 0 being the highest
+ virtual int getPrec() {return INT16_MAX;}
bool isSourceFile() { return (getType() == CHILLAST_NODE_SOURCEFILE); };
@@ -136,7 +147,6 @@ public:
// void addDecl( chillAST_VarDecl *vd); // recursive, adds to first symbol table it can find
- // TODO decide how to hide some data
int getNumChildren() { return children.size(); };
@@ -151,6 +161,11 @@ public:
void setMetaComment(const char *c) { metacomment = strdup(c); };
+ virtual void chillMergeChildInfo(chillAST_Node){
+ // TODO if (par) par->getSourceFile()->addFunc(this); for FuncDecl
+ // TODO if (par) par->getSourceFile()->addMacro(this); For MacroDecl
+ // TODO if (parent) parent->addVariableToSymbolTable(this); // should percolate up until something has a symbol table
+ }
virtual void addChild(chillAST_Node *c) {
c->parent = this;