@@ -17,6 +17,7 @@ type config =
17
17
}
18
18
19
19
let config = { filename= " file.ml" ; pos= " 0,0" ; line= 0 ; col= 0 ; mode = GoToDef }
20
+ let _ = if false then config.pos < - " " else ignore config.pos
20
21
let parse_loc loc =
21
22
Scanf. sscanf loc " %d,%d" (fun l c -> config.line < - l; config.col < - c)
22
23
@@ -53,7 +54,7 @@ let do_find e =
53
54
inherit [_,_] Language.Expr. foldl_t_t_stub (foldl_decl, fself) as super
54
55
method! c_Var _inh _ name = on_name name _inh
55
56
method! c_Ref _inh _ name = on_name name _inh
56
- method c_Scope init e names r =
57
+ method! c_Scope init e names r =
57
58
let map = ListLabels. fold_left ~init names ~f: (fun acc (fname ,(_ ,info )) ->
58
59
let acc = Introduced. extend fname (Loc. get_exn fname) acc in
59
60
match info with
@@ -70,7 +71,7 @@ let do_find e =
70
71
(* Format.printf "STUB. Ht size = %d\n%!" (Loc.H.length Loc.tab);
71
72
Loc.H.iter (fun k (l,c) -> Format.printf "%s -> (%d,%d)\n%!" k l c) Loc.tab; *)
72
73
73
- let (_,fold_t) = Expr. fix_decl Expr. foldl_decl_0 ooo in
74
+ let (_,fold_t) = Expr. fix_decl_t Expr. foldl_decl_0 ooo in
74
75
match fold_t Introduced. empty e with
75
76
| exception (DefinitionFound arg ) -> Some arg
76
77
| _ -> None
@@ -89,29 +90,29 @@ let find_usages root (def_name,(_,_)) =
89
90
if in_scope then (on_name name acc, in_scope) else (acc, in_scope)
90
91
method! c_Ref (acc,in_scope) _ name =
91
92
self#c_Var (acc,in_scope) (Var name) name
92
- method c_Scope init e names r =
93
+ method! c_Scope init e names r =
93
94
ListLabels. fold_left ~init names ~f: (fun ((acc , in_scope ) as inh ) (name ,info ) ->
94
95
match (in_scope, String. equal def_name name) with
95
96
| (true , true ) -> (acc, false )
96
97
| (true , _ ) -> begin
97
98
match snd info with
98
- | `Fun (args , body ) when List. mem def_name args -> inh
99
- | `Fun (args , body ) -> fself inh body
99
+ | `Fun (args , _ ) when List. mem def_name args -> inh
100
+ | `Fun (_ , body ) -> fself inh body
100
101
| `Variable (Some rhs ) -> fself inh rhs
101
102
| `Variable None -> inh
102
103
end
103
104
| (false , true ) -> super#c_Scope (acc,true ) e names r
104
105
| false ,false -> begin
105
106
match snd info with
106
107
| `Fun (args , body ) when List. memq def_name args -> fself (acc,true ) body
107
- | `Fun (args , body ) -> fself inh body
108
+ | `Fun (_ , body ) -> fself inh body
108
109
| `Variable (Some rhs ) -> fself inh rhs
109
110
| `Variable None -> inh
110
111
end
111
112
) |> (fun acc -> fself acc r)
112
113
end in
113
114
114
- let (_,fold_t) = Expr. fix_decl Expr. foldl_decl_0 ooo in
115
+ let (_,fold_t) = Expr. fix_decl_t Expr. foldl_decl_0 ooo in
115
116
fold_t ([] ,false ) root
116
117
117
118
0 commit comments