@@ -429,27 +429,34 @@ let type_resolving_visitor
429
429
let visit_slot_identified_pre slot =
430
430
let slot = resolve_slot_identified slot in
431
431
htab_put cx.ctxt_all_defns slot.id (DEFN_slot slot.node);
432
- log cx " collected resolved slot #%d with type %s" (int_of_node slot.id)
433
- (match slot.node.Ast. slot_ty with
434
- None -> " ??"
435
- | Some t -> (Fmt. fmt_to_str Ast. fmt_ty t));
432
+ iflog cx
433
+ (fun _ ->
434
+ log cx " collected resolved slot #%d with type %s"
435
+ (int_of_node slot.id)
436
+ (match slot.node.Ast. slot_ty with
437
+ None -> " ??"
438
+ | Some t -> (Fmt. fmt_to_str Ast. fmt_ty t)));
436
439
inner.Walk. visit_slot_identified_pre slot
437
440
in
438
441
439
442
let visit_mod_item_pre id params item =
440
443
let resolve_and_store_type _ =
441
444
let t = ty_of_mod_item item in
442
445
let ty = resolve_ty ~loc: item.id t in
443
- log cx " resolved item %s, type as %a" id Ast. sprintf_ty ty;
446
+ iflog cx
447
+ (fun _ ->
448
+ log cx " resolved item %s, type as %a" id Ast. sprintf_ty ty);
444
449
htab_put cx.ctxt_all_item_types item.id ty;
445
450
in
446
451
begin
447
452
try
448
453
match item.node.Ast. decl_item with
449
454
Ast. MOD_ITEM_type (_ , ty ) ->
450
455
let ty = resolve_ty ~loc: item.id ty in
451
- log cx " resolved item %s, defining type %a"
452
- id Ast. sprintf_ty ty;
456
+ iflog cx
457
+ (fun _ ->
458
+ log cx " resolved item %s, defining type %a"
459
+ id Ast. sprintf_ty ty);
453
460
htab_put cx.ctxt_all_type_items item.id ty;
454
461
htab_put cx.ctxt_all_item_types item.id Ast. TY_type ;
455
462
if Hashtbl. mem cx.ctxt_all_item_names item.id then
@@ -492,7 +499,9 @@ let type_resolving_visitor
492
499
493
500
let visit_obj_fn_pre obj ident fn =
494
501
let fty = resolve_ty ~loc: fn.id (Ast. TY_fn (ty_fn_of_fn fn.node)) in
495
- log cx " resolved obj fn %s as %a" ident Ast. sprintf_ty fty;
502
+ iflog cx
503
+ (fun _ ->
504
+ log cx " resolved obj fn %s as %a" ident Ast. sprintf_ty fty);
496
505
htab_put cx.ctxt_all_item_types fn.id fty;
497
506
inner.Walk. visit_obj_fn_pre obj ident fn
498
507
in
@@ -629,20 +638,23 @@ let lval_base_resolving_visitor
629
638
(inner :Walk.visitor )
630
639
: Walk.visitor =
631
640
let lookup_defn_by_ident id ident =
632
- log cx " looking up slot or item with ident '%s'" ident;
641
+ iflog cx
642
+ (fun _ -> log cx " looking up slot or item with ident '%s'" ident);
633
643
match lookup cx (! scopes) (Ast. KEY_ident ident) with
634
644
RES_failed _ -> err (Some id) " unresolved identifier '%s'" ident
635
- | RES_ok (_ , id ) -> (log cx " resolved to node id #%d"
636
- (int_of_node id); id)
645
+ | RES_ok (_ , id ) -> ((iflog cx ( fun _ -> log cx " resolved to node id #%d"
646
+ (int_of_node id)) ); id)
637
647
in
638
648
let lookup_slot_by_temp id temp =
639
- log cx " looking up temp slot #%d" (int_of_temp temp);
649
+ iflog cx ( fun _ -> log cx " looking up temp slot #%d" (int_of_temp temp) );
640
650
let res = lookup cx (! scopes) (Ast. KEY_temp temp) in
641
651
match res with
642
652
RES_failed _ -> err
643
653
(Some id) " unresolved temp node #%d" (int_of_temp temp)
644
654
| RES_ok (_ , id ) ->
645
- (log cx " resolved to node id #%d" (int_of_node id); id)
655
+ (iflog cx
656
+ (fun _ -> log cx " resolved to node id #%d" (int_of_node id));
657
+ id)
646
658
in
647
659
let lookup_defn_by_name_base id nb =
648
660
match nb with
0 commit comments