summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-08-13 10:10:17 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-08-13 10:10:17 +0900
commit9c3d305530e6132d0e5292eef6dd939295135650 (patch)
treee4125695a51fd27705e9119bcfa9da04d4262f24 /mrbgems/mruby-compiler/core/codegen.c
parentcbdc4f2c5c290173b17fd7b4cf23244f1acc39e1 (diff)
downloadmruby-9c3d305530e6132d0e5292eef6dd939295135650.tar.gz
mruby-9c3d305530e6132d0e5292eef6dd939295135650.zip
codegen.c: refactor `mrb_last_insn()`.
Last commit made `mrb_decode_insn()` to take `NULL` as `pc`.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 1bac4e061..34b91b0cf 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -470,14 +470,7 @@ rewind_pc(codegen_scope *s)
static struct mrb_insn_data
mrb_last_insn(codegen_scope *s)
{
- const mrb_code *pc = mrb_prev_pc(s, pc_addr(s));
- if (pc == NULL) {
- struct mrb_insn_data data;
-
- data.insn = OP_NOP;
- return data;
- }
- return mrb_decode_insn(pc);
+ return mrb_decode_insn(mrb_prev_pc(s, pc_addr(s)));
}
static mrb_bool