stage1 禁止隐式调用 修复bug

This commit is contained in:
zzy
2026-07-12 11:43:27 +08:00
parent 118c153280
commit 9b9b25ce0f
5 changed files with 23 additions and 17 deletions

View File

@@ -922,7 +922,10 @@ static spl_expr_result_t parse_postfix_expr(spl_comp_t *ctx, spl_expr_result_t l
spl_comp_error(ctx, "cannot call instance method '%s' on type",
fname);
}
nargs = 1;
/* Drop implicit self from left operand — user passes
* self explicitly as first argument */
spl_emit(ctx, SPL_DROP, SPL_VOID, 0);
nargs = 0;
}
nargs += parse_call_args(ctx);
@@ -1246,9 +1249,8 @@ void spl_emit_ret(spl_comp_t *ctx, spl_type_info_t *ret_type) {
if (ret_type) {
if (ret_type->kind == TYPE_BASIC) {
rt = ret_type->basic_type;
} else if (ret_type->kind == TYPE_PTR) {
rt = SPL_PTR;
} else if (spl_type_size(ret_type) <= sizeof(spl_val_t)) {
} else {
/* Pointer, struct, enum, etc: return address of value */
rt = SPL_PTR;
}
}