Skip to content

Commit

Permalink
Remove caching of expr types
Browse files Browse the repository at this point in the history
presenthee committed Jan 24, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent a2c56c7 commit 7c32c92
Showing 2 changed files with 63 additions and 67 deletions.
14 changes: 5 additions & 9 deletions spectec/src/backend-prose/render.ml
Original file line number Diff line number Diff line change
@@ -684,15 +684,11 @@ let typs = ref Map.empty
let init_typs () = typs := Map.empty
let render_expr_with_type env e =
let s = render_expr env e in
match (Map.find_opt s !typs) with
| Some t -> if t <> "" then "the " ^ t ^ " " ^ s else s
| None ->
let t = Prose_util.extract_desc e.note in
typs := Map.add s t !typs;
if t = "" then
render_expr env e
else
"the " ^ t ^ " " ^ s
let t = Prose_util.extract_desc e.note in
if t = "" then
render_expr env e
else
"the " ^ t ^ " " ^ s


(* Validation Statements *)
Loading

0 comments on commit 7c32c92

Please sign in to comment.