runtime: move variable definition from runtime to individual scopes
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user