mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
allow string interpolation in symbols like :"a=#{15}"
This commit is contained in:
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user