Skip to content

Commit 3a80f88

Browse files
committed
Make the extension compilable with latest ocaml.
1 parent b6abf10 commit 3a80f88

13 files changed

+164
-790
lines changed

analysis/vendor/ext/bsb_db.ml

-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ type info =
3131
| Impl
3232
| Impl_intf
3333

34-
type syntax_kind = Ml | Res
3534

3635
type module_info = {
3736
mutable info : info;
3837
dir : string;
39-
syntax_kind : syntax_kind;
4038
case : bool;
4139
name_sans_extension : string;
4240
}

analysis/vendor/ext/bsb_db.mli

-6
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,10 @@ type info =
3737
| Impl
3838
| Impl_intf
3939

40-
type syntax_kind = Ml | Res
4140

4241
type module_info = {
4342
mutable info : info;
4443
dir : string;
45-
syntax_kind : syntax_kind;
46-
(* This is actually not stored in bsbuild meta info
47-
since creating .d file only emit .cmj/.cmi dependencies, so it does not
48-
need know which syntax it is written
49-
*)
5044
case : bool;
5145
name_sans_extension : string;
5246
}

analysis/vendor/ext/ext_buffer.mli

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ val clear : t -> unit
5151
(** Empty the buffer. *)
5252

5353
val add_char : t -> char -> unit
54-
[@@inline]
5554
(** [add_char b c] appends the character [c] at the end of the buffer [b]. *)
5655

5756
val add_string : t -> string -> unit

analysis/vendor/ext/ext_file_extensions.ml

-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
type valid_input =
2-
| Ml
3-
| Mli
42
| Res
53
| Resi
64
| Intf_ast
@@ -16,8 +14,6 @@ type valid_input =
1614

1715
let classify_input ext =
1816
match () with
19-
| _ when ext = Literals.suffix_ml -> Ml
20-
| _ when ext = !Config.interface_suffix -> Mli
2117
| _ when ext = Literals.suffix_ast -> Impl_ast
2218
| _ when ext = Literals.suffix_iast -> Intf_ast
2319
| _ when ext = Literals.suffix_mlmap -> Mlmap

analysis/vendor/ext/ext_ident.ml

+4-14
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525

26-
27-
28-
29-
30-
31-
3226
let js_flag = 0b1_000 (* check with ocaml compiler *)
3327

3428
(* let js_module_flag = 0b10_000 (\* javascript external modules *\) *)
@@ -172,18 +166,14 @@ let name_mangle name =
172166
Ext_buffer.add_string buffer (convert ~op:(i=0) c)
173167
done; Ext_buffer.contents buffer
174168

175-
(* TODO:
176-
check name conflicts with javascript conventions
177-
{[
178-
Ext_ident.convert "^";;
179-
- : string = "$caret"
180-
]}
181-
[convert name] if [name] is a js keyword,add "$$"
169+
(**
170+
[convert name] if [name] is a js keyword or js global, add "$$"
182171
otherwise do the name mangling to make sure ocaml identifier it is
183172
a valid js identifier
184173
*)
185174
let convert (name : string) =
186-
if Js_reserved_map.is_reserved name then
175+
let name = unwrap_uppercase_exotic name in
176+
if Js_reserved_map.is_js_keyword name || Js_reserved_map.is_js_global name then
187177
"$$" ^ name
188178
else name_mangle name
189179

0 commit comments

Comments
 (0)