mruby-compiler: simplify false_always to handle only variable-sized nodes

Remove obsolete cons-list node cases and simplify structure to direct
conditional since only NODE_VARIABLE wrapper needs to be handled after
variable-sized node migration.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-09-04 12:09:05 +09:00
parent 4931570f0c
commit c6af438500
+19 -7
View File
@@ -3378,10 +3378,18 @@ static mrb_bool
true_always(node *tree)
{
switch (node_to_int(tree->car)) {
case NODE_TRUE:
case NODE_INT:
case NODE_SYM:
return TRUE;
case NODE_VARIABLE:
/* Check variable-sized nodes that are always true */
switch (VAR_NODE_TYPE(tree->cdr)) {
case NODE_FLOAT:
case NODE_TRUE:
return TRUE;
default:
return FALSE;
}
default:
return FALSE;
}
@@ -3390,13 +3398,17 @@ true_always(node *tree)
static mrb_bool
false_always(node *tree)
{
switch (node_to_int(tree->car)) {
case NODE_FALSE:
case NODE_NIL:
return TRUE;
default:
return FALSE;
if (node_to_int(tree->car) == NODE_VARIABLE) {
/* Check variable-sized nodes that are always false */
switch (VAR_NODE_TYPE(tree->cdr)) {
case NODE_FALSE:
case NODE_NIL:
return TRUE;
default:
return FALSE;
}
}
return FALSE;
}
static void