core: foreach-object: update variable definition api usage

This commit is contained in:
2026-06-20 15:17:15 +01:00
parent ad8b284869
commit 9e6c3bb431
+4 -1
View File
@@ -2,6 +2,7 @@
#include <bshell/command/command.h> #include <bshell/command/command.h>
#include <bshell/runtime/pipeline.h> #include <bshell/runtime/pipeline.h>
#include <bshell/runtime/runtime.h> #include <bshell/runtime/runtime.h>
#include <bshell/runtime/scope.h>
#include <bshell/runtime/script-block.h> #include <bshell/runtime/script-block.h>
#include <bshell/status.h> #include <bshell/status.h>
#include <fx/reflection/function.h> #include <fx/reflection/function.h>
@@ -51,7 +52,9 @@ static enum bshell_status process_record(
} }
bshell_runtime_push_scope(rt, p->f_block); bshell_runtime_push_scope(rt, p->f_block);
bshell_variable *item = bshell_runtime_define_var(rt, "_"); bshell_variable *item = bshell_runtime_scope_define_variable(
bshell_runtime_get_current_scope(rt),
"_");
bshell_variable_set_value(item, in); bshell_variable_set_value(item, in);
fx_value out = bshell_runtime_eval(rt); fx_value out = bshell_runtime_eval(rt);
bshell_runtime_pop_scope(rt); bshell_runtime_pop_scope(rt);