Skip to content

Commit 453c5d5

Browse files
committed
First few examples working.
No need for @as(unboxed) anymore. Move type defs around. Unify type definitions for untagged. Add handling of float. Add partial treatment of unknown. wip Clean up names of types. Rename: literal More renaming. rename: Block Handle unknown case. Add Object. Add typeof to body of switch. Complete classification of blocks. Check that the type def is in one of the forms allowed. Fix well-formedness test no other blocks when there's an unknown rename More renaming. Add specific function compile_untagged_cases Add support for array types. Simplify well-formedness check. Add Json example. And add built-in knowledge that Js.Dict.t is an object. Fix instanceof array. flip Fix compilation of unknown. Add untagged variant support to genType. Explore (un)marshaling binary data from the compiler dune build marshal_test.bc.js node ./_build/default/marshal_test.bc.js Explore (un)marshaling binary data from the compiler Expose caml_read_file_content Build up the example to counting elements in a list ``` ocaml gen_aaa.ml node jscomp/test/marshal_test.js ```
1 parent 2e7f5e3 commit 453c5d5

File tree

7 files changed

+30355
-1
lines changed

7 files changed

+30355
-1
lines changed

aaa.marshal

31 Bytes
Binary file not shown.

gen_aaa.ml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
let foo v =
2+
let s = Marshal.to_string v [Compat_32] in
3+
let ch = open_out_bin "aaa.marshal" in
4+
let () = output_string ch s in
5+
close_out ch
6+
7+
type r = {x: int; s: string}
8+
type v = A | B | C of (int * int) | D of int * int;;
9+
10+
(* foo "abc";; *)
11+
(* foo {x = 3; s = "abc"};; *)
12+
(* foo A;; *)
13+
(* foo B;; *)
14+
(* foo (C (1, 2));; *)
15+
(* foo (D (1, 2));; *)
16+
foo [1;2;3;4;5]

jscomp/test/build.ninja

Lines changed: 2 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)