codegen.c (mrb_last_insn): no previous instruction on top.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-09-20 10:35:01 +09:00
parent 938af8a8ff
commit f85c50543b
+4
View File
@@ -467,6 +467,10 @@ mrb_prev_pc(codegen_scope *s, const mrb_code *pc)
static struct mrb_insn_data
mrb_last_insn(codegen_scope *s)
{
if (s->pc == 0) {
struct mrb_insn_data data = { OP_NOP, 0 };
return data;
}
return mrb_decode_insn(&s->iseq[s->lastpc]);
}