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

parent 938af8a8
...@@ -467,6 +467,10 @@ mrb_prev_pc(codegen_scope *s, const mrb_code *pc) ...@@ -467,6 +467,10 @@ mrb_prev_pc(codegen_scope *s, const mrb_code *pc)
static struct mrb_insn_data static struct mrb_insn_data
mrb_last_insn(codegen_scope *s) 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]); return mrb_decode_insn(&s->iseq[s->lastpc]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment