Skip to content

Commit 0247cce

Browse files
authored
Update the compiler libs with those from the compiler. (#744)
* Update the compiler libs with those from the compiler. So we have a single copy around. Also, a prerequisite to update the vendored parser. * Install cppo in CI * No need to wrap ext. * No need to wrap Ml. * Remove the two remaining wrapped libraries.
1 parent 1029028 commit 0247cce

File tree

385 files changed

+43625
-34354
lines changed

Some content is hidden

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

385 files changed

+43625
-34354
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
node-version: 16
5656

5757
- run: npm ci
58-
- run: opam install dune
58+
- run: opam install dune cppo
5959
- run: npm run compile
6060

6161
# These 2 runs (or just the second?) are for when you have opam dependencies. We don't.

analysis/dune

+15
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
11
(dirs src reanalyze vendor)
2+
3+
(env
4+
(dev
5+
(env-vars
6+
(CPPO_FLAGS -U=RELEASE)))
7+
(release
8+
(env-vars
9+
(CPPO_FLAGS -D=RELEASE))
10+
(ocamlopt_flags
11+
(:standard -O3 -unbox-closures)))
12+
(static
13+
(env-vars
14+
(CPPO_FLAGS -D=RELEASE))
15+
(ocamlopt_flags
16+
(:standard -O3 -unbox-closures))))

analysis/dune-project

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(lang dune 2.0)
1+
(lang dune 2.3)
22

33
(generate_opam_files true)
44

@@ -18,6 +18,8 @@
1818
(>= 4.10))
1919
(ocamlformat
2020
(= 0.22.4))
21+
(cppo
22+
(= 1.6.9))
2123
(reanalyze
2224
(= 2.23.0))
2325
dune))

analysis/reanalyze/src/Paths.ml

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
open Common
2-
module StringMap = Ext_json_types.StringMap
2+
module StringMap = Map_string
33

44
let bsconfig = "bsconfig.json"
55

@@ -138,19 +138,19 @@ let readDirsFromConfig ~configSources =
138138
in
139139
let rec processSourceItem (sourceItem : Ext_json_types.t) =
140140
match sourceItem with
141-
| Str str -> str |> processDir ~subdirs:false
142-
| Obj map -> (
143-
match map |> StringMap.find_opt "dir" with
144-
| Some (Str str) ->
141+
| Str {str} -> str |> processDir ~subdirs:false
142+
| Obj {map} -> (
143+
match StringMap.find_opt map "dir" with
144+
| Some (Str {str}) ->
145145
let subdirs =
146-
match map |> StringMap.find_opt "subdirs" with
146+
match StringMap.find_opt map "subdirs" with
147147
| Some (True _) -> true
148148
| Some (False _) -> false
149149
| _ -> false
150150
in
151151
str |> processDir ~subdirs
152152
| _ -> ())
153-
| Arr arr -> arr |> Array.iter processSourceItem
153+
| Arr {content = arr} -> arr |> Array.iter processSourceItem
154154
| _ -> ()
155155
in
156156
(match configSources with
@@ -166,13 +166,13 @@ let readSourceDirs ~configSources =
166166
let dirs = ref [] in
167167
let readDirs json =
168168
match json with
169-
| Ext_json_types.Obj map -> (
170-
match map |> StringMap.find_opt "dirs" with
171-
| Some (Arr arr) ->
169+
| Ext_json_types.Obj {map} -> (
170+
match StringMap.find_opt map "dirs" with
171+
| Some (Arr {content = arr}) ->
172172
arr
173173
|> Array.iter (fun x ->
174174
match x with
175-
| Ext_json_types.Str str -> dirs := str :: !dirs
175+
| Ext_json_types.Str {str} -> dirs := str :: !dirs
176176
| _ -> ());
177177
()
178178
| _ -> ())
@@ -181,12 +181,12 @@ let readSourceDirs ~configSources =
181181
if sourceDirs |> Sys.file_exists then
182182
let jsonOpt = sourceDirs |> Ext_json_parse.parse_json_from_file in
183183
match jsonOpt with
184-
| Some json ->
184+
| exception _ -> ()
185+
| json ->
185186
if runConfig.bsbProjectRoot <> runConfig.projectRoot then (
186187
readDirs json;
187188
dirs := readDirsFromConfig ~configSources)
188189
else readDirs json
189-
| None -> ()
190190
else (
191191
if !Cli.debug then (
192192
Log_.item "Warning: can't find source dirs: %s\n" sourceDirs;

analysis/reanalyze/src/dune

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
(library
22
(name reanalyze)
33
(flags
4-
(-w "+6+26+27+32+33+39")
5-
(-open Compilerlibs406)
6-
(-open Jsonlib)
7-
(-open Ext))
8-
(libraries compilerlibs406 jsonlib ext str unix))
4+
(-w "+6+26+27+32+33+39"))
5+
(libraries jsonlib ext ml str unix))

analysis/rescript-vscode.opam

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ bug-reports: "https://github.com/rescript-lang/rescript-vscode/issues"
88
depends: [
99
"ocaml" {>= "4.10"}
1010
"ocamlformat" {= "0.22.4"}
11+
"cppo" {= "1.6.9"}
1112
"reanalyze" {= "2.23.0"}
1213
"dune"
1314
]

analysis/src/DumpAst.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ let printAttributes attributes =
4242
let printConstant const =
4343
match const with
4444
| Parsetree.Pconst_integer (s, _) -> "Pconst_integer(" ^ s ^ ")"
45-
| Pconst_char c -> "Pconst_char(" ^ String.make 1 c ^ ")"
45+
| Pconst_char c -> "Pconst_char(" ^ String.make 1 (Char.chr c) ^ ")"
4646
| Pconst_string (s, delim) ->
4747
let delim =
4848
match delim with
@@ -312,4 +312,4 @@ let dump ~currentFile ~pos =
312312
print_endline
313313
(structure
314314
|> List.map (fun structItem -> printStructItem structItem ~pos ~source)
315-
|> String.concat "")
315+
|> String.concat "")

analysis/src/dune

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
; The main module that will become the binary.
55
(name Cli)
66
(flags
7-
(-w "+6+26+27+32+33+39")
8-
(-open Compilerlibs406)
9-
(-open Jsonlib)
10-
(-open Outcomeprinter))
7+
(-w "+6+26+27+32+33+39"))
118
; Depends on:
12-
(libraries unix str compilerlibs406 jsonlib outcomeprinter reanalyze))
9+
(libraries unix str ext ml jsonlib outcomeprinter reanalyze))

analysis/vendor/compiler-libs-406/arg_helper.ml

-127
This file was deleted.

analysis/vendor/compiler-libs-406/arg_helper.mli

-63
This file was deleted.

0 commit comments

Comments
 (0)