Skip to content

Commit

Permalink
ocamlformat
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon committed Sep 13, 2024
1 parent b2ab3a2 commit dd01986
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 32 deletions.
11 changes: 3 additions & 8 deletions compiler/bin-wasm_of_ocaml/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,12 @@ let run
| None -> `Fst name)
in
let t1 = Timer.make () in
let builtin = [Js_of_ocaml_compiler_runtime_files.jslib_js_of_ocaml] @ builtin in
let builtin = [ Js_of_ocaml_compiler_runtime_files.jslib_js_of_ocaml ] @ builtin in
List.iter builtin ~f:(fun t ->
let filename = Builtins.File.name t in
let runtimes = Linker.Fragment.parse_builtin t in
Linker.load_fragments
~target_env:Target_env.Isomorphic
~filename
runtimes);
Linker.load_files
~target_env:Target_env.Isomorphic
runtime_js_files;
Linker.load_fragments ~target_env:Target_env.Isomorphic ~filename runtimes);
Linker.load_files ~target_env:Target_env.Isomorphic runtime_js_files;
Linker.check_deps ();
if times () then Format.eprintf " parsing js: %a@." Timer.print t1;
if times () then Format.eprintf "Start parsing...@.";
Expand Down
17 changes: 6 additions & 11 deletions compiler/lib/linker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ let load_fragment ~target_env ~filename (f : Fragment.t) =
filename;
if always
then (
always_included :=
{ ar_filename = filename; ar_program = code; ar_requires = requires }
:: !always_included;
always_included :=
{ ar_filename = filename; ar_program = code; ar_requires = requires }
:: !always_included;
`Ok)
else
error
Expand Down Expand Up @@ -588,22 +588,17 @@ let check_deps () =

let load_file ~target_env filename =
List.iter (Fragment.parse_file filename) ~f:(fun frag ->
let (`Ok | `Ignored) =
load_fragment ~target_env ~filename frag
in
let (`Ok | `Ignored) = load_fragment ~target_env ~filename frag in
())

let load_fragments ~target_env ~filename l =
List.iter l ~f:(fun frag ->
let (`Ok | `Ignored) =
load_fragment ~target_env ~filename frag
in
let (`Ok | `Ignored) = load_fragment ~target_env ~filename frag in
());
check_deps ()

let load_files ~target_env l =
List.iter l ~f:(fun filename ->
load_file ~target_env filename);
List.iter l ~f:(fun filename -> load_file ~target_env filename);
check_deps ()

(* resolve *)
Expand Down
11 changes: 3 additions & 8 deletions compiler/lib/linker.mli
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,9 @@ end

val reset : unit -> unit

val load_files :
target_env:Target_env.t -> string list -> unit

val load_fragments :
target_env:Target_env.t
-> filename:string
-> Fragment.t list
-> unit
val load_files : target_env:Target_env.t -> string list -> unit

val load_fragments : target_env:Target_env.t -> filename:string -> Fragment.t list -> unit

val check_deps : unit -> unit

Expand Down
7 changes: 4 additions & 3 deletions compiler/lib/source_map.ml
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,10 @@ let json ?replace_mappings t =
; "names", `List (List.map t.names ~f:(fun s -> stringlit s))
; "sources", `List (List.map t.sources ~f:(fun s -> stringlit (rewrite_path s)))
; ( "mappings"
, stringlit (match replace_mappings with
| None -> string_of_mapping t.mappings
| Some m -> m) )
, stringlit
(match replace_mappings with
| None -> string_of_mapping t.mappings
| Some m -> m) )
; ( "sourcesContent"
, `List
(match t.sources_content with
Expand Down
2 changes: 1 addition & 1 deletion lib/js_of_ocaml/typed_array.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class type arrayBufferView = object
end

class type ['a, 'b, 'c] typedArray = object
inherit arrayBufferView
inherit arrayBufferView

method _BYTES_PER_ELEMENT : int readonly_prop

Expand Down
2 changes: 1 addition & 1 deletion lib/js_of_ocaml/typed_array.mli
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class type arrayBufferView = object
end

class type ['a, 'b, 'c] typedArray = object
inherit arrayBufferView
inherit arrayBufferView

method _BYTES_PER_ELEMENT : int readonly_prop

Expand Down

0 comments on commit dd01986

Please sign in to comment.