diff options
author | Alexis Lockwood | 2021-06-29 21:46:27 -0400 |
---|---|---|
committer | Alexis Lockwood | 2021-06-29 21:46:27 -0400 |
commit | fda7d5db7b2589b0c789579b40d5bcf685f8702e (patch) | |
tree | db18fb16436fd76beabfe3210d16d85d9ac45403 | |
parent | edda5252614fe8e3b9cc531f420be938a7afa7de (diff) |
shit i broke GOSUB
-rw-r--r-- | src/ls_kw_impl_GOSUB_RETURN.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ls_kw_impl_GOSUB_RETURN.c b/src/ls_kw_impl_GOSUB_RETURN.c index b8bb4bb..d8de560 100644 --- a/src/ls_kw_impl_GOSUB_RETURN.c +++ b/src/ls_kw_impl_GOSUB_RETURN.c @@ -66,9 +66,14 @@ void ls_kw_fun_GOSUB(ls_t * self) if (tok != LS_OP_EQ) ls_throw_err(self, LS_SYNTAX_ERROR); + // Evaluate the expression in the prev scope + // We had to create the variable already to + // avoid losing the buffer content + self->_callstack = self->_callstack->prev; ls_value_t val; ls_eval_expr(self, &val, LS_TOK_NONE); ls_write_var(self, var, &val); + self->_callstack = frame; } else if (tok == LS_TOK_COMMA) continue; |