This commit is contained in:
John Kerl 2016-10-03 18:28:08 -04:00
parent d891e0ff72
commit 4ed8e1b5c5
4 changed files with 11 additions and 11 deletions

View file

@ -407,8 +407,9 @@ static void mapper_put_or_filter_free(mapper_t* pmapper) {
mlhmmv_free(pstate->poosvars);
bind_stack_free(pstate->pbind_stack);
loop_stack_free(pstate->ploop_stack);
// The AST is pointed to by the CST and will be freed by the CST destructor
mlr_dsl_cst_free(pstate->pcst);
// Free what's left of the stripped AST after the CST reorganized it.
mlr_dsl_ast_free(pstate->past);
free(pstate->pwriter_opts);
free(pstate);

View file

@ -195,7 +195,6 @@ void mlr_dsl_cst_free(mlr_dsl_cst_t* pcst) {
}
analyzed_ast_free(pcst->paast);
mlr_dsl_ast_free(pcst->past);
free(pcst);
}

View file

@ -249,8 +249,8 @@ typedef struct _mlr_dsl_cst_t {
// Notes:
// * do_final_filter is FALSE for mlr put, TRUE for mlr filter.
// * negate_final_filter is TRUE for mlr filter -x.
// * The CST object retains the AST pointer (in order to reuse its strings etc. with minimal copying)
// and will free the AST in the CST destructor.
// * The CST object strips nodes off the raw AST, constructed by the Lemon parser, in order
// to do analysis on it. Nonetheless the caller should free what's left.
mlr_dsl_cst_t* mlr_dsl_cst_alloc(mlr_dsl_ast_t* past, int type_inferencing, int flush_every_record,
int do_final_filter, int negate_final_filter);

View file

@ -19,13 +19,13 @@ FUNCTIONALITY FOR 4.6.0:
(issue is computation is dominated by lhmsv_get/put/string_hash_func.)
o 1st AST pass: pivot around to have begin, end, main, funcs, subrs
- all begin statements -> one list
- all end statements -> one list
- all func defs -> one list
- all subr defs -> one list
- all else -> main-statements list
- sllv_pop/append to make it quick
? cst_pre_analyze_t struct or some such?
k all begin statements -> one list
k all end statements -> one list
k all func defs -> one list
k all subr defs -> one list
k all else -> main-statements list
k sllv_pop/append to make it quick
k cst_pre_analyze_t struct or some such?
? ctor-0 frindex field @ mlr_dsl_ast_node_t?
o 2nd AST pass: analyze each for max depth: local def, write, read. adapt existing lmhsv/resolve logic.
o 3rd AST pass: rewrite localvar names w/ frame-relative indices