Make setq bind locally
This commit is contained in:
@@ -152,14 +152,14 @@ struct ucl_object *ucl_special_while(struct ucl_scope *scope, struct ucl_object
|
||||
struct ucl_object *ucl_special_setq(struct ucl_scope *scope, struct ucl_object *args) {
|
||||
// TODO: Check arguments
|
||||
struct ucl_object *sym = ucl_car(args);
|
||||
struct ucl_scope *root_scope = ucl_scope_get_root(scope);
|
||||
if (sym->type != UCL_TYPE_SYMBOL) {
|
||||
return ucl_error_create("First argument to setq must be a symbol");
|
||||
}
|
||||
|
||||
struct ucl_object *value = ucl_evaluate(scope, ucl_list_nth(args, 1));
|
||||
UCL_RET_IF_ERROR(value);
|
||||
|
||||
ucl_scope_put(root_scope, sym->symbol, value);
|
||||
ucl_scope_put(scope, sym->symbol, value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user