runtime: move variable definition from runtime to individual scopes

This commit is contained in:
2026-06-20 15:09:10 +01:00
parent c2d3e05430
commit c262b53eab
7 changed files with 42 additions and 28 deletions
+6 -18
View File
@@ -68,24 +68,6 @@ bshell_variable *bshell_runtime_find_var(
return var;
}
bshell_variable *bshell_runtime_define_var(
struct bshell_runtime *rt,
const char *name)
{
struct bshell_runtime_scope *scope = runtime_get_scope(rt);
if (!scope) {
return NULL;
}
bshell_variable *var = bshell_variable_create(name);
if (!var) {
return NULL;
}
var_map_put(&scope->s_vars, var);
return var;
}
enum bshell_status bshell_runtime_define_function(
struct bshell_runtime *rt,
bshell_function *func)
@@ -149,6 +131,12 @@ bshell_command *bshell_runtime_find_command(
return NULL;
}
struct bshell_runtime_scope *bshell_runtime_get_global_scope(
struct bshell_runtime *rt)
{
return rt->rt_global;
}
struct bshell_runtime_scope *bshell_runtime_get_current_scope(
struct bshell_runtime *rt)
{