mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 04:12:42 +00:00
added stack overflow error
This commit is contained in:
parent
3066ba9032
commit
6386df22c0
3 changed files with 10 additions and 8 deletions
|
|
@ -206,7 +206,7 @@ impl Eval for Expr {
|
|||
let mut methods: FxHashMap<String, Value> = FxHashMap::default();
|
||||
|
||||
// this is the scope "this" will get injected in
|
||||
env.enter_scope();
|
||||
env.enter_scope()?;
|
||||
|
||||
for method_expr in method_exprs.iter() {
|
||||
let method = method_expr.eval(env)?;
|
||||
|
|
@ -280,7 +280,7 @@ impl Eval for Stmt {
|
|||
env.define(name.clone(), initializer);
|
||||
}
|
||||
Stmt::Block { statements } => {
|
||||
env.enter_scope();
|
||||
env.enter_scope()?;
|
||||
for statement in statements {
|
||||
if let Err(err) = statement.eval(env) {
|
||||
env.exit_scope();
|
||||
|
|
@ -318,7 +318,7 @@ pub fn call_fun(fun: Rc<LoxFunction>, env: &mut Environment) -> EvalResult<Value
|
|||
});
|
||||
}
|
||||
|
||||
env.enter_scope();
|
||||
env.enter_scope()?;
|
||||
|
||||
env.define(fun.name(), Value::Function(fun.clone()));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue