mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-compiler: convert dynamic symbols to always use variable-sized nodes
Remove var_nodes_enabled condition from new_dsym function, completing the transition to variable-sized nodes for dynamic symbol processing. Fix gen_dsym_var function to properly extract the dsym node using the dsym_node() macro and simplify the codegen pattern to match traditional codegen_dsym behavior. Remove unused codegen_dsym function and its corresponding NODE_DSYM case from the main codegen switch, cleaning up dead traditional codegen paths. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3998,13 +3998,6 @@ codegen_sym(codegen_scope *s, mrb_sym sym, int val)
|
||||
gen_load_op2(s, OP_LOADSYM, i, val);
|
||||
}
|
||||
|
||||
static void
|
||||
codegen_dsym(codegen_scope *s, node *tree, int val)
|
||||
{
|
||||
codegen(s, tree, val);
|
||||
if (!val) return;
|
||||
gen_intern(s);
|
||||
}
|
||||
|
||||
static void
|
||||
codegen_array(codegen_scope *s, node *tree, int val)
|
||||
@@ -5801,11 +5794,11 @@ gen_heredoc_var(codegen_scope *s, node *varnode, int val)
|
||||
static void
|
||||
gen_dsym_var(codegen_scope *s, node *varnode, int val)
|
||||
{
|
||||
struct mrb_ast_dsym_node *n = (struct mrb_ast_dsym_node*)varnode;
|
||||
// Generate str first, then convert to symbol
|
||||
struct mrb_ast_dsym_node *n = dsym_node(varnode);
|
||||
// Generate the list content, then intern to symbol
|
||||
codegen(s, n->list, val);
|
||||
if (val) {
|
||||
codegen_heredoc_str(s, n->list, VAL);
|
||||
genop_1(s, OP_INTERN, cursp());
|
||||
gen_intern(s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6680,9 +6673,6 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
codegen_sym(s, node_to_sym(tree), val);
|
||||
break;
|
||||
|
||||
case NODE_DSYM:
|
||||
codegen_dsym(s, tree, val);
|
||||
break;
|
||||
|
||||
case NODE_SELF:
|
||||
codegen_self(s, tree, val);
|
||||
|
||||
@@ -2196,10 +2196,6 @@ new_xstr(parser_state *p, node *a)
|
||||
static node*
|
||||
new_dsym(parser_state *p, node *a)
|
||||
{
|
||||
if (!p->var_nodes_enabled) {
|
||||
return cons_head((node*)NODE_DSYM, a);
|
||||
}
|
||||
|
||||
size_t total_size = sizeof(struct mrb_ast_dsym_node);
|
||||
enum mrb_ast_size_class class = size_to_class(total_size);
|
||||
struct mrb_ast_dsym_node *n = (struct mrb_ast_dsym_node*)parser_alloc_var(p, total_size, class);
|
||||
|
||||
+1080
-1084
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user