mruby-compiler: improve hash dump to display double-splat operator

Enhanced NODE_HASH dump to detect and display the double-splat operator
(**) in a readable format. When a hash contains **other_hash syntax,
the parser represents ** as MRB_OPSYM(pow). Instead of dumping this
complex operator node, now displays a clean "**" for better readability.

This makes hash dumps with splat operations much easier to understand
and debug.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-09-30 13:55:04 +09:00
parent 29e70c10ba
commit 4cb9e9f553
2 changed files with 14 additions and 2 deletions
+7 -1
View File
@@ -8206,7 +8206,13 @@ dump_node(mrb_state *mrb, node *tree, int offset)
while (pairs) {
dump_prefix(offset+1, lineno);
printf("key:\n");
dump_node(mrb, pairs->car->car, offset+2);
if (node_to_sym(pairs->car->car) == MRB_OPSYM(pow)) {
dump_prefix(offset+2, lineno);
printf("**\n");
}
else {
dump_node(mrb, pairs->car->car, offset+2);
}
dump_prefix(offset+1, lineno);
printf("value:\n");
dump_node(mrb, pairs->car->cdr, offset+2);
+7 -1
View File
@@ -15035,7 +15035,13 @@ dump_node(mrb_state *mrb, node *tree, int offset)
while (pairs) {
dump_prefix(offset+1, lineno);
printf("key:\n");
dump_node(mrb, pairs->car->car, offset+2);
if (node_to_sym(pairs->car->car) == MRB_OPSYM(pow)) {
dump_prefix(offset+2, lineno);
printf("**:\n");
}
else {
dump_node(mrb, pairs->car->car, offset+2);
}
dump_prefix(offset+1, lineno);
printf("value:\n");
dump_node(mrb, pairs->car->cdr, offset+2);