Skip to content

Commit

Permalink
Removed File_path exports.
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Eastlund <[email protected]>
  • Loading branch information
ceastlund committed Jan 19, 2023
1 parent bddb506 commit 4f4f7f7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 32 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
unreleased
------------------

- Remove `File_path` exports. (#381, @ceastlund)

0.28.0 (05/10/2022)
-------------------
Expand Down
27 changes: 23 additions & 4 deletions src/driver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ let ghost =
method! location loc = { loc with loc_ghost = true }
end

let chop_prefix ~prefix x =
if String.is_prefix ~prefix x then
Some (String.drop_prefix x (String.length prefix))
else None

let get_default_path (loc : Location.t) =
let fname = loc.loc_start.pos_fname in
match chop_prefix ~prefix:"./" fname with
| Some fname -> fname
| None -> fname

let get_default_path_str : structure -> string = function
| [] -> ""
| { pstr_loc = loc; _ } :: _ -> get_default_path loc

let get_default_path_sig : signature -> string = function
| [] -> ""
| { psig_loc = loc; _ } :: _ -> get_default_path loc

module Lint_error = struct
type t = Location.t * string

Expand Down Expand Up @@ -245,7 +264,7 @@ module Transform = struct
| { pstr_desc = Pstr_attribute _; _ } -> true
| _ -> false)
in
let file_path = File_path.get_default_path_str st in
let file_path = get_default_path_str st in
let base_ctxt =
Expansion_context.Base.top_level ~tool_name ~file_path ~input_name
in
Expand All @@ -267,7 +286,7 @@ module Transform = struct
| { psig_desc = Psig_attribute _; _ } -> true
| _ -> false)
in
let file_path = File_path.get_default_path_sig sg in
let file_path = get_default_path_sig sg in
let base_ctxt =
Expansion_context.Base.top_level ~tool_name ~file_path ~input_name
in
Expand Down Expand Up @@ -681,7 +700,7 @@ let map_structure_gen st ~tool_name ~hook ~expect_mismatch_handler ~input_name
in
with_errors errors st
in
let file_path = File_path.get_default_path_str st in
let file_path = get_default_path_str st in
match
apply_transforms st ~tool_name ~file_path
~field:(fun (ct : Transform.t) -> ct.impl)
Expand Down Expand Up @@ -761,7 +780,7 @@ let map_signature_gen sg ~tool_name ~hook ~expect_mismatch_handler ~input_name
in
with_errors errors sg
in
let file_path = File_path.get_default_path_sig sg in
let file_path = get_default_path_sig sg in
match
apply_transforms sg ~tool_name ~file_path
~field:(fun (ct : Transform.t) -> ct.intf)
Expand Down
20 changes: 0 additions & 20 deletions src/file_path.ml

This file was deleted.

7 changes: 0 additions & 7 deletions src/file_path.mli

This file was deleted.

1 change: 0 additions & 1 deletion src/ppxlib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ module Driver = Driver
module Expansion_context = Expansion_context
module Expansion_helpers = Expansion_helpers
module Extension = Extension
module File_path = File_path
module Keyword = Keyword
module Loc = Loc
module Location = Location
Expand Down

0 comments on commit 4f4f7f7

Please sign in to comment.