Fix slice codegen inside calls. Add core_free_compiler
This commit is contained in:
@@ -304,6 +304,9 @@ gen_try_any_or_slice(Ast_Expr *expr, Ast_Type *decl_type){
|
|||||||
}
|
}
|
||||||
else if(expr->kind == AST_IDENT && is_slice(decl_type)){
|
else if(expr->kind == AST_IDENT && is_slice(decl_type)){
|
||||||
Ast_Atom *atom = (Ast_Atom *)expr;
|
Ast_Atom *atom = (Ast_Atom *)expr;
|
||||||
|
gen("(");
|
||||||
|
gen_simple_decl(decl_type);
|
||||||
|
gen(")");
|
||||||
gen("{%d, ", atom->resolved_type->arr.size);
|
gen("{%d, ", atom->resolved_type->arr.size);
|
||||||
gen_expr(expr);
|
gen_expr(expr);
|
||||||
gen("}");
|
gen("}");
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
|
|
||||||
|
//apifn
|
||||||
|
static void core_free_compiler() {
|
||||||
|
deallocate(pctx->heap, pctx->type_map.data);
|
||||||
|
deallocate(pctx->heap, pctx->interns.map.data);
|
||||||
|
arena_release(pctx->stage_arena);
|
||||||
|
arena_release(pctx->scratch);
|
||||||
|
arena_release(pctx->perm);
|
||||||
|
}
|
||||||
|
|
||||||
//apifn
|
//apifn
|
||||||
static void core_init_compiler(Core_Ctx *ctx, Allocator *allocator) {
|
static void core_init_compiler(Core_Ctx *ctx, Allocator *allocator) {
|
||||||
ctx->time.init_context = os_time();
|
ctx->time.init_context = os_time();
|
||||||
@@ -160,7 +169,8 @@ pctx->op_info_table[19] = {pctx->intern("!"_s), "NOT"_s, TK_Not, 0, 1};
|
|||||||
}
|
}
|
||||||
|
|
||||||
//apifn
|
//apifn
|
||||||
static void core_bootstrap_compiler(Allocator *allocator) {
|
CORE_Static void
|
||||||
|
core_bootstrap_compiler(Allocator *allocator) {
|
||||||
Core_Ctx *ctx = allocate_struct(allocator, Core_Ctx);
|
Core_Ctx *ctx = allocate_struct(allocator, Core_Ctx);
|
||||||
core_init_compiler(ctx, allocator);
|
core_init_compiler(ctx, allocator);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user