From 94ccf91689beaa5af31ad80e315fd44830fa059a Mon Sep 17 00:00:00 2001 From: Moritz Gmeiner Date: Tue, 27 Aug 2024 18:25:12 +0200 Subject: [PATCH] fixed bug wih with_is_in_loop --- lib/parser.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/parser.ml b/lib/parser.ml index 7f459ef..d60605d 100644 --- a/lib/parser.ml +++ b/lib/parser.ml @@ -11,8 +11,10 @@ type stmt_result = (stmt_node, parser_error) result type expr_result = (expr_node, parser_error) result let with_is_in_loop (f : state -> 'a) (state : state) : 'a = - let state = { state with is_in_loop = true } in - f state + let new_state = { state with is_in_loop = true } in + let result = f new_state in + state.tokens <- new_state.tokens; + result let make_state tokens = { tokens; is_in_loop = false }