mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
fixed scoping in For loop
This commit is contained in:
parent
94ccf91689
commit
fdf392b53f
1 changed files with 1 additions and 0 deletions
|
|
@ -125,6 +125,7 @@ let rec interpret_stmt (env : environment) (stmt_node : stmt_node) : (unit, runt
|
|||
| Error e -> Error e
|
||||
else Ok ()
|
||||
| For { init; cond; update; body } ->
|
||||
let env = Env.enter env in
|
||||
let* _ = init |> Option.map (interpret_stmt env) |> Option.value ~default:(Ok ()) in
|
||||
let eval_cond () =
|
||||
cond
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue