ANN static m_bool emit_stmt(const Emitter emit, const Stmt stmt);
-ANN static m_bool emit_defers(const Emitter emit) {
+ANN static m_bool _emit_defers(const Emitter emit) {
if (!vector_size(&emit->code->frame->defer)) return GW_OK;
Stmt stmt;
while ((stmt = (Stmt)vector_pop(&emit->code->frame->defer)))
return GW_OK;
}
-ANN static m_bool emit_defers2(const Emitter emit) {
+ANN static m_bool emit_defers(const Emitter emit) {
+ emit->status.in_defer = true;
+ const m_bool ret = _emit_defers(emit);
+ emit->status.in_defer = false;
+ return ret;
+}
+
+ANN static m_bool _emit_defers2(const Emitter emit) {
for (m_uint i = vector_size(&emit->code->frame->defer) + 1; --i;) {
const Stmt stmt = (Stmt)vector_at(&emit->code->frame->defer, i - 1);
if (!stmt) break;
return GW_OK;
}
+ANN static m_bool emit_defers2(const Emitter emit) {
+ emit->status.in_defer = true;
+ const m_bool ret = _emit_defers2(emit);
+ emit->status.in_defer = false;
+ return ret;
+}
+
ANN static m_int _frame_pop(const Emitter emit) {
Frame *frame = emit->code->frame;
DECL_OB(const Local *, l, = (Local *)vector_pop(&frame->stack));
}
ANN static m_bool emit_stmt_return(const Emitter emit, const Stmt_Exp stmt) {
- CHECK_BB(emit_defers2(emit));
+ if(!emit->status.in_defer)
+ CHECK_BB(emit_defers2(emit));
if (stmt->val) {
if (stmt->val->exp_type == ae_exp_call) {
const Func f = stmt->val->d.exp_call.func->type->info->func;