allow string interpolation in symbols like :"a=#{15}"

This commit is contained in:
Yukihiro Matsumoto
2012-06-28 23:35:17 +09:00
parent 4fd932548e
commit 4a98d5c8fd
2 changed files with 16 additions and 7 deletions
+9
View File
@@ -1711,6 +1711,15 @@ codegen(codegen_scope *s, node *tree, int val)
}
break;
case NODE_DSYM:
codegen(s, tree, val);
if (val) {
pop();
genop(s, MKOP_ABC(OP_SEND, cursp(), new_msym(s, mrb_intern(s->mrb, "intern")), 0));
push();
}
break;
case NODE_SELF:
if (val) {
genop(s, MKOP_A(OP_LOADSELF, cursp()));
+7 -7
View File
@@ -527,13 +527,6 @@ new_strsym(parser_state *p, node* str)
return mrb_intern2(p->mrb, s, len);
}
// (:sym . a)
static node*
new_dsym(parser_state *p, node *a)
{
return cons((node*)NODE_DSYM, a);
}
// (:lvar . a)
static node*
new_lvar(parser_state *p, mrb_sym sym)
@@ -705,6 +698,13 @@ new_dstr(parser_state *p, node *a)
return cons((node*)NODE_DSTR, a);
}
// (:dsym . a)
static node*
new_dsym(parser_state *p, node *a)
{
return cons((node*)NODE_DSYM, new_dstr(p, a));
}
// (:backref . n)
static node*
new_back_ref(parser_state *p, int n)