File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -382,6 +382,7 @@ let program' (module Strategy : Strategy) p =
382382 mapper#get_free
383383 in
384384 let has_free_var = IdentSet. cardinal free <> 0 in
385+ let unallocated_names = ref Var.Set. empty in
385386 let names = Strategy. allocate_variables state ~count: mapper#get_count in
386387 (* ignore the choosen name for escaping/free [V _] variables *)
387388 IdentSet. iter
@@ -396,10 +397,11 @@ let program' (module Strategy : Strategy) p =
396397 ident ~var: v (Utf8_string. of_string_exn (Printf. sprintf " v%d" (Code.Var. idx v)))
397398 else
398399 let name = names.(Var. idx v) in
399- match name, has_free_var with
400- | "" , true -> V v
401- | "" , false -> assert false
402- | _ , (true | false ) -> ident ~var: v (Utf8_string. of_string_exn name))
400+ match name with
401+ | "" ->
402+ unallocated_names := Var.Set. add v ! unallocated_names;
403+ V v
404+ | _ -> ident ~var: v (Utf8_string. of_string_exn name))
403405 | x -> x
404406 in
405407 let label_printer = Var_printer. create Var_printer.Alphabet. javascript in
@@ -414,7 +416,7 @@ let program' (module Strategy : Strategy) p =
414416 S (Utf8_string. of_string_exn lname_per_depth.(i))
415417 in
416418 let p = (new name ident label)#program p in
417- (if has_free_var
419+ (if has_free_var || Var.Set. cardinal ! unallocated_names > 0
418420 then
419421 let () =
420422 if not (debug_shortvar () || debug () )
You can’t perform that action at this time.
0 commit comments