Skip to content

Commit

Permalink
[typer] remove Directory package rule because it is unused
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Jan 9, 2024
1 parent 26807ac commit 822dd87
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/context/common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ open Warning

type package_rule =
| Forbidden
| Directory of string
| Remap of string

type pos = Globals.pos
Expand Down
2 changes: 0 additions & 2 deletions src/context/display/displayPath.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module TypePathHandler = struct
| x :: l ->
(try
match PMap.find x com.package_rules with
| Directory d -> d :: l
| Remap s -> s :: l
| _ -> p
with
Expand All @@ -47,7 +46,6 @@ module TypePathHandler = struct
match PMap.find f com.package_rules with
| Forbidden -> ()
| Remap f -> packages := f :: !packages
| Directory _ -> raise Not_found
with Not_found ->
packages := f :: !packages
else
Expand Down
1 change: 0 additions & 1 deletion src/context/display/displayToplevel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class explore_class_path_task com checked recursive f_pack f_module dir pack = o
begin try
begin match PMap.find file com.package_rules with
| Forbidden | Remap _ -> ()
| _ -> raise Not_found
end
with Not_found ->
f_pack (List.rev pack,file);
Expand Down
1 change: 0 additions & 1 deletion src/macro/macroApi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ and encode_exceptions_config ec =
and encode_package_rule pr =
let tag, pl = match pr with
| Forbidden -> 0, []
| Directory (path) -> 1, [encode_string path]
| Remap (path) -> 2, [encode_string path]
in
encode_enum ~pos:None IPackageRule tag pl
Expand Down
9 changes: 2 additions & 7 deletions src/typing/typeloadParse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,20 @@ let parse_hook = ref parse_file

let resolve_module_file com m remap p =
let forbid = ref false in
let compose_path no_rename =
let compose_path =
(match m with
| [] , name -> name
| x :: l , name ->
let x = (try
match PMap.find x com.package_rules with
| Forbidden -> forbid := true; x
| Directory d -> if no_rename then x else d
| Remap d -> remap := d :: l; d
with Not_found -> x
) in
String.concat "/" (x :: l) ^ "/" ^ name
) ^ ".hx"
in
let file = try
Common.find_file com (compose_path false)
with Not_found ->
Common.find_file com (compose_path true)
in
let file = Common.find_file com compose_path in
let file = (match ExtString.String.lowercase (snd m) with
| "con" | "aux" | "prn" | "nul" | "com1" | "com2" | "com3" | "lpt1" | "lpt2" | "lpt3" when Sys.os_type = "Win32" ->
(* these names are reserved by the OS - old DOS legacy, such files cannot be easily created but are reported as visible *)
Expand Down

1 comment on commit 822dd87

@Simn
Copy link
Member Author

@Simn Simn commented on 822dd87 Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ncannasse Do you happen to remember for what this was used?

Please sign in to comment.