8000 Remove File_path exports. by ceastlund · Pull Request #381 · ocaml-ppx/ppxlib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove File_path exports. #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8000
Merged
merged 1 commit into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
39DA
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