Skip to content

Commit 815222d

Browse files
committed
---
yaml --- r: 683 b: refs/heads/master c: 9dac49b h: refs/heads/master i: 681: 79b88cf 679: da14c95 v: v3
1 parent 3a51a8d commit 815222d

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: d92e30d773e5358d982e7514d2ed5b2bc1b9c43f
2+
refs/heads/master: 9dac49bcd613213347e1a6beba25d64bea2596b7

trunk/src/boot/me/resolve.ml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ let type_resolving_visitor
489489
in
490490

491491
let visit_pexp_post p =
492+
inner.Walk.visit_pexp_post p;
492493
let rebuild_plval pl =
493494
match pl with
494495
Ast.PLVAL_ident _ -> pl
@@ -626,6 +627,7 @@ let lval_base_resolving_visitor
626627
lookup_lval base;
627628
match ext with
628629
Ast.COMP_atom (Ast.ATOM_lval lv') -> lookup_lval lv'
630+
629631
| _ -> ()
630632
end
631633
| Ast.LVAL_base nb ->
@@ -659,8 +661,42 @@ let lval_base_resolving_visitor
659661
reference_any_name lv;
660662
inner.Walk.visit_lval_pre lv
661663
in
664+
665+
let visit_pexp_pre p =
666+
begin
667+
match p.node with
668+
Ast.PEXP_lval pl ->
669+
begin
670+
match pl with
671+
(Ast.PLVAL_ident ident)
672+
| (Ast.PLVAL_app (ident, _)) ->
673+
let id = lookup_defn_by_ident p.id ident in
674+
675+
iflog cx
676+
(fun _ ->
677+
log cx "resolved plval %a = #%d to defn #%d"
678+
Ast.sprintf_plval pl
679+
(int_of_node p.id) (int_of_node id));
680+
681+
(* Record the pexp -> defn mapping. *)
682+
htab_put cx.ctxt_lval_base_id_to_defn_base_id p.id id;
683+
684+
(* Tickle the referenced-ness table if it's an item. *)
685+
if defn_id_is_item cx id
686+
then ignore (lookup_by_name cx [] (!scopes)
687+
(plval_to_name pl))
688+
| _ -> ()
689+
end
690+
691+
| _ -> ()
692+
end;
693+
inner.Walk.visit_pexp_pre p
694+
in
695+
662696
{ inner with
663-
Walk.visit_lval_pre = visit_lval_pre };
697+
Walk.visit_lval_pre = visit_lval_pre;
698+
Walk.visit_pexp_pre = visit_pexp_pre
699+
};
664700
;;
665701

666702

trunk/src/boot/me/semant.ml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,17 @@ let rec lval_to_name (lv:Ast.lval) : Ast.name =
577577
Ast.NAME_ext (lval_to_name lv, comp)
578578
;;
579579

580+
let rec plval_to_name (pl:Ast.plval) : Ast.name =
581+
match pl with
582+
Ast.PLVAL_ident ident ->
583+
Ast.NAME_base (Ast.BASE_ident ident)
584+
| Ast.PLVAL_app (ident, tys) ->
585+
Ast.NAME_base (Ast.BASE_app (ident, tys))
586+
| Ast.PLVAL_ext_name ({node = Ast.PEXP_lval pl}, nc) ->
587+
Ast.NAME_ext (plval_to_name pl, nc)
588+
| _ -> bug () "plval_to_name with plval that contains non-name components"
589+
;;
590+
580591

581592
(* Type extraction. *)
582593

0 commit comments

Comments
 (0)