Skip to content

Commit

Permalink
fix: add recursive function definition as first parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
eWert-Online committed Aug 9, 2024
1 parent 0be5547 commit 5a845b0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/pinc_backend/Interpreter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,7 @@ and eval_function_declaration ~state ~loc ~parameters body =
let ident = state.binding_identifier in
let self = ref { value_desc = Null; value_loc = loc } in
let exec ~arguments ~state () =
let state =
state
|> State.add_scope
|> StringMap.fold
(fun ident value ->
State.add_value_to_scope ~ident ~value ~is_mutable:false ~is_optional:false)
arguments
in
let state = state |> State.add_scope in
let state =
match ident with
| None -> state
Expand All @@ -325,6 +318,13 @@ and eval_function_declaration ~state ~loc ~parameters body =
~is_mutable:false
~is_optional:false
in
let state =
state
|> StringMap.fold
(fun ident value ->
State.add_value_to_scope ~ident ~value ~is_mutable:false ~is_optional:false)
arguments
in
let state = eval_expression ~state body in
let state = state |> State.remove_scope in
state |> State.get_output
Expand Down

0 comments on commit 5a845b0

Please sign in to comment.