/* e.g. let foo = *bar; */
let->var->pointer_level = let->val->data.var->pointer_level;
let->var->arg = init_decl_arg(
- init_decl_type(real_decl_type(let->val->data.var->arg->type)->type,
+ init_decl_type(
+ real_decl_type(let->val->data.var->arg->type)->type,
real_decl_type(let->val->data.var->arg->type)->name),
- init_decl_var(let->var->name, let->var->pointer_level, let->var->array_size));
+ init_decl_var(
+ let->var->name,
+ let->var->pointer_level,
+ let->var->array_size));
break;
case PSI_LET_NUMEXP:
if (!validate_num_exp(data, impl->decl->args, impl->decl->func, let->val->data.num)) {
}
static inline void free_let_stmt(let_stmt *stmt) {
- free_decl_var(stmt->var);
if (stmt->val) {
+ if (stmt->val->kind == PSI_LET_TMP && stmt->var->arg) {
+ free_decl_arg(stmt->var->arg);
+ }
free_let_val(stmt->val);
}
+ free_decl_var(stmt->var);
free(stmt);
}
}
free(val->inner);
}
+ if (val->num) {
+ free_num_exp(val->num);
+ }
free(val);
}
static inline void free_free_call(free_call *f) {
free(f->func);
+ free_decl_vars(f->vars);
free(f);
}