mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user