summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-09-01 17:14:54 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-09-01 17:14:54 +0900
commit20c0c6330f38c6a1a969a06bc5a3bf56d39f466f (patch)
treef790022ab760b4bda9852b2a884c665d867cbaf4
parentb80e0ef7428b613a682da4d2a251c8beb24d6dd2 (diff)
downloadmruby-20c0c6330f38c6a1a969a06bc5a3bf56d39f466f.tar.gz
mruby-20c0c6330f38c6a1a969a06bc5a3bf56d39f466f.zip
Too much peephole optimization in `gen_call`; fix #4091
It causes trouble for safe navigation operator.
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 835cee817..efd20d908 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -979,7 +979,7 @@ gen_call(codegen_scope *s, node *tree, mrb_sym name, int sp, int val, int safe)
codegen(s, tree->car, VAL); /* receiver */
if (safe) {
int recv = cursp()-1;
- gen_move(s, cursp(), recv, 0);
+ gen_move(s, cursp(), recv, 1);
skip = genjmp2(s, OP_JMPNIL, cursp(), 0, val);
}
idx = new_sym(s, sym);