Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f4684b2
Remove unused constants from Literals
cristianoc Oct 2, 2026
7365c27
Remove unused functions from ext utility modules
cristianoc Oct 2, 2026
f4fd6f0
Remove unused functions from Misc
cristianoc Oct 2, 2026
e169ec1
Remove unused members of Identifiable
cristianoc Oct 2, 2026
eca881b
Remove unused operations from Ordered_hash_map
cristianoc Oct 2, 2026
74cf1a2
Remove unused operations from the ext map and set functors
cristianoc Oct 2, 2026
15f5392
Fix the cmt_magic_number comment in Config
cristianoc Oct 2, 2026
0190852
Remove the unused Bs_loc.merge
cristianoc Oct 2, 2026
82376d0
Fix stale comments in the common library
cristianoc Oct 2, 2026
3dc9f2e
Describe the actual -bs-ast file format in Binary_ast
cristianoc Oct 2, 2026
eefa2e2
Remove the unused -annot type-annotation dump
cristianoc Oct 2, 2026
747217e
Remove the unused in-process ppx driver from Ast_mapper
cristianoc Oct 2, 2026
3dc357c
Remove unused definitions from the type checker modules
cristianoc Oct 2, 2026
df7fe31
Fix stale comments in type checker modules
cristianoc Oct 2, 2026
c8320e5
Replace Bs_loc.t with Location.t and delete Bs_loc
cristianoc Oct 2, 2026
e15397f
Remove unused definitions from the ext library
cristianoc Oct 2, 2026
8816198
Remove unused definitions from the ml library
cristianoc Oct 2, 2026
4680548
Record used attributes in a Hash_set.Make instance
cristianoc Oct 2, 2026
64fcda9
Split the last list element with Ext_list.split_at_last
cristianoc Oct 2, 2026
da0e31a
Define Ext_option.map and iter by Stdlib.Option
cristianoc Oct 2, 2026
49efa3a
Derive Ml_binary.magic_of_ast0 from magic_of_kind
cristianoc Oct 2, 2026
5e78877
Narrow ext interfaces to the values other modules use
cristianoc Oct 2, 2026
6619020
Narrow ml interfaces to the values other modules use
cristianoc Oct 2, 2026
5592005
Narrow Ident's interface to the values other modules use
cristianoc Oct 2, 2026
3df9a31
Name existing functions in compiler internal-error messages
cristianoc Oct 2, 2026
caf79fa
Name current definitions in ext comments
cristianoc Oct 2, 2026
de87363
Name current definitions in ml comments
cristianoc Oct 2, 2026
afe9555
Remove the unused raw type printer
cristianoc Oct 2, 2026
c8d2bec
Describe Ast_mapper as the in-compiler mapper and the -ppx protocol
cristianoc Oct 2, 2026
edfff5a
Expose raw type printer through -draw-coercions
cristianoc Oct 3, 2026
297c884
Expose dump_coercions in Clflags interface
cristianoc Oct 3, 2026
10790a1
Print coercions in the live apply_coercion path
cristianoc Oct 3, 2026
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
3 changes: 3 additions & 0 deletions compiler/bsc/rescript_compiler_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ let command_line_flags : (string * Bsc_args.spec * string) array =
("-dtypedtree", set Clflags.dump_typedtree, "*internal* debug typedtree");
("-dparsetree", set Clflags.dump_parsetree, "*internal* debug parsetree");
("-drawlambda", set Clflags.dump_rawlambda, "*internal* debug raw lambda");
( "-draw-coercions",
set Clflags.dump_coercions,
"*internal* debug module coercions with raw internal types" );
("-dsource", set Clflags.dump_source, "*internal* print source");
( "-reprint-source",
string_call reprint_source_file,
Expand Down
41 changes: 0 additions & 41 deletions compiler/common/bs_loc.ml

This file was deleted.

33 changes: 0 additions & 33 deletions compiler/common/bs_loc.mli

This file was deleted.

5 changes: 3 additions & 2 deletions compiler/common/ext_log.mli
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
(** A Poor man's logging utility
Example:
{[
err __LOC__ "xx"
{[
dwarn ~__POS__ "unexpected %s" name
]}
prints a warning to stderr when [-debug-ir] is set.
*)

type 'a logging = ('a, Format.formatter, unit, unit, unit, unit) format6 -> 'a
Expand Down
6 changes: 0 additions & 6 deletions compiler/common/js_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)

(** Browser is not set via command line only for internal use *)

type jsx_version = Jsx_v4
type jsx_module = React | Generic of {module_name: string}
type source_map = No_source_map | Linked | Inline | Hidden
Expand All @@ -35,10 +33,6 @@ let cross_module_inline = ref false
let debug_ir = ref false
let check_lam = ref false

(* let (//) = Filename.concat *)

(* let get_packages_info () = !packages_info *)

let no_builtin_ppx = ref false
let tool_name = "ReScript"
let check_div_by_zero = ref true
Expand Down
14 changes: 0 additions & 14 deletions compiler/common/js_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,12 @@ type jsx_version = Jsx_v4
type jsx_module = React | Generic of {module_name: string}
type source_map = No_source_map | Linked | Inline | Hidden

(* val get_packages_info :
unit -> Js_packages_info.t *)

val no_version_header : bool ref
(** set/get header *)

val directives : string list ref
(** directives printed verbatims just after the version header *)

(** return [package_name] and [path]
when in script mode:
*)

(* val get_current_package_name_and_path :
Js_packages_info.module_system ->
Js_packages_info.info_query *)

(* val set_package_name : string -> unit
val get_package_name : unit -> string option *)

val cross_module_inline : bool ref
(** cross module inline option *)

Expand Down
12 changes: 6 additions & 6 deletions compiler/common/ml_binary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ type _ kind = Ml : Parsetree.structure kind | Mli : Parsetree.signature kind

type ast0 = Impl of Parsetree0.structure | Intf of Parsetree0.signature

let magic_of_kind : type a. a kind -> string = function
| Ml -> Config.ast0_impl_magic_number
| Mli -> Config.ast0_intf_magic_number

let magic_of_ast0 : ast0 -> string = function
| Impl _ -> Config.ast0_impl_magic_number
| Intf _ -> Config.ast0_intf_magic_number
| Impl _ -> magic_of_kind Ml
| Intf _ -> magic_of_kind Mli

let to_ast0 : type a. a kind -> a -> ast0 =
fun kind ast ->
Expand Down Expand Up @@ -57,7 +61,3 @@ let ast0_roundtrip : type a. a kind -> a -> a =
match kind with
| Ml -> ast |> to_ast0 Ml |> ast0_to_structure
| Mli -> ast |> to_ast0 Mli |> ast0_to_signature

let magic_of_kind : type a. a kind -> string = function
| Ml -> Config.ast0_impl_magic_number
| Mli -> Config.ast0_intf_magic_number
5 changes: 2 additions & 3 deletions compiler/common/ml_binary.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)

(* This file was used to read reason ast
and part of parsing binary ast
*)
(* The kind (structure or signature) of an AST, and conversion between
Parsetree and the frozen Parsetree0 that PPX executables read and write *)
type _ kind = Ml : Parsetree.structure kind | Mli : Parsetree.signature kind

type ast0 = Impl of Parsetree0.structure | Intf of Parsetree0.signature
Expand Down
1 change: 0 additions & 1 deletion compiler/depends/binary_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)

module Set_string = Ast_extract.Set_string
(** Synced up with module {!Bsb_helper_depfile_gen} *)

type 'a kind = 'a Ml_binary.kind =
| Ml : Parsetree.structure kind
Expand Down
25 changes: 8 additions & 17 deletions compiler/depends/binary_ast.mli
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,12 @@ type _ kind = Ml : Parsetree.structure kind | Mli : Parsetree.signature kind

val read_ast_exn : fname:string -> 'a kind -> 'a

val magic_sep_char : char

val write_ast : sourcefile:string -> output:string -> 'a kind -> 'a -> unit
(**
Check out {!Bsb_depfile_gen} for set decoding
The [.ml] file can be recognized as an ast directly, the format
is
{
magic number;
filename;
ast
}
when [fname] is "-" it means the file is from an standard input or pipe.
An empty name would marshallized.

Use case cat - | fan -printer -impl -
redirect the standard input to fan
*)
(** [write_ast ~sourcefile ~output kind ast] writes to [output]:
- the length in bytes of the dependency block ([output_binary_int]);
- the dependency block: a newline, then each module name [ast] refers to
(predefined names excluded), each followed by a newline;
- [sourcefile] and a newline;
- the marshalled [ast].
[read_ast_exn] skips the dependency block; rewatch reads it in
[get_dep_modules] (rewatch/src/build/deps.rs). *)
2 changes: 1 addition & 1 deletion compiler/ext/config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ val ast0_impl_magic_number : string
tree, as used on the external-PPX wire *)

val cmt_magic_number : string
(* Magic number for compiled interface files *)
(* Magic number for typed-tree files (.cmt, .cmti) *)
47 changes: 0 additions & 47 deletions compiler/ext/ext_array.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ let reverse_range a i len =
a.!(i + len - 1 - k) <- t
done

let reverse_in_place a = reverse_range a 0 (Array.length a)

let reverse a =
let b_len = Array.length a in
if b_len = 0 then [||]
Expand All @@ -60,49 +58,6 @@ let reverse_of_list = function
in
fill (len - 1) tl

let filter a f =
let arr_len = Array.length a in
let rec aux acc i =
if i = arr_len then reverse_of_list acc
else
let v = Array.unsafe_get a i in
if f v then aux (v :: acc) (i + 1) else aux acc (i + 1)
in
aux [] 0

let filter_map a (f : _ -> _ option) =
let arr_len = Array.length a in
let rec aux acc i =
if i = arr_len then reverse_of_list acc
else
let v = Array.unsafe_get a i in
match f v with
| Some v -> aux (v :: acc) (i + 1)
| None -> aux acc (i + 1)
in
aux [] 0

let filter_mapi a (f : _ -> _ -> _ option) =
let arr_len = Array.length a in
let rec aux acc i =
if i = arr_len then reverse_of_list acc
else
let v = Array.unsafe_get a i in
match f i v with
| Some v -> aux (v :: acc) (i + 1)
| None -> aux acc (i + 1)
in
aux [] 0

let range from to_ =
if from > to_ then invalid_arg "Ext_array.range"
else Array.init (to_ - from + 1) (fun i -> i + from)

let map2i f a b =
let len = Array.length a in
if len <> Array.length b then invalid_arg "Ext_array.map2i"
else Array.mapi (fun i a -> f i a (Array.unsafe_get b i)) a

let rec tolist_f_aux a f i res =
if i < 0 then res
else
Expand Down Expand Up @@ -197,8 +152,6 @@ let exists a p =
in
loop 0

let is_empty arr = Array.length arr = 0

let rec unsafe_loop index len p xs ys =
if index >= len then true
else
Expand Down
14 changes: 0 additions & 14 deletions compiler/ext/ext_array.mli
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,10 @@
val reverse_range : 'a array -> int -> int -> unit
(** Some utilities for {!Array} operations *)

val reverse_in_place : 'a array -> unit

val reverse : 'a array -> 'a array

val reverse_of_list : 'a list -> 'a array

val filter : 'a array -> ('a -> bool) -> 'a array

val filter_map : 'a array -> ('a -> 'b option) -> 'b array

val filter_mapi : 'a array -> (int -> 'a -> 'b option) -> 'b array

val range : int -> int -> int array

val map2i : (int -> 'a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

val to_list_f : 'a array -> ('a -> 'b) -> 'b list

val to_list_map_acc : 'a array -> 'b list -> ('a -> 'b option) -> 'b list
Expand All @@ -53,8 +41,6 @@ val find_and_split : 'a array -> ('a -> 'b -> bool) -> 'b -> 'a split

val exists : 'a array -> ('a -> bool) -> bool

val is_empty : 'a array -> bool

val for_all2_no_exn : 'a array -> 'b array -> ('a -> 'b -> bool) -> bool

val for_alli : 'a array -> (int -> 'a -> bool) -> bool
Expand Down
2 changes: 0 additions & 2 deletions compiler/ext/ext_buffer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ let length b = b.position

let is_empty b = b.position = 0

let clear b = b.position <- 0

(* let reset b =
b.position <- 0; b.buffer <- b.initial_buffer;
b.length <- Bytes.length b.buffer *)
Expand Down
3 changes: 0 additions & 3 deletions compiler/ext/ext_buffer.mli
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ val length : t -> int

val is_empty : t -> bool

val clear : t -> unit
(** Empty the buffer. *)

val add_char : t -> char -> unit
(** [add_char b c] appends the character [c] at the end of the buffer [b]. *)

Expand Down
9 changes: 0 additions & 9 deletions compiler/ext/ext_char.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)

(** {!Char.escaped} is locale sensitive in 4.02.3, fixed in the trunk,
backport it here
*)

let valid_hex x =
match x with
| '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' -> true
| _ -> false

let is_lower_case c =
(c >= 'a' && c <= 'z')
|| (c >= '\224' && c <= '\246')
Expand Down
2 changes: 0 additions & 2 deletions compiler/ext/ext_char.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@

(** Extension to Standard char module, avoid locale sensitivity *)

val valid_hex : char -> bool

val is_lower_case : char -> bool
2 changes: 0 additions & 2 deletions compiler/ext/ext_fmt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ let with_file_as_pp filename f =
v)

let failwithf ~loc fmt = Format.ksprintf (fun s -> failwith (loc ^ s)) fmt

let invalid_argf fmt = Format.ksprintf invalid_arg fmt
2 changes: 0 additions & 2 deletions compiler/ext/ext_ident.mli
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ val create_tmp : ?name:string -> unit -> Ident.t

val is_uident : string -> bool

val is_uppercase_exotic : string -> bool

val unwrap_uppercase_exotic : string -> string

val convert : string -> string
Expand Down
Loading
Loading