summaryrefslogtreecommitdiffhomepage
path: root/src/codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen.c')
-rw-r--r--src/codegen.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/codegen.c b/src/codegen.c
index a943c607a..ae5eafdf7 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -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: