Remove currently unused node types from the tree code.

This commit is contained in:
Danila Fedorin 2018-02-18 19:42:54 -08:00
parent 12660b1e4a
commit 96b2dc234f
2 changed files with 4 additions and 18 deletions

View File

@ -11,21 +11,11 @@ enum libab_tree_variant_e {
NONE, NONE,
BASE, BASE,
ID, ID,
STR,
CHAR,
NUM, NUM,
BOOL,
KW,
OP, OP,
UNARY_OP, UNARY_OP,
BLOCK, BLOCK,
FUN, IF
IF,
WHILE,
DOWHILE,
FOR,
CALL,
RETURN
}; };
/** /**

View File

@ -4,10 +4,7 @@
int _tree_has_vector(libab_tree* tree) { int _tree_has_vector(libab_tree* tree) {
return tree->variant == BASE || tree->variant == OP || return tree->variant == BASE || tree->variant == OP ||
tree->variant == UNARY_OP || tree->variant == BLOCK || tree->variant == UNARY_OP || tree->variant == BLOCK ||
tree->variant == FUN || tree->variant == IF || tree->variant == IF;
tree->variant == WHILE || tree->variant == DOWHILE ||
tree->variant == FOR || tree->variant == CALL ||
tree->variant == RETURN;
} }
void libab_tree_free(libab_tree* tree) { void libab_tree_free(libab_tree* tree) {
@ -16,9 +13,8 @@ void libab_tree_free(libab_tree* tree) {
if(_tree_has_vector(tree)) { if(_tree_has_vector(tree)) {
free_vector = 1; free_vector = 1;
} }
if(tree->variant == ID || tree->variant == STR || tree->variant == NUM || if(tree->variant == ID || tree->variant == NUM ||
tree->variant == KW || tree->variant == OP || tree->variant == UNARY_OP || tree->variant == OP || tree->variant == UNARY_OP) {
tree->variant == FUN || tree->variant == CALL) {
free_string = 1; free_string = 1;
} }
if(free_string) free(tree->string_value); if(free_string) free(tree->string_value);