lex_file *lex;
int tok;
+ bool ast_cleaned;
+
ast_expression **globals;
ast_expression **fields;
ast_function **functions;
return parser_compile(parser);
}
-void parser_cleanup(parser_t *parser)
+static void parser_remove_ast(parser_t *parser)
{
size_t i;
+ if (parser->ast_cleaned)
+ return;
+ parser->ast_cleaned = true;
for (i = 0; i < vec_size(parser->accessors); ++i) {
ast_delete(parser->accessors[i]->constval.vfunc);
parser->accessors[i]->constval.vfunc = NULL;
ast_value_delete(parser->const_vec[2]);
util_htdel(parser->aliases);
-
intrin_intrinsics_destroy(parser);
+}
+void parser_cleanup(parser_t *parser)
+{
+ parser_remove_ast(parser);
code_cleanup(parser->code);
mem_d(parser);
return false;
}
}
+
+ generate_checksum(parser);
if (OPTS_OPTION_BOOL(OPTION_DUMP))
ir_builder_dump(ir, con_out);
for (i = 0; i < vec_size(parser->functions); ++i) {
return false;
}
}
+ parser_remove_ast(parser);
if (compile_Werrors) {
con_out("*** there were warnings treated as errors\n");
if (OPTS_OPTION_BOOL(OPTION_DUMPFIN))
ir_builder_dump(ir, con_out);
- generate_checksum(parser);
-
if (!ir_builder_generate(parser->code, ir, output)) {
con_out("*** failed to generate output file\n");
ir_builder_delete(ir);
return false;
}
}
-
ir_builder_delete(ir);
return retval;
}