]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
delete ast_members from parser->locals when they were unused
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 18 Aug 2012 14:20:17 +0000 (16:20 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 18 Aug 2012 14:20:17 +0000 (16:20 +0200)
parser.c

index 1ee5cadf2cb030d47fb50ef8808c10ad34c57c0d..2df00cd56f89ee5d3923b4f1157fb56e36ae329d 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1668,6 +1668,11 @@ static void parser_pop_local(parser_t *parser)
 {
     parser->locals_count--;
     mem_d(parser->locals[parser->locals_count].name);
+    if (!ast_usecount(parser->locals[parser->locals_count].var) &&
+        ast_istype(parser->locals[parser->locals_count].var, ast_member))
+    {
+        ast_delete(parser->locals[parser->locals_count].var);
+    }
 }
 
 static ast_block* parser_parse_block(parser_t *parser)