Merge commit '98d71b26fa0926b5493e27ae36ab75444a197ba4'

This commit is contained in:
Benjamin Vedder 2022-02-15 21:01:47 +01:00
commit 6361362c70
2 changed files with 11 additions and 11 deletions

View File

@ -889,26 +889,27 @@ static inline void eval_define(eval_context_t *ctx) {
lbm_value key = lbm_car(lbm_cdr(ctx->curr_exp));
lbm_value val_exp = lbm_car(lbm_cdr(lbm_cdr(ctx->curr_exp)));
if (lbm_type_of(key) != LBM_VAL_TYPE_SYMBOL ||
key == NIL) {
error_ctx(lbm_enc_sym(SYM_EERROR));
return;
}
if ((lbm_type_of(key) == LBM_VAL_TYPE_SYMBOL) &&
(lbm_dec_sym(key) >= RUNTIME_SYMBOLS_START)) {
CHECK_STACK(lbm_push_u32_2(&ctx->K, key, lbm_enc_u(SET_GLOBAL_ENV)));
ctx->curr_exp = val_exp;
CHECK_STACK(lbm_push_u32_2(&ctx->K, key, lbm_enc_u(SET_GLOBAL_ENV)));
ctx->curr_exp = val_exp;
} else {
error_ctx(lbm_enc_sym(SYM_EERROR));
}
return;
}
static inline void eval_progn(eval_context_t *ctx) {
lbm_value exps = lbm_cdr(ctx->curr_exp);
lbm_value env = ctx->curr_env;
if (lbm_type_of(exps) == LBM_VAL_TYPE_SYMBOL && exps == NIL) {
ctx->r = NIL;
ctx->app_cont = true;
return;
}
}
if (lbm_is_error(exps)) {
error_ctx(exps);
@ -920,7 +921,7 @@ static inline void eval_progn(eval_context_t *ctx) {
}
static inline void eval_lambda(eval_context_t *ctx) {
lbm_value env_cpy = lbm_env_copy_shallow(ctx->curr_env);
if (lbm_is_symbol_merror(env_cpy)) {

View File

@ -585,7 +585,6 @@ lbm_value lbm_get_next_token(lbm_tokenizer_char_stream_t *str) {
int r = 0;
if (sym_str[0] == '#') {
r = lbm_add_variable_symbol(sym_str, &symbol_id);
printf("added variable: %s as %d\n", sym_str, symbol_id - VARIABLE_SYMBOLS_START);
} else {
r = lbm_add_symbol(sym_str, &symbol_id);
}