Skip to content

Commit 19562b2

Browse files
authored
update everything vendored from the compiler (#827)
1 parent 5c05b17 commit 19562b2

File tree

103 files changed

+35960
-532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+35960
-532
lines changed

analysis/vendor/dune

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(dirs ext ml res_syntax json)
1+
(dirs ext ml res_syntax json js_parser)

analysis/vendor/ext/ext_path.ml

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(* Copyright (C) 2017 Hongbo Zhang, Authors of ReScript
2-
*
2+
*
33
* This program is free software: you can redistribute it and/or modify
44
* it under the terms of the GNU Lesser General Public License as published by
55
* the Free Software Foundation, either version 3 of the License, or
@@ -17,7 +17,7 @@
1717
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1818
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1919
* GNU Lesser General Public License for more details.
20-
*
20+
*
2121
* You should have received a copy of the GNU Lesser General Public License
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
@@ -43,18 +43,18 @@ let split_by_sep_per_os : string -> string list =
4343

4444
(** example
4545
{[
46-
"/bb/mbigc/mbig2899/bgit/bucklescript/jscomp/stdlib/external/pervasives.cmj"
47-
"/bb/mbigc/mbig2899/bgit/bucklescript/jscomp/stdlib/ocaml_array.ml"
46+
"/bb/mbigc/mbig2899/bgit/rescript/jscomp/stdlib/external/pervasives.cmj"
47+
"/bb/mbigc/mbig2899/bgit/rescript/jscomp/stdlib/ocaml_array.ml"
4848
]}
4949
5050
The other way
5151
{[
5252
53-
"/bb/mbigc/mbig2899/bgit/bucklescript/jscomp/stdlib/ocaml_array.ml"
54-
"/bb/mbigc/mbig2899/bgit/bucklescript/jscomp/stdlib/external/pervasives.cmj"
53+
"/bb/mbigc/mbig2899/bgit/rescript/jscomp/stdlib/ocaml_array.ml"
54+
"/bb/mbigc/mbig2899/bgit/rescript/jscomp/stdlib/external/pervasives.cmj"
5555
]}
5656
{[
57-
"/bb/mbigc/mbig2899/bgit/bucklescript/jscomp/stdlib//ocaml_array.ml"
57+
"/bb/mbigc/mbig2899/bgit/rescript/jscomp/stdlib//ocaml_array.ml"
5858
]}
5959
{[
6060
/a/b
@@ -117,7 +117,7 @@ let ( // ) x y =
117117
split_aux "//ghosg//ghsogh/";;
118118
- : string * string list = ("/", ["ghosg"; "ghsogh"])
119119
]}
120-
Note that
120+
Note that
121121
{[
122122
Filename.dirname "/a/" = "/"
123123
Filename.dirname "/a/b/" = Filename.dirname "/a/b" = "/a"
@@ -132,7 +132,7 @@ let ( // ) x y =
132132
basename "" = "."
133133
dirname "" = "."
134134
dirname "" = "."
135-
]}
135+
]}
136136
*)
137137
let split_aux p =
138138
let rec go p acc =
@@ -149,11 +149,11 @@ let split_aux p =
149149

150150
go p []
151151

152-
(**
152+
(**
153153
TODO: optimization
154-
if [from] and [to] resolve to the same path, a zero-length string is returned
154+
if [from] and [to] resolve to the same path, a zero-length string is returned
155155
156-
This function is useed in [es6-global] and
156+
This function is useed in [es6-global] and
157157
[amdjs-global] format and tailored for `rollup`
158158
*)
159159
let rel_normalized_absolute_path ~from to_ =
@@ -261,14 +261,17 @@ let concat dirname filename =
261261
let check_suffix_case = Ext_string.ends_with
262262

263263
(* Input must be absolute directory *)
264-
let rec find_root_filename ~cwd filename =
265-
if Sys.file_exists (Filename.concat cwd filename) then cwd
264+
let rec find_root_filename ~cwd filenames =
265+
let file_exists = Ext_list.exists filenames (fun filename ->
266+
Sys.file_exists (Filename.concat cwd filename))
267+
in
268+
if file_exists then cwd
266269
else
267270
let cwd' = Filename.dirname cwd in
268271
if String.length cwd' < String.length cwd then
269-
find_root_filename ~cwd:cwd' filename
270-
else Ext_fmt.failwithf ~loc:__LOC__ "%s not found from %s" filename cwd
272+
find_root_filename ~cwd:cwd' filenames
273+
else Ext_fmt.failwithf ~loc:__LOC__ "%s not found from %s" (List.hd filenames) cwd
271274

272-
let find_package_json_dir cwd = find_root_filename ~cwd Literals.bsconfig_json
275+
let find_config_dir cwd = find_root_filename ~cwd [Literals.rescript_json; Literals.bsconfig_json]
273276

274-
let package_dir = lazy (find_package_json_dir (Lazy.force cwd))
277+
let package_dir = lazy (find_config_dir (Lazy.force cwd))

analysis/vendor/ext/ext_path.mli

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(* Copyright (C) 2017 Authors of ReScript
2-
*
2+
*
33
* This program is free software: you can redistribute it and/or modify
44
* it under the terms of the GNU Lesser General Public License as published by
55
* the Free Software Foundation, either version 3 of the License, or
@@ -17,19 +17,19 @@
1717
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1818
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1919
* GNU Lesser General Public License for more details.
20-
*
20+
*
2121
* You should have received a copy of the GNU Lesser General Public License
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525
type t
2626

2727
val simple_convert_node_path_to_os_path : string -> string
28-
(** Js_output is node style, which means
28+
(** Js_output is node style, which means
2929
separator is only '/'
3030
31-
if the path contains 'node_modules',
32-
[node_relative_path] will discard its prefix and
31+
if the path contains 'node_modules',
32+
[node_relative_path] will discard its prefix and
3333
just treat it as a library instead
3434
*)
3535

@@ -50,14 +50,14 @@ val combine : string -> string -> string
5050
val node_rebase_file : from:string -> to_:string -> string -> string
5151

5252
val rel_normalized_absolute_path : from:string -> string -> string
53-
(**
53+
(**
5454
TODO: could be highly optimized
55-
if [from] and [to] resolve to the same path, a zero-length string is returned
55+
if [from] and [to] resolve to the same path, a zero-length string is returned
5656
Given that two paths are directory
5757
58-
A typical use case is
58+
A typical use case is
5959
{[
60-
Filename.concat
60+
Filename.concat
6161
(rel_normalized_absolute_path cwd (Filename.dirname a))
6262
(Filename.basename a)
6363
]}
@@ -69,7 +69,7 @@ val absolute_cwd_path : string -> string
6969

7070
val concat : string -> string -> string
7171
(** [concat dirname filename]
72-
The same as {!Filename.concat} except a tiny optimization
72+
The same as {!Filename.concat} except a tiny optimization
7373
for current directory simplification
7474
*)
7575

0 commit comments

Comments
 (0)