Remove currently unused node types from the tree code.
This commit is contained in:
parent
12660b1e4a
commit
96b2dc234f
|
@ -11,21 +11,11 @@ enum libab_tree_variant_e {
|
|||
NONE,
|
||||
BASE,
|
||||
ID,
|
||||
STR,
|
||||
CHAR,
|
||||
NUM,
|
||||
BOOL,
|
||||
KW,
|
||||
OP,
|
||||
UNARY_OP,
|
||||
BLOCK,
|
||||
FUN,
|
||||
IF,
|
||||
WHILE,
|
||||
DOWHILE,
|
||||
FOR,
|
||||
CALL,
|
||||
RETURN
|
||||
IF
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
10
src/tree.c
10
src/tree.c
|
@ -4,10 +4,7 @@
|
|||
int _tree_has_vector(libab_tree* tree) {
|
||||
return tree->variant == BASE || tree->variant == OP ||
|
||||
tree->variant == UNARY_OP || tree->variant == BLOCK ||
|
||||
tree->variant == FUN || tree->variant == IF ||
|
||||
tree->variant == WHILE || tree->variant == DOWHILE ||
|
||||
tree->variant == FOR || tree->variant == CALL ||
|
||||
tree->variant == RETURN;
|
||||
tree->variant == IF;
|
||||
}
|
||||
|
||||
void libab_tree_free(libab_tree* tree) {
|
||||
|
@ -16,9 +13,8 @@ void libab_tree_free(libab_tree* tree) {
|
|||
if(_tree_has_vector(tree)) {
|
||||
free_vector = 1;
|
||||
}
|
||||
if(tree->variant == ID || tree->variant == STR || tree->variant == NUM ||
|
||||
tree->variant == KW || tree->variant == OP || tree->variant == UNARY_OP ||
|
||||
tree->variant == FUN || tree->variant == CALL) {
|
||||
if(tree->variant == ID || tree->variant == NUM ||
|
||||
tree->variant == OP || tree->variant == UNARY_OP) {
|
||||
free_string = 1;
|
||||
}
|
||||
if(free_string) free(tree->string_value);
|
||||
|
|
Loading…
Reference in New Issue
Block a user