Skip to content

Commit

Permalink
Fix issue after cherry pick
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Dec 11, 2024
1 parent cfc790e commit a6758ba
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/analysis/index_occurrences.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ let items ~index ~stamp (config : Mconfig.t) items =
None
end) in
let current_buffer_path =
Filename.concat config.query.directory config.query.filename
Filename.concat config.query.directory (Mconfig.query_filename config.query)
in
let reduce_for_uid = Shape_reduce.reduce_for_uid in
let iterator = iterator ~current_buffer_path ~index ~stamp ~reduce_for_uid in
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/locate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ module Utils = struct
List.dedup_adjacent files ~cmp:String.compare

let find_file_with_path ~config ?(with_fallback = false) file path =
if File.name file = Misc.unitname Mconfig.(config.query.filename) then
if File.name file = Misc.unitname Mconfig.(query_filename config.query) then
Mconfig.(config.query.filename)
else
let attempt_search src_suffix_pair =
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/occurrences.ml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ let locs_of ~config ~env ~typer_result ~pos ~scope path =
(None, `Buffer)
in
let current_buffer_path =
Filename.concat config.query.directory config.query.filename
Filename.concat config.query.directory (Mconfig.query_filename config.query)
in
match def with
| Some (def_uid, def_loc) ->
Expand Down Expand Up @@ -208,7 +208,7 @@ let locs_of ~config ~env ~typer_result ~pos ~scope path =
match config.merlin.source_root with
| Some root ->
(Filename.concat root file, current_buffer_path)
| None -> (file, config.query.filename)
| None -> (file, Mconfig.query_filename config.query)
in
let file = Misc.canonicalize_filename file in
let buf = Misc.canonicalize_filename buf in
Expand Down
12 changes: 6 additions & 6 deletions src/kernel/mconfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,13 @@ type query =
verbosity : Verbosity.t
}

let query_filename q = match q.filename with
| None -> "*buffer*"
| Some filename -> filename
let query_filename q =
match q.filename with
| None -> "*buffer*"
| Some filename -> filename
let dump_query x =
`Assoc
[ ("filename", `String (query_filename x);
[ ("filename", `String (query_filename x));
("directory", `String x.directory);
("printer_width", `Int x.printer_width);
("verbosity", Verbosity.to_json x.verbosity)
Expand Down Expand Up @@ -823,8 +824,7 @@ let global_modules ?(include_current = false) config =

(** {1 Accessors for other information} *)

let filename t =
query_filename t.query
let filename t = query_filename t.query

let unitname t =
match t.merlin.unit_name with
Expand Down
7 changes: 3 additions & 4 deletions src/kernel/mpipeline.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let { Logger.log } = Logger.for_section "Pipeline"

let time_shift = ref 0.0

let timed_lazy r x =
let timed r x =
let start = Misc.time_spent () in
let time_shift0 = !time_shift in
let update () =
Expand Down Expand Up @@ -108,7 +108,6 @@ let get_lexing_pos t pos =
let reader t = t.reader

let ppx t = t.ppx
let typer t = t.typer

let reader_config t = (reader t).config
let reader_parsetree t = (reader t).result.Mreader.parsetree
Expand Down Expand Up @@ -234,7 +233,7 @@ let process ?state ?(pp_time = ref 0.0) ?(reader_time = ref 0.0)
let source = Msource.text raw_source in
match
Pparse.apply_pp ~workdir
~filename:Mconfig.(config.query.filename)
~filename:Mconfig.(query_filename config.query)
~source ~pp:workval
with
| `Source source -> (Msource.make source, None)
Expand Down Expand Up @@ -299,7 +298,7 @@ let process ?state ?(pp_time = ref 0.0) ?(reader_time = ref 0.0)
(let { Ppx.config; parsetree; _ } = ppx in
Mocaml.setup_typer_config config;
let result = Mtyper.run config parsetree in
let errors = timed_lazy error_time (lazy (Mtyper.get_errors result)) in
let errors = timed error_time (lazy (Mtyper.get_errors result)) in
typer_cache_stats := Mtyper.get_cache_stat result;
{ Typer.errors; result }))
in
Expand Down

0 comments on commit a6758ba

Please sign in to comment.