Skip to content

Commit 4ee0e22

Browse files
committed
fix: module flattening, Bun-ESM match lowering and loader follow-ups to #788
Review follow-ups to #788, which merged before they were pushed. Module loader and flattening: - Private helpers carried into a flattened program are renamed `__priv_<Module>__<name>` by a capture-avoiding substitution (`Ast.rename_free`), so two modules with a same-named private helper (kyq's two `parse_int`s) no longer collide. A remaining collision is a loud error, not a silent pick. - Nested candidates are searched in every directory before any parent-module fallback; a failed load clears its loading marker, so a later import is not reported as a cycle. - An aliased import emits the original binding before the alias, in declaration order; free-variable analysis covers record shorthand and spread. - Only the root program's `main` is run by `eval`; the module root is normalised and the source directory is searched. Bun-ESM backend: - Match is lowered as a labelled block, so guards see the arm's bindings and a `return` in an arm leaves the function. - `let _ = e` still evaluates `e`; temporaries are fresh per lowering. - A `return` in an `if` condition, a scrutinee or a guard is refused loudly instead of being miscompiled. Interpreter: the untypeable Char-ordering arms are removed. Docs: the module-loader holes are renumbered H20-H22 -> H23-H25 in docs/COMPLETION-PLAN.adoc, because #787 assigned H20-H22 to the proof-review holes; H2, H23 and H24 record the round-2 fixes. Tests: test/test_module_root_flatten.ml (22 cases). Disabling qualification, the two-phase search, alias ordering, wildcard lowering or the marker clear each makes a test fail. Full suite: no failures beyond the 33 pre-existing walker-* tests (they need the tree-sitter CLI; same count on main). kyq parser and lint drivers: 20/20 under Bun. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P4yFkxW5Heb8p2YW7ZYs9F
1 parent aea7de8 commit 4ee0e22

7 files changed

Lines changed: 609 additions & 59 deletions

File tree

‎bin/main.ml‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -173,25 +173,23 @@ let parse_file (face : Affinescript.Face.face) path =
173173
Affinescript.Span.pp_short span msg;
174174
`Error (false, "Parse error")
175175

176-
(** Build a loader rooted at the source file's directory. The historical
177-
CLI used the process CWD as [current_dir], so compiling `src/Main.affine`
178-
could not find a sibling `src/Helper.affine` even though the module
179-
loader already supported relative sibling paths (#642). *)
176+
(** Build the loader for a source file: rooted at its package root when its
177+
`module` declaration matches its directories, with its own directory
178+
still searchable (#642). See [Module_loader.config_for_file]. *)
180179
let loader_config_for_file ?prog path =
181-
let absolute_path =
182-
if Filename.is_relative path then Filename.concat (Sys.getcwd ()) path
183-
else path
184-
in
185-
let config = Affinescript.Module_loader.default_config () in
186180
let mod_path =
187181
Option.bind prog (fun (p : Affinescript.Ast.program) ->
188182
Option.map (List.map (fun (id : Affinescript.Ast.ident) -> id.name))
189183
p.prog_module)
190184
in
191-
{ config with
192-
current_dir =
193-
Affinescript.Module_loader.module_root_dir
194-
~file_dir:(Filename.dirname absolute_path) mod_path }
185+
Affinescript.Module_loader.config_for_file ~file_path:path mod_path
186+
187+
(* Auto-call `main` only when the root program declares it
188+
(Module_loader.declares_main). *)
189+
let lookup_root_main (prog : Affinescript.Ast.program) env =
190+
if Affinescript.Module_loader.declares_main prog
191+
then Affinescript.Value.lookup_env "main" env
192+
else Error (Affinescript.Value.UnboundVariable "main")
195193

196194
(** Type-check a file. With [--json], emits a structured diagnostic
197195
report on stderr. *)
@@ -328,7 +326,7 @@ let eval_file face json path =
328326
(Affinescript.Module_loader.flatten_imports loader prog) with
329327
| Ok env ->
330328
(* Auto-call main() if defined — entry point for TEA apps and scripts *)
331-
(match Affinescript.Value.lookup_env "main" env with
329+
(match lookup_root_main prog env with
332330
| Ok main_fn ->
333331
(match Affinescript.Interp.apply_function main_fn [] with
334332
| Ok _ -> ()
@@ -378,7 +376,7 @@ let eval_file face json path =
378376
(Affinescript.Module_loader.flatten_imports loader prog) with
379377
| Ok env ->
380378
(* Auto-call main() if defined — entry point for TEA apps and scripts *)
381-
(match Affinescript.Value.lookup_env "main" env with
379+
(match lookup_root_main prog env with
382380
| Ok main_fn ->
383381
(match Affinescript.Interp.apply_function main_fn [] with
384382
| Ok _ -> `Ok ()

‎docs/COMPLETION-PLAN.adoc‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Results were consistent, but they do not prove CI is green.
202202
All were observed by RUN unless marked otherwise. The maps confirm that H1–H4 and H9 are absent from `docs/SOUNDNESS.adoc`. H5–H8, H10, H12 and H13 were not checked against the ledger. H11 already has a drafted issue (`issues-drafts/06`, referenced from the AFFIRMATION). H14, H15 and H19 belong to typed-wasm, not the AffineScript ledger.
203203

204204
. H1. Interpreter early `return` has no non-local exit (`lib/interp.ml:262`).
205-
. H2. Bun-ESM `return` in expression position is lowered as an IIFE (`lib/codegen_deno.ml:1575`). *Narrowed 2026-11-09:* `let` initializers and function and lambda tails are now lowered to statements, so the `return` leaves the function; a match used as an argument or operand with a `return` in an arm is refused loudly. Anchor: `test/test_module_root_flatten.ml`.
205+
. H2. Bun-ESM `return` in expression position is lowered as an IIFE (`lib/codegen_deno.ml:1575`). *Narrowed 2026-11-09:* `let` initializers and function and lambda tails are now lowered to statements, so the `return` leaves the function; a match used as an argument or operand with a `return` in an arm is refused loudly. *Round 2 (2026-11-16):* match arms and guards are lowered as a labelled block, so a guard sees the arm's bindings and a `return` in an arm leaves the function; `let _ = e` still evaluates `e`; a `return` in an `if` condition, a scrutinee or a guard is refused loudly. Anchor: `test/test_module_root_flatten.ml`.
206206
. H3. The JS-text backend drops block returns (`lib/js_codegen.ml`). The Lua backend emits invalid code.
207207
. H4. Non-exhaustive match compiles to "return 0" on core WASM.
208208
. H5. Effect rows are not checked against performed operations or callee rows.
@@ -220,9 +220,9 @@ All were observed by RUN unless marked otherwise. The maps confirm that H1–H4
220220
. H17. The lexer accepts the bad escape `\q`, and an empty `match` parses (conformance invalid cases 010 and 011).
221221
. H18. The interpreter fails when dereferencing refs returned through calls ("Expected reference type"). The session lead reproduced this on two #554 fixtures.
222222
. H19 (typed-wasm). No L5 index guard: `get_player_hp(0,150)` reads an adjacent region. `where` constraints are discarded. Malformed `session` blocks are silently ignored.
223-
. H20 (found and fixed 2026-11-09, checking and running metadatastician/kyq). A module file found for `A.B` that declares `module A;` was accepted as `A.B`, so `use A.Nonexistent::*` type-checked and imported `A`'s exports; it is now a `ModuleDeclMismatch` load error. Anchor: `test/test_module_root_flatten.ml`.
224-
. H21 (found and fixed 2026-11-09). `eval` ran the unflattened program, so no imported function was bound at run time; flattening also emitted a selected function before the private helpers it calls and carried no helpers for glob or plain imports. `eval` now flattens, every import kind carries its helpers, and they are emitted in the imported module's declaration order. Anchor: `test/test_module_root_flatten.ml`.
225-
. H22 (found and fixed 2026-11-09). The interpreter had no `++` on arrays and no `==`/`!=` beyond Int, Float, String and Bool, though the checker accepts them; it now uses the structural `Value.value_eq`. H7 (`let mut`) is unchanged. Anchor: `test/test_module_root_flatten.ml`.
223+
. H23 (found and fixed 2026-11-09, checking and running metadatastician/kyq; numbered H20 in #788, renumbered because #787 assigned H20–H22). A module file found for `A.B` that declares `module A;` was accepted as `A.B`, so `use A.Nonexistent::*` type-checked and imported `A`'s exports; it is now a `ModuleDeclMismatch` load error. *Round 2 (2026-11-16):* a nested candidate (`dir/A/B.affine`) is now searched in every directory before any parent-module fallback, and a module whose load fails is no longer left marked as loading (which reported a later import of it as a cycle). Anchor: `test/test_module_root_flatten.ml`.
224+
. H24 (found and fixed 2026-11-09; numbered H21 in #788). `eval` ran the unflattened program, so no imported function was bound at run time; flattening also emitted a selected function before the private helpers it calls and carried no helpers for glob or plain imports. `eval` now flattens, every import kind carries its helpers, and they are emitted in the imported module's declaration order. *Round 2 (2026-11-16):* two modules with a same-named private helper no longer collide: every private helper carried into a flattened program is renamed `__priv_<Module>__<name>` with a capture-avoiding substitution, and an aliased import emits the original before the alias. Only the root program's `main` is run. Anchor: `test/test_module_root_flatten.ml`.
225+
. H25 (found and fixed 2026-11-09; numbered H22 in #788). The interpreter had no `++` on arrays and no `==`/`!=` beyond Int, Float, String and Bool, though the checker accepts them; it now uses the structural `Value.value_eq`. H7 (`let mut`) is unchanged. Anchor: `test/test_module_root_flatten.ml`.
226226

227227
== 2. Target architecture
228228

‎lib/ast.ml‎

Lines changed: 140 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,16 @@ let rec expr_contains_return (e : expr) : bool =
532532
|| List.exists (fun arm ->
533533
(match arm.ma_guard with Some g -> expr_contains_return g | None -> false)
534534
|| expr_contains_return arm.ma_body) em_arms
535+
(* Aggregates: `[return 1]`, `(x, return y)`, `#{ f: return z }` and
536+
projections of them return just as directly. *)
537+
| ExprTuple es | ExprArray es -> List.exists expr_contains_return es
538+
| ExprRecord { er_fields; er_spread } ->
539+
List.exists (fun (_, e) ->
540+
match e with Some e -> expr_contains_return e | None -> false) er_fields
541+
|| (match er_spread with Some e -> expr_contains_return e | None -> false)
542+
| ExprField (e, _) | ExprTupleIndex (e, _) -> expr_contains_return e
543+
| ExprIndex (a, b) | ExprStringConcat (a, b) ->
544+
expr_contains_return a || expr_contains_return b
535545
| _ -> false
536546

537547
and block_contains_return (blk : block) : bool =
@@ -566,6 +576,127 @@ let rec pattern_binders (pat : pattern) : string list =
566576
| PatOr (p1, p2) -> pattern_binders p1 @ pattern_binders p2
567577
| PatAs (id, pat) -> id.name :: pattern_binders pat
568578

579+
(** Rename free occurrences of variables: [ren] maps old names to new ones.
580+
Capture-avoiding in the usual way: a binder (let, match arm, lambda
581+
parameter, block `let`, `for` pattern, handler pattern) removes the
582+
names it binds from [ren] for its scope, so a local that shadows a
583+
renamed top-level name keeps referring to the local. A record
584+
shorthand field `#{ x }` whose variable is renamed becomes
585+
`#{ x: x' }`. Used by import flattening to give each module's private
586+
helpers module-specific names. *)
587+
let without_names (ren : (string * string) list) (names : string list) =
588+
List.filter (fun (old, _) -> not (List.mem old names)) ren
589+
590+
let rec rename_free (ren : (string * string) list) (e : expr) : expr =
591+
if ren = [] then e
592+
else
593+
let r = rename_free ren in
594+
let ro = Option.map r in
595+
match e with
596+
| ExprLit _ | ExprBreak _ | ExprContinue _ | ExprVariant _ -> e
597+
| ExprVar id ->
598+
(match List.assoc_opt id.name ren with
599+
| Some n -> ExprVar { id with name = n }
600+
| None -> e)
601+
| ExprLet lb ->
602+
let inner = without_names ren (pattern_binders lb.el_pat) in
603+
ExprLet { lb with el_value = r lb.el_value;
604+
el_body = Option.map (rename_free inner) lb.el_body }
605+
| ExprIf ei ->
606+
ExprIf { ei_cond = r ei.ei_cond; ei_then = r ei.ei_then;
607+
ei_else = ro ei.ei_else }
608+
| ExprMatch m ->
609+
ExprMatch { em_scrutinee = r m.em_scrutinee;
610+
em_arms = List.map (rename_arm ren) m.em_arms }
611+
| ExprLambda lam ->
612+
let inner =
613+
without_names ren (List.map (fun (p : param) -> p.p_name.name)
614+
lam.elam_params) in
615+
ExprLambda { lam with elam_body = rename_free inner lam.elam_body }
616+
| ExprApp (f, args) -> ExprApp (r f, List.map r args)
617+
| ExprField (x, f) -> ExprField (r x, f)
618+
| ExprTupleIndex (x, i) -> ExprTupleIndex (r x, i)
619+
| ExprIndex (a, b) -> ExprIndex (r a, r b)
620+
| ExprTuple es -> ExprTuple (List.map r es)
621+
| ExprArray es -> ExprArray (List.map r es)
622+
| ExprRecord rc ->
623+
let field ((n : ident), eo) =
624+
match eo with
625+
| Some x -> (n, Some (r x))
626+
| None ->
627+
(match List.assoc_opt n.name ren with
628+
| Some nn -> (n, Some (ExprVar { n with name = nn }))
629+
| None -> (n, None))
630+
in
631+
ExprRecord { er_fields = List.map field rc.er_fields;
632+
er_spread = ro rc.er_spread }
633+
| ExprRowRestrict (x, f) -> ExprRowRestrict (r x, f)
634+
| ExprBinary (a, op, b) -> ExprBinary (r a, op, r b)
635+
| ExprStringConcat (a, b) -> ExprStringConcat (r a, r b)
636+
| ExprStringEq (a, b, neg) -> ExprStringEq (r a, r b, neg)
637+
| ExprStringRel (a, b, op) -> ExprStringRel (r a, r b, op)
638+
| ExprFloatBinary (a, op, b) -> ExprFloatBinary (r a, op, r b)
639+
| ExprFloatArray es -> ExprFloatArray (List.map r es)
640+
| ExprFloatIndex (a, b) -> ExprFloatIndex (r a, r b)
641+
| ExprCellTuple cs -> ExprCellTuple (List.map (fun (x, f) -> (r x, f)) cs)
642+
| ExprCellTupleIndex (x, i, f) -> ExprCellTupleIndex (r x, i, f)
643+
| ExprCellRecord fs ->
644+
ExprCellRecord (List.map (fun (n, x, f) -> (n, r x, f)) fs)
645+
| ExprCellField (x, i, f) -> ExprCellField (r x, i, f)
646+
| ExprUnary (op, x) -> ExprUnary (op, r x)
647+
| ExprBlock b -> ExprBlock (rename_block ren b)
648+
| ExprReturn eo -> ExprReturn (ro eo)
649+
| ExprTry t ->
650+
ExprTry { et_body = rename_block ren t.et_body;
651+
et_catch = Option.map (List.map (rename_arm ren)) t.et_catch;
652+
et_finally = Option.map (rename_block ren) t.et_finally }
653+
| ExprHandle h ->
654+
let handler = function
655+
| HandlerReturn (p, x) ->
656+
HandlerReturn (p, rename_free (without_names ren (pattern_binders p)) x)
657+
| HandlerOp (op, ps, x) ->
658+
HandlerOp (op, ps,
659+
rename_free
660+
(without_names ren (List.concat_map pattern_binders ps)) x)
661+
in
662+
ExprHandle { eh_body = r h.eh_body;
663+
eh_handlers = List.map handler h.eh_handlers }
664+
| ExprResume eo -> ExprResume (ro eo)
665+
| ExprUnsafe ops ->
666+
ExprUnsafe (List.map (function
667+
| UnsafeRead x -> UnsafeRead (r x)
668+
| UnsafeWrite (a, b) -> UnsafeWrite (r a, r b)
669+
| UnsafeOffset (a, b) -> UnsafeOffset (r a, r b)
670+
| UnsafeTransmute (t1, t2, x) -> UnsafeTransmute (t1, t2, r x)
671+
| UnsafeForget x -> UnsafeForget (r x)) ops)
672+
| ExprSpan (x, sp) -> ExprSpan (r x, sp)
673+
674+
and rename_arm ren (arm : match_arm) : match_arm =
675+
let inner = without_names ren (pattern_binders arm.ma_pat) in
676+
{ arm with ma_guard = Option.map (rename_free inner) arm.ma_guard;
677+
ma_body = rename_free inner arm.ma_body }
678+
679+
and rename_block ren (blk : block) : block =
680+
if ren = [] then blk
681+
else
682+
let rec go ren acc = function
683+
| [] -> (List.rev acc, ren)
684+
| StmtLet sl :: rest ->
685+
let s = StmtLet { sl with sl_value = rename_free ren sl.sl_value } in
686+
go (without_names ren (pattern_binders sl.sl_pat)) (s :: acc) rest
687+
| StmtExpr x :: rest -> go ren (StmtExpr (rename_free ren x) :: acc) rest
688+
| StmtAssign (a, op, b) :: rest ->
689+
go ren (StmtAssign (rename_free ren a, op, rename_free ren b) :: acc) rest
690+
| StmtWhile (c, b) :: rest ->
691+
go ren (StmtWhile (rename_free ren c, rename_block ren b) :: acc) rest
692+
| StmtFor (p, it, b) :: rest ->
693+
let s = StmtFor (p, rename_free ren it,
694+
rename_block (without_names ren (pattern_binders p)) b) in
695+
go ren (s :: acc) rest
696+
in
697+
let stmts, ren_after = go ren [] blk.blk_stmts in
698+
{ blk_stmts = stmts; blk_expr = Option.map (rename_free ren_after) blk.blk_expr }
699+
569700
(** Free variables of an expression.
570701
571702
Returns the names used in [expr] but not bound within it; [bound_vars]
@@ -659,11 +790,18 @@ let rec find_free_vars (bound_vars : string list) (expr : expr) : string list =
659790
| ExprTuple exprs | ExprArray exprs ->
660791
List.concat (List.map (find_free_vars bound_vars) exprs)
661792
| ExprRecord r ->
662-
List.concat (List.map (fun (_, e_opt) ->
793+
(* A shorthand field `#{ x }` reads the variable `x`, and a spread
794+
`..base` reads `base`: both are free uses, which import flattening
795+
needs to carry the helper or constant they name. *)
796+
List.concat (List.map (fun ((name : ident), e_opt) ->
663797
match e_opt with
664798
| Some e -> find_free_vars bound_vars e
665-
| None -> []
799+
| None ->
800+
if List.mem name.name bound_vars then [] else [name.name]
666801
) r.er_fields)
802+
@ (match r.er_spread with
803+
| Some e -> find_free_vars bound_vars e
804+
| None -> [])
667805
| ExprField (e, _) -> find_free_vars bound_vars e
668806
| ExprTupleIndex (e, _) -> find_free_vars bound_vars e
669807
| ExprIndex (e1, e2) ->

‎lib/codegen_deno.ml‎

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,29 +1906,54 @@ and gen_tail_to ctx (sink : string -> string) e =
19061906
| None -> Buffer.add_string b (sink "Unit"));
19071907
"{ " ^ Buffer.contents b ^ " }"
19081908
| ExprIf { ei_cond; ei_then; ei_else } ->
1909+
(* The condition is emitted as an expression, where a `return` would
1910+
leave an IIFE instead of the function. *)
1911+
if expr_contains_return ei_cond then
1912+
refuse_return "an `if` condition";
19091913
let elseb = match ei_else with
19101914
| Some el -> gen_tail_to ctx sink el
19111915
| None -> sink "Unit"
19121916
in
19131917
"if (" ^ gen_expr ctx ei_cond ^ ") { " ^ gen_tail_to ctx sink ei_then
19141918
^ " } else { " ^ elseb ^ " }"
19151919
| ExprMatch { em_scrutinee; em_arms } ->
1920+
if expr_contains_return em_scrutinee then
1921+
refuse_return "a match scrutinee";
1922+
if List.exists (fun arm ->
1923+
match arm.ma_guard with
1924+
| Some g -> expr_contains_return g
1925+
| None -> false) em_arms
1926+
then refuse_return "a match guard";
19161927
incr let_tmp_counter;
1917-
let sv = Printf.sprintf "__scrut_%d" !let_tmp_counter in
1918-
let rec arms_js = function
1919-
| [] -> "throw new Error(\"non-exhaustive match\");"
1920-
| arm :: rest ->
1921-
let cond = gen_pattern_test sv arm.ma_pat in
1922-
let binds = gen_pattern_bindings sv arm.ma_pat in
1923-
let guard = match arm.ma_guard with
1924-
| Some g -> " && (" ^ gen_expr ctx g ^ ")" | None -> "" in
1925-
"if (" ^ cond ^ guard ^ ") { " ^ binds
1926-
^ gen_tail_to ctx sink arm.ma_body ^ " } else " ^ arms_js rest
1928+
(* `$` cannot occur in an AffineScript identifier, so these names
1929+
cannot collide with, or shadow, a source binding. *)
1930+
let sv = Printf.sprintf "$scrut_%d" !let_tmp_counter in
1931+
let label = Printf.sprintf "$match_%d" !let_tmp_counter in
1932+
(* A labelled block: each arm binds its pattern variables before its
1933+
guard reads them, and an arm whose guard fails falls through to
1934+
the next arm. *)
1935+
let arm_js arm =
1936+
let cond = gen_pattern_test sv arm.ma_pat in
1937+
let binds = gen_pattern_bindings sv arm.ma_pat in
1938+
let body = gen_tail_to ctx sink arm.ma_body ^ " break " ^ label ^ ";" in
1939+
let guarded = match arm.ma_guard with
1940+
| None -> body
1941+
| Some g -> "if (" ^ gen_expr ctx g ^ ") { " ^ body ^ " }"
1942+
in
1943+
"if (" ^ cond ^ ") { " ^ binds ^ guarded ^ " }"
19271944
in
1928-
"{ const " ^ sv ^ " = " ^ gen_expr ctx em_scrutinee ^ "; "
1929-
^ arms_js em_arms ^ " }"
1945+
label ^ ": { const " ^ sv ^ " = " ^ gen_expr ctx em_scrutinee ^ "; "
1946+
^ String.concat " " (List.map arm_js em_arms)
1947+
^ " throw new Error(\"non-exhaustive match\"); }"
19301948
| other -> sink (gen_expr ctx other)
19311949

1950+
(* Fail loudly where a `return` would otherwise be compiled into an IIFE and
1951+
leave it instead of the enclosing function. *)
1952+
and refuse_return what =
1953+
failwith
1954+
("a `return` inside " ^ what ^ " is not supported by the Bun-ESM \
1955+
backend; bind the value to a `let` first")
1956+
19321957
and gen_assign_tail ctx target e =
19331958
gen_tail_to ctx (fun v -> target ^ " = " ^ v ^ ";") e
19341959

@@ -1966,7 +1991,12 @@ and gen_stmt ctx (stmt : stmt) : string =
19661991
occurrence in the same scope ("Identifier '_' has already been
19671992
declared"). Drop the binding entirely; the bare expression
19681993
statement keeps the semantics. *)
1969-
gen_expr ctx sl_value ^ ";"
1994+
if lowers_to_statements sl_value && expr_contains_return sl_value then
1995+
(* As below for named bindings: lower to statements so an early
1996+
`return` leaves the function; the value itself is discarded. *)
1997+
gen_tail_to ctx (fun v -> "void (" ^ v ^ ");") sl_value
1998+
else
1999+
gen_expr ctx sl_value ^ ";"
19702000
| StmtLet { sl_pat; sl_value; sl_mut; sl_quantity = _; sl_ty = _ } ->
19712001
let kw = if sl_mut then "let" else "const" in
19722002
let js =
@@ -1978,7 +2008,7 @@ and gen_stmt ctx (stmt : stmt) : string =
19782008
initializer to statements that assign a temporary, so the
19792009
`return` is a real function return. *)
19802010
incr let_tmp_counter;
1981-
let tmp = Printf.sprintf "__let_tmp_%d" !let_tmp_counter in
2011+
let tmp = Printf.sprintf "$let_tmp_%d" !let_tmp_counter in
19822012
"let " ^ tmp ^ "; " ^ gen_assign_tail ctx tmp sl_value ^ " "
19832013
^ kw ^ " " ^ gen_pattern ctx sl_pat ^ " = " ^ tmp ^ ";"
19842014
end else

0 commit comments

Comments
 (0)