Permalink
Browse files

Fixed a bug in NODE_XSTR code generation; fix #3605

  • Loading branch information...
matz committed Apr 12, 2017
1 parent 4e84bdb commit 3123549bcb3a7d76e2f890760fe4b36f50d415b5
Showing with 9 additions and 14 deletions.
  1. +9 −14 mrbgems/mruby-compiler/core/codegen.c
@@ -2377,9 +2377,7 @@ codegen(codegen_scope *s, node *tree, int val)
int ai = mrb_gc_arena_save(s->mrb);
int sym = new_sym(s, mrb_intern_lit(s->mrb, "Kernel"));
if (val == NOVAL) { push(); }
genop(s, MKOP_A(OP_OCLASS, cursp()));
genop(s, MKOP_ABx(OP_GETMCNST, cursp(), sym));
genop(s, MKOP_A(OP_LOADSELF, cursp()));
push();
codegen(s, tree->car, VAL);
n = tree->cdr;
@@ -2394,12 +2392,11 @@ codegen(codegen_scope *s, node *tree, int val)
push();
n = n->cdr;
}
pop();
pop();
push(); /* for block */
pop_n(3);
sym = new_sym(s, mrb_intern_lit(s->mrb, "`"));
genop(s, MKOP_ABC(OP_SEND, cursp(), sym, 1));
if (val == NOVAL) { pop(); }
else { push(); }
if (val) push();
mrb_gc_arena_restore(s->mrb, ai);
}
break;
@@ -2409,19 +2406,17 @@ codegen(codegen_scope *s, node *tree, int val)
char *p = (char*)tree->car;
size_t len = (intptr_t)tree->cdr;
int ai = mrb_gc_arena_save(s->mrb);
int sym = new_sym(s, mrb_intern_lit(s->mrb, "Kernel"));
int off = new_lit(s, mrb_str_new(s->mrb, p, len));
int sym;
if (val == NOVAL) { push(); }
genop(s, MKOP_A(OP_OCLASS, cursp()));
genop(s, MKOP_ABx(OP_GETMCNST, cursp(), sym));
genop(s, MKOP_A(OP_LOADSELF, cursp()));
push();
genop(s, MKOP_ABx(OP_STRING, cursp(), off));
pop();
push(); push();
pop_n(3);
sym = new_sym(s, mrb_intern_lit(s->mrb, "`"));
genop(s, MKOP_ABC(OP_SEND, cursp(), sym, 1));
if (val == NOVAL) { pop(); }
else { push(); }
if (val) push();
mrb_gc_arena_restore(s->mrb, ai);
}
break;

0 comments on commit 3123549

Please sign in to comment.