Skip to content

Commit eeb421f

Browse files
committed
Implement value line tracking for value binding analysis
- Added `-vl` and `--value-line` command-line options to specify the line number of the value binding for improved analysis in `count_value_usage_in_dependents`. - Enhanced `count_value_usage_in_dependents` to utilize the line number for more accurate usage counting. - Updated `main.ml` to handle new command-line options and pass the value line to the counting function. - Introduced new utility functions in `dependency_graph.ml` for locating let bindings at specific lines.
1 parent a3b6f09 commit eeb421f

File tree

17 files changed

+814
-395
lines changed

17 files changed

+814
-395
lines changed

bin/main.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ let skip_cache = ref false
1010
let clear_cache = ref false
1111
let no_dependents = ref false
1212
let value_binding = ref None
13+
let value_line = ref None
1314

1415
let spec_list =
1516
[
@@ -67,6 +68,12 @@ let spec_list =
6768
Arg.String (fun s -> value_binding := Some s),
6869
"Analyze usage count of a value binding in dependents of the focused \
6970
module" );
71+
( "-vl",
72+
Arg.Int (fun n -> value_line := Some n),
73+
"Line number of the value binding (1-based, optional, for local lets)" );
74+
( "--value-line",
75+
Arg.Int (fun n -> value_line := Some n),
76+
"Line number of the value binding (1-based, optional, for local lets)" );
7077
]
7178

7279
let anon_fun file = input_files := file :: !input_files
@@ -133,9 +140,11 @@ let main () =
133140
normalized_name
134141
in
135142
time_checkpoint "Module focusing completed";
143+
(* Pass value_line to the counting function if provided *)
136144
let usage_list =
137145
Rescriptdep.Dependency_graph.count_value_usage_in_dependents
138146
focused_graph ~module_name:normalized_name ~value_name
147+
~value_line:!value_line
139148
in
140149
let output_to =
141150
match !output_file with

0 commit comments

Comments
 (0)