mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
no SEGV for nth_ref & back_ref; close #152
This commit is contained in:
+18
-2
@@ -1477,11 +1477,27 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
break;
|
||||
|
||||
case NODE_BACK_REF:
|
||||
codegen(s, tree, VAL);
|
||||
{
|
||||
char buf[4];
|
||||
int sym;
|
||||
|
||||
snprintf(buf, 3, "$%c", (intptr_t)tree);
|
||||
sym = new_sym(s, mrb_intern(s->mrb, buf));
|
||||
genop(s, MKOP_ABx(OP_GETGLOBAL, cursp(), sym));
|
||||
push();
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_NTH_REF:
|
||||
codegen(s, tree, VAL);
|
||||
{
|
||||
char buf[4];
|
||||
int sym;
|
||||
|
||||
snprintf(buf, 3, "$%d", (intptr_t)tree);
|
||||
sym = new_sym(s, mrb_intern(s->mrb, buf));
|
||||
genop(s, MKOP_ABx(OP_GETGLOBAL, cursp(), sym));
|
||||
push();
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_ARG:
|
||||
|
||||
Reference in New Issue
Block a user