From e63b391cf00983725e7a78ff490d80282d804a6d Mon Sep 17 00:00:00 2001 From: Hongbo Zhang Date: Thu, 14 May 2020 13:50:23 +0800 Subject: [PATCH 1/2] tweak a little bit change string based into bool based --- jscomp/core/lam_convert.ml | 8 ++--- jscomp/runtime/release.ninja | 6 ++-- jscomp/stdlib-406/camlinternalLazy.ml | 15 +++++---- jscomp/test/build.ninja | 1 + jscomp/test/ext_filename_test.js | 4 +-- jscomp/test/gpr_3697_test.js | 2 +- jscomp/test/hamming_test.js | 12 +++---- jscomp/test/lazy_demo.js | 30 +++++++++++++++++ jscomp/test/lazy_demo.re | 12 +++++++ jscomp/test/lazy_test.js | 42 ++++++++++++------------ jscomp/test/mpr_6033_test.js | 2 +- jscomp/test/ocaml_parsetree_test.js | 4 +-- jscomp/test/ocaml_typedtree_test.js | 26 +++++++-------- jscomp/test/parser_api.js | 8 ++--- jscomp/test/rec_value_test.js | 4 +-- jscomp/test/recursive_module.js | 8 ++--- lib/4.06.1/unstable/js_compiler.ml | 12 +++---- lib/4.06.1/unstable/js_refmt_compiler.ml | 12 +++---- lib/4.06.1/whole_compiler.ml | 12 +++---- lib/es6/caml_module.js | 2 +- lib/es6/camlinternalLazy.js | 10 +++--- lib/es6/ephemeron.js | 14 ++++---- lib/es6/filename.js | 2 +- lib/es6/hashtbl.js | 2 +- lib/es6/lazy.js | 4 +-- lib/es6/stream.js | 8 ++--- lib/js/caml_module.js | 2 +- lib/js/camlinternalLazy.js | 10 +++--- lib/js/ephemeron.js | 14 ++++---- lib/js/filename.js | 2 +- lib/js/hashtbl.js | 2 +- lib/js/lazy.js | 4 +-- lib/js/stream.js | 8 ++--- 33 files changed, 172 insertions(+), 132 deletions(-) create mode 100644 jscomp/test/lazy_demo.js create mode 100644 jscomp/test/lazy_demo.re diff --git a/jscomp/core/lam_convert.ml b/jscomp/core/lam_convert.ml index 3eb164109ff..7bb51711cec 100644 --- a/jscomp/core/lam_convert.ml +++ b/jscomp/core/lam_convert.ml @@ -278,18 +278,18 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : Lam.t = begin match args with | [Lvar _ | Lconst _ | Lfunction _ as result ] -> let args = - [ Lam.const (Const_string "done") ; + [ Lam.const Const_js_true ; result ] in - prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY";"value"|],Mutable)) ~args loc + prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY_DONE";"value"|],Mutable)) ~args loc | [computation] -> let args = - [ Lam.const (Const_string "todo") ; + [ Lam.const Const_js_false ; (* FIXME: arity 0 does not get proper supported*) prim ~primitive:(Pjs_fn_make 0) ~args:[Lam.function_ ~arity:1 ~params:[Ident.create "param"] ~body:computation] loc ] in - prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY";"value"|],Mutable)) ~args loc + prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY_DONE";"value"|],Mutable)) ~args loc | _ -> assert false end diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja index d4ec04489b2..ecf1963c7ac 100644 --- a/jscomp/runtime/release.ninja +++ b/jscomp/runtime/release.ninja @@ -23,17 +23,17 @@ build runtime/caml_chrome_debugger.cmj : cc_cmi runtime/caml_chrome_debugger.ml build runtime/caml_chrome_debugger.cmi : cc runtime/caml_chrome_debugger.mli | runtime/bs_stdlib_mini.cmi runtime/caml_obj_extern.cmj runtime/js.cmi runtime/js.cmj build runtime/caml_float.cmj : cc_cmi runtime/caml_float.ml | runtime/caml_float.cmi runtime/caml_float_extern.cmj build runtime/caml_float.cmi : cc runtime/caml_float.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -build runtime/caml_format.cmj : cc_cmi runtime/caml_format.ml | runtime/caml_char.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int32.cmj runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj +build runtime/caml_format.cmj : cc_cmi runtime/caml_format.ml | runtime/caml_char.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj build runtime/caml_format.cmi : cc runtime/caml_format.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj build runtime/caml_gc.cmj : cc_cmi runtime/caml_gc.ml | runtime/caml_gc.cmi build runtime/caml_gc.cmi : cc runtime/caml_gc.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj build runtime/caml_hash.cmj : cc_cmi runtime/caml_hash.ml | runtime/caml_hash.cmi runtime/caml_hash_primitive.cmj runtime/caml_nativeint_extern.cmj runtime/caml_obj_extern.cmj runtime/js.cmj build runtime/caml_hash.cmi : cc runtime/caml_hash.mli | runtime/bs_stdlib_mini.cmi runtime/caml_obj_extern.cmj runtime/js.cmi runtime/js.cmj -build runtime/caml_hash_primitive.cmj : cc_cmi runtime/caml_hash_primitive.ml | runtime/caml_char.cmj runtime/caml_hash_primitive.cmi runtime/caml_int32.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj +build runtime/caml_hash_primitive.cmj : cc_cmi runtime/caml_hash_primitive.ml | runtime/caml_char.cmj runtime/caml_hash_primitive.cmi runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj build runtime/caml_hash_primitive.cmi : cc runtime/caml_hash_primitive.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj build runtime/caml_int32.cmj : cc_cmi runtime/caml_int32.ml | runtime/caml_int32.cmi runtime/caml_nativeint_extern.cmj build runtime/caml_int32.cmi : cc runtime/caml_int32.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -build runtime/caml_int64.cmj : cc_cmi runtime/caml_int64.ml | runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_nativeint_extern.cmj runtime/caml_primitive.cmj runtime/caml_string_extern.cmj runtime/js.cmj +build runtime/caml_int64.cmj : cc_cmi runtime/caml_int64.ml | runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_int64.cmi runtime/caml_nativeint_extern.cmj runtime/caml_primitive.cmj runtime/caml_string_extern.cmj runtime/js.cmj build runtime/caml_int64.cmi : cc runtime/caml_int64.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj build runtime/caml_io.cmj : cc_cmi runtime/caml_io.ml | runtime/caml_io.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmj runtime/curry.cmj runtime/js.cmj build runtime/caml_io.cmi : cc runtime/caml_io.mli | runtime/bs_stdlib_mini.cmi runtime/caml_undefined_extern.cmj runtime/js.cmi runtime/js.cmj diff --git a/jscomp/stdlib-406/camlinternalLazy.ml b/jscomp/stdlib-406/camlinternalLazy.ml index 8e20968bad0..fac5321c3e8 100644 --- a/jscomp/stdlib-406/camlinternalLazy.ml +++ b/jscomp/stdlib-406/camlinternalLazy.ml @@ -22,21 +22,22 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) - + [@@@bs.config { flags = [|"-bs-no-cross-module-opt" |]}] + (* Internals of forcing lazy values. *) type 'a t = { - mutable tag : string [@bs.as "RE_LAZY"] ; + mutable tag : bool [@bs.as "RE_LAZY_DONE"] ; (* Invariant: name *) mutable value : 'a (* its type is ['a] or [unit -> 'a ] *) } -let%private status_done = "done" (* used to be forward_tag in native *) + external%private fnToVal : (unit -> 'a [@bs]) -> 'a = "%identity" external%private valToFn : 'a -> (unit -> 'a [@bs]) = "%identity" external%private castToConcrete : 'a lazy_t -> 'a t = "%identity" let is_val (type a ) (l : a lazy_t) : bool = - ((castToConcrete l ).tag = status_done) + (castToConcrete l ).tag @@ -46,7 +47,7 @@ let%private forward_with_closure (type a ) (blk : a t) (closure : unit -> a [@bs let result = closure () [@bs] in (* do set_field BEFORE set_tag *) blk.value <- result; - blk.tag<- status_done; + blk.tag<- true; result @@ -73,7 +74,7 @@ let%private force_val_lazy_block (type a ) (blk : a t) : a = let force (type a ) (lzv : a lazy_t) : a = let lzv = (castToConcrete lzv : _ t) in - if lzv.tag = status_done then lzv.value else + if lzv.tag then lzv.value else force_lazy_block lzv @@ -81,7 +82,7 @@ let force (type a ) (lzv : a lazy_t) : a = let force_val (type a) (lzv : a lazy_t) : a = let lzv : _ t = castToConcrete lzv in - if lzv.tag = status_done then lzv.value else + if lzv.tag then lzv.value else force_val_lazy_block lzv diff --git a/jscomp/test/build.ninja b/jscomp/test/build.ninja index c5b2673c7e6..0e8e35b9c41 100644 --- a/jscomp/test/build.ninja +++ b/jscomp/test/build.ninja @@ -405,6 +405,7 @@ build test/label_uncurry.cmi test/label_uncurry.cmj : cc test/label_uncurry.ml | build test/large_obj_test.cmi test/large_obj_test.cmj : cc test/large_obj_test.ml | $stdlib build test/large_record_duplication_test.cmi test/large_record_duplication_test.cmj : cc test/large_record_duplication_test.ml | test/mt.cmj $stdlib build test/largest_int_flow.cmi test/largest_int_flow.cmj : cc test/largest_int_flow.ml | $stdlib +build test/lazy_demo.cmi test/lazy_demo.cmj : cc test/lazy_demo.re | $stdlib build test/lazy_test.cmi test/lazy_test.cmj : cc test/lazy_test.ml | test/mt.cmj $stdlib build test/lexer_test.cmi test/lexer_test.cmj : cc test/lexer_test.ml | test/arith_lexer.cmj test/arith_parser.cmj test/arith_syntax.cmj test/mt.cmj test/number_lexer.cmj $stdlib build test/lib_js_test.cmi test/lib_js_test.cmj : cc test/lib_js_test.ml | test/mt.cmj $stdlib diff --git a/jscomp/test/ext_filename_test.js b/jscomp/test/ext_filename_test.js index cf1e546363e..eabae891b5c 100644 --- a/jscomp/test/ext_filename_test.js +++ b/jscomp/test/ext_filename_test.js @@ -25,7 +25,7 @@ var node_parent = ".."; var node_current = "."; var cwd = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Caml_sys.caml_sys_getcwd(undefined); }) @@ -217,7 +217,7 @@ function find_package_json_dir(cwd) { } var package_dir = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { var cwd$1 = CamlinternalLazy.force(cwd); return find_root_filename(cwd$1, Test_literals.bsconfig_json); diff --git a/jscomp/test/gpr_3697_test.js b/jscomp/test/gpr_3697_test.js index d1c26300a1a..1dcfc1f4f86 100644 --- a/jscomp/test/gpr_3697_test.js +++ b/jscomp/test/gpr_3697_test.js @@ -4,7 +4,7 @@ var CamlinternalLazy = require("../../lib/js/camlinternalLazy.js"); function fix(param) { return /* Fix */[{ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return fix(undefined); }) diff --git a/jscomp/test/hamming_test.js b/jscomp/test/hamming_test.js index 634cfaaa0f5..8c9e1cc409c 100644 --- a/jscomp/test/hamming_test.js +++ b/jscomp/test/hamming_test.js @@ -119,7 +119,7 @@ function pr(param) { function map(f, l) { return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { var match = CamlinternalLazy.force(l); return /* Cons */[ @@ -132,7 +132,7 @@ function map(f, l) { function merge(cmp, l1, l2) { return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { var match = CamlinternalLazy.force(l1); var match$1 = CamlinternalLazy.force(l2); @@ -184,7 +184,7 @@ function iter_interval(f, _l, _param) { } var hamming = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return /* Cons */[ nn1, @@ -194,21 +194,21 @@ var hamming = { }; var ham2 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return CamlinternalLazy.force(map(x2, hamming)); }) }; var ham3 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return CamlinternalLazy.force(map(x3, hamming)); }) }; var ham5 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return CamlinternalLazy.force(map(x5, hamming)); }) diff --git a/jscomp/test/lazy_demo.js b/jscomp/test/lazy_demo.js new file mode 100644 index 00000000000..6e8cceb9ca4 --- /dev/null +++ b/jscomp/test/lazy_demo.js @@ -0,0 +1,30 @@ +'use strict'; + +var CamlinternalLazy = require("../../lib/js/camlinternalLazy.js"); + +var lazy1 = { + RE_LAZY_DONE: false, + value: (function () { + console.log("Hello, lazy"); + return 1; + }) +}; + +var lazy2 = { + RE_LAZY_DONE: true, + value: 3 +}; + +console.log(lazy1, lazy2); + +var la = CamlinternalLazy.force(lazy1); + +var lb = CamlinternalLazy.force(lazy2); + +console.log(la, lb); + +exports.lazy1 = lazy1; +exports.lazy2 = lazy2; +exports.la = la; +exports.lb = lb; +/* Not a pure module */ diff --git a/jscomp/test/lazy_demo.re b/jscomp/test/lazy_demo.re new file mode 100644 index 00000000000..1207041496c --- /dev/null +++ b/jscomp/test/lazy_demo.re @@ -0,0 +1,12 @@ +let lazy1 = lazy { + "Hello, lazy" -> Js.log; + 1 +}; + +let lazy2 = lazy 3 ; + +Js.log2 (lazy1, lazy2); + +let (lazy la, lazy lb) = (lazy1, lazy2); + +Js.log2 (la, lb); \ No newline at end of file diff --git a/jscomp/test/lazy_test.js b/jscomp/test/lazy_test.js index 7d8937fc87a..ae4fb6df654 100644 --- a/jscomp/test/lazy_test.js +++ b/jscomp/test/lazy_test.js @@ -11,7 +11,7 @@ var u = { }; var v = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { u.contents = 32; @@ -55,7 +55,7 @@ var s = { }; var set_true = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { s.contents = 1; @@ -63,7 +63,7 @@ var set_true = { }; var set_false = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { s.contents = undefined; @@ -93,7 +93,7 @@ var u_v = { }; var u$1 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { u_v.contents = 2; @@ -105,14 +105,14 @@ CamlinternalLazy.force(u$1); var exotic = CamlinternalLazy.force; var l_from_fun = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return 3; }) }; var forward_test = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { var u = 3; u = u + 1 | 0; @@ -121,12 +121,12 @@ var forward_test = { }; var f005 = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: 6 }; var f006 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return function (param) { return 3; @@ -135,7 +135,7 @@ var f006 = { }; var f007 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { throw { RE_EXN_ID: "Not_found", @@ -145,7 +145,7 @@ var f007 = { }; var f008 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { console.log("hi"); throw { @@ -157,28 +157,28 @@ var f008 = { function a2(x) { return { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: x }; } var a3 = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: 3 }; var a4 = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: 3 }; var a5 = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: undefined }; var a6 = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: undefined }; @@ -235,7 +235,7 @@ Mt.from_pair_suites("Lazy_test", /* :: */[ (function (param) { return /* Eq */Block.__(0, [ CamlinternalLazy.force({ - RE_LAZY: "done", + RE_LAZY_DONE: true, value: 3 }), 3 @@ -248,9 +248,9 @@ Mt.from_pair_suites("Lazy_test", /* :: */[ (function (param) { return /* Eq */Block.__(0, [ CamlinternalLazy.force(CamlinternalLazy.force({ - RE_LAZY: "done", + RE_LAZY_DONE: true, value: { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: 3 } })), @@ -265,7 +265,7 @@ Mt.from_pair_suites("Lazy_test", /* :: */[ debugger; return /* Eq */Block.__(0, [ CamlinternalLazy.force(CamlinternalLazy.force({ - RE_LAZY: "done", + RE_LAZY_DONE: true, value: forward_test })), 4 @@ -307,7 +307,7 @@ Mt.from_pair_suites("Lazy_test", /* :: */[ "File \"lazy_test.ml\", line 82, characters 0-7", (function (param) { return /* Ok */Block.__(4, [Lazy.is_val({ - RE_LAZY: "done", + RE_LAZY_DONE: true, value: 3 })]); }) @@ -317,7 +317,7 @@ Mt.from_pair_suites("Lazy_test", /* :: */[ "File \"lazy_test.ml\", line 83, characters 0-7", (function (param) { return /* Ok */Block.__(4, [!Lazy.is_val({ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { throw { RE_EXN_ID: "Not_found", diff --git a/jscomp/test/mpr_6033_test.js b/jscomp/test/mpr_6033_test.js index 78cb03dc585..4f9fbd7a55b 100644 --- a/jscomp/test/mpr_6033_test.js +++ b/jscomp/test/mpr_6033_test.js @@ -35,7 +35,7 @@ function f(x) { } var x = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: "def" }; diff --git a/jscomp/test/ocaml_parsetree_test.js b/jscomp/test/ocaml_parsetree_test.js index 05ab8b725c3..4cf5787e484 100644 --- a/jscomp/test/ocaml_parsetree_test.js +++ b/jscomp/test/ocaml_parsetree_test.js @@ -2421,7 +2421,7 @@ function symbol_docs_lazy(param) { var p1 = Parsing.symbol_start_pos(undefined); var p2 = Parsing.symbol_end_pos(undefined); return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return { docs_pre: get_pre_docs(p1), @@ -2444,7 +2444,7 @@ function mark_rhs_docs(pos1, pos2) { function symbol_text_lazy(param) { var pos = Parsing.symbol_start_pos(undefined); return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return get_text(pos); }) diff --git a/jscomp/test/ocaml_typedtree_test.js b/jscomp/test/ocaml_typedtree_test.js index 223aa846096..da35be54ad9 100644 --- a/jscomp/test/ocaml_typedtree_test.js +++ b/jscomp/test/ocaml_typedtree_test.js @@ -6661,7 +6661,7 @@ function symbol_docs_lazy(param) { var p1 = Parsing.symbol_start_pos(undefined); var p2 = Parsing.symbol_end_pos(undefined); return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return { docs_pre: get_pre_docs(p1), @@ -6684,7 +6684,7 @@ function mark_rhs_docs(pos1, pos2) { function symbol_text_lazy(param) { var pos = Parsing.symbol_start_pos(undefined); return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return get_text(pos); }) @@ -11991,7 +11991,7 @@ function prefix_idents_and_subst(root, sub, sg) { match[0], sub$1, { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return List.map((function (item) { switch (item.tag | 0) { @@ -26867,7 +26867,7 @@ function copy_sep(fixed, free, bound, visited, ty) { var t = newvar(undefined, undefined); delayed_copy.contents = /* :: */[ { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { t.desc = /* Tlink */Block.__(6, [copy(undefined, undefined, undefined, ty$1)]); @@ -69650,7 +69650,7 @@ function declare_method(val_env, meths, self_type, lab, priv, sty, loc) { var returned_cty = ctyp(/* Ttyp_any */0, newty2(current_level.contents, /* Tnil */0), val_env, loc); delayed_meth_specs.contents = /* :: */[ { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { var cty = transl_simple_type_univars(val_env, sty$prime); var ty = cty.ctyp_type; @@ -70211,7 +70211,7 @@ function class_structure(cl_num, $$final, val_env, met_env, loc, param) { match$3[2], /* :: */[ { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return mkcf(/* Tcf_inherit */Block.__(0, [ ovf, @@ -70309,7 +70309,7 @@ function class_structure(cl_num, $$final, val_env, met_env, loc, param) { match$7[3], /* :: */[ { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return mkcf(/* Tcf_val */Block.__(1, [ lab, @@ -70350,7 +70350,7 @@ function class_structure(cl_num, $$final, val_env, met_env, loc, param) { match$8[3], /* :: */[ { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return mkcf(/* Tcf_val */Block.__(1, [ lab, @@ -70494,7 +70494,7 @@ function class_structure(cl_num, $$final, val_env, met_env, loc, param) { var meth_expr = make_method(self_loc, cl_num, expr$2); var vars_local = vars.contents; var field = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { var meth_type = newty2(100000000, /* Tarrow */Block.__(1, [ "", @@ -70538,7 +70538,7 @@ function class_structure(cl_num, $$final, val_env, met_env, loc, param) { par_env, /* :: */[ { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return mkcf(/* Tcf_method */Block.__(2, [ lab$1, @@ -70566,7 +70566,7 @@ function class_structure(cl_num, $$final, val_env, met_env, loc, param) { par_env, /* :: */[ { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return mkcf(/* Tcf_constraint */Block.__(3, [ cty$2, @@ -70586,7 +70586,7 @@ function class_structure(cl_num, $$final, val_env, met_env, loc, param) { var expr$3 = make_method(self_loc, cl_num, expr[0]); var vars_local$1 = vars.contents; var field$1 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { raise_nongen_level(undefined); var desc_002 = instance_def(type_unit); @@ -70629,7 +70629,7 @@ function class_structure(cl_num, $$final, val_env, met_env, loc, param) { par_env, /* :: */[ { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return mkcf(/* Tcf_attribute */Block.__(5, [x])); }) diff --git a/jscomp/test/parser_api.js b/jscomp/test/parser_api.js index 0c28eac83ec..0636069584e 100644 --- a/jscomp/test/parser_api.js +++ b/jscomp/test/parser_api.js @@ -4442,7 +4442,7 @@ function symbol_docs_lazy(param) { var p1 = Parsing.symbol_start_pos(undefined); var p2 = Parsing.symbol_end_pos(undefined); return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return { docs_pre: get_pre_docs(p1), @@ -4463,7 +4463,7 @@ function rhs_docs_lazy(pos1, pos2) { var p1 = Parsing.rhs_start_pos(pos1); var p2 = Parsing.rhs_end_pos(pos2); return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return { docs_pre: get_pre_docs(p1), @@ -4498,7 +4498,7 @@ function symbol_text(param) { function symbol_text_lazy(param) { var pos = Parsing.symbol_start_pos(undefined); return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return get_text(pos); }) @@ -4512,7 +4512,7 @@ function rhs_text(pos) { function rhs_text_lazy(pos) { var pos$1 = Parsing.rhs_start_pos(pos); return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return get_text(pos$1); }) diff --git a/jscomp/test/rec_value_test.js b/jscomp/test/rec_value_test.js index 363cdd678f4..810959f77de 100644 --- a/jscomp/test/rec_value_test.js +++ b/jscomp/test/rec_value_test.js @@ -57,7 +57,7 @@ var three = { }; var h = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: fib }; @@ -148,7 +148,7 @@ function even2(_n) { } var lazy_v = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: (function (param) { CamlinternalLazy.force(lazy_v); diff --git a/jscomp/test/recursive_module.js b/jscomp/test/recursive_module.js index 56a4ad22c6f..81e3572edc2 100644 --- a/jscomp/test/recursive_module.js +++ b/jscomp/test/recursive_module.js @@ -60,7 +60,7 @@ var Intb = Caml_module.init_mod(/* tuple */[ ]]])); var a = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return CamlinternalLazy.force(Intb.a); }) @@ -74,7 +74,7 @@ Caml_module.update_mod(/* Module */Block.__(0, [[/* tuple */[ }); var a$1 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return CamlinternalLazy.force(Inta.a) + 1 | 0; }) @@ -122,7 +122,7 @@ var Intb$1 = Caml_module.init_mod(/* tuple */[ ]]])); var a$2 = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return CamlinternalLazy.force(Intb$1.a) + 1 | 0; }) @@ -136,7 +136,7 @@ Caml_module.update_mod(/* Module */Block.__(0, [[/* tuple */[ }); var a$3 = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: 2 }; diff --git a/lib/4.06.1/unstable/js_compiler.ml b/lib/4.06.1/unstable/js_compiler.ml index 0c65078412b..cd8b4f9508a 100644 --- a/lib/4.06.1/unstable/js_compiler.ml +++ b/lib/4.06.1/unstable/js_compiler.ml @@ -96218,7 +96218,7 @@ val module_data : end = struct #1 "builtin_cmj_datasets.ml" -(* 41e7f158a42bd8f0a232242d88578e11 *) +(* 22680a52333cb2d8603ed9cb8b316240 *) let module_names : string array = Obj.magic ( "Gc" (* 220 *), "Js" (* 23 *), @@ -96371,7 +96371,7 @@ let module_data : string array = Obj.magic ( (* Sys *)"\132\149\166\190\000\000\000\139\000\000\000 \000\000\000n\000\000\000d\160\224\176&cygwin\144@\144\146C\176*getenv_opt\144\160\160A@@@\176*set_signal\144\160\160B@@@\176+catch_break\144\160\160A@@@\1767enable_runtime_warnings\144\160\160A@@@\1768runtime_warnings_enabled\144\160\160A@@@A", (* Belt *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A", (* Char *)"\132\149\166\190\000\000\000\223\000\000\000<\000\000\000\197\000\000\000\186\160\b\000\000 \000\176#chr\144\160\160A@@@\176%equal\144\160\160B@@@\176'compare\144\160\160B@@\144\180B\160\176\001\004\001\"c1@\160\176\001\004\002\"c2@@\151\176I\160\144\004\t\160\144\004\b@\176\1922stdlib-406/char.ml\000K\001\n\001\001\n\021\192\004\002\000K\001\n\001\001\n&@\176'escaped\144\160\160A@@@\176)lowercase\144\160\160A@@@\176)uppercase\144\160\160A@@@\176/lowercase_ascii\144\160\160A@@@\176/uppercase_ascii\144\160\160A@@@A", -(* Lazy *)"\132\149\166\190\000\000\001$\000\000\000O\000\000\001\002\000\000\000\241\160\240\176&is_val\144\160\160A@@@\176(from_fun\144\160\160A@@\144\180A\160\176\001\003\239!f@@\151\176\176\001\000\246\146\160'RE_LAZY%valueA\160\146\146$todo\160\180@@\147\192\144\004\018\160\146A@\176\1922stdlib-406/lazy.ml|\001\t\175\001\t\197\192\004\002|\001\t\175\001\t\203@@@\004\004\176(from_val\144\160\160A@@\144\180A\160\176\001\003\241!v@@\151\176\176\001\000\246\146\160'RE_LAZY%valueA\160\146\146$done\160\144\004\015@\176\192\004\027~\001\t\205\001\t\227\192\004\028~\001\t\205\001\t\228@\176)force_val\144\160\160A@@@\176+lazy_is_val\144\004D@\176-lazy_from_fun\144\004B@\176-lazy_from_val\144\004%@A", +(* Lazy *)"\132\149\166\190\000\000\001$\000\000\000K\000\000\000\252\000\000\000\235\160\240\176&is_val\144\160\160A@@@\176(from_fun\144\160\160A@@\144\180A\160\176\001\003\239!f@@\151\176\176\001\000\246\146\160,RE_LAZY_DONE%valueA\160\146C\160\180@@\147\192\144\004\016\160\146A@\176\1922stdlib-406/lazy.ml|\001\t\175\001\t\197\192\004\002|\001\t\175\001\t\203@@@\004\004\176(from_val\144\160\160A@@\144\180A\160\176\001\003\241!v@@\151\176\176\001\000\246\146\160,RE_LAZY_DONE%valueA\160\146B\160\144\004\r@\176\192\004\025~\001\t\205\001\t\227\192\004\026~\001\t\205\001\t\228@\176)force_val\144\160\160A@@@\176+lazy_is_val\144\004@@\176-lazy_from_fun\144\004>@\176-lazy_from_val\144\004#@A", (* List *)"\132\149\166\190\000\000\003\134\000\000\001\020\000\000\003\135\000\000\003T\160\b\000\000\208\000\176\"hd\144\160\160A@@@\176\"tl\144\160\160A@@@\176#map\144\160\160B@@@\176#mem\144\160\160B@@@\176#nth\144\160\160B@@@\176#rev\144\160\160A@@@\176$assq\144\160\160B@@@\176$cons\144\160\160B@@\144\180B\160\176\001\003\241!a@\160\176\001\003\242!l@@\151\176\176@\160\"::A@\160\144\004\012\160\144\004\011@\176\1922stdlib-406/list.mlX\001\004\193\001\004\208\192\004\002X\001\004\193\001\004\212@\176$find\144\160\160B@@@\176$init\144\160\160B@@@\176$iter\144\160\160B@@@\176$map2\144\160\160C@@@\176$mapi\144\160\160B@@@\176$memq\144\160\160B@@@\176$sort\144\160\160B@@@\176%assoc\144\160\160B@@@\176%iter2\144\160\160C@@@\176%iteri\144\160\160B@@@\176%merge\144\160\160C@@@\176%split\144\160\160A@@@\176&append\144\160\160B@@@\176&concat\144\160\160A@@@\176&exists\144\160\160B@@@\176&filter\144\160\160A\160A@@@\176&length\144\160\160A@@@\176'combine\144\160\160B@@@\176'exists2\144\160\160C@@@\176'flatten\144\004\031@\176'for_all\144\160\160B@@@\176'nth_opt\144\160\160B@@@\176'rev_map\144\160\160B@@@\176(assq_opt\144\160\160B@@@\176(find_all\144\004,@\176(find_opt\144\160\160B@@@\176(for_all2\144\160\160C@@@\176(mem_assq\144\160\160B@@@\176(rev_map2\144\160\160C@@@\176)assoc_opt\144\160\160B@@@\176)fast_sort\144\004u@\176)fold_left\144\160\160C@@@\176)mem_assoc\144\160\160B@@@\176)partition\144\160\160B@@@\176)sort_uniq\144\160\160B@@@\176*fold_left2\144\160\160D@@@\176*fold_right\144\160\160C@@@\176*rev_append\144\160\160B@@@\176+fold_right2\144\160\160D@@@\176+remove_assq\144\160\160B@@@\176+stable_sort\144\004\165@\176,remove_assoc\144\160\160B@@@\176/compare_lengths\144\160\160B@@@\1763compare_length_with\144\160\160B@@@A", (* Node *)"\132\149\166\190\000\000\000\016\000\000\000\007\000\000\000\020\000\000\000\019\160\144\176$test\144\160\160A@@@A", (* Sort *)"\132\149\166\190\000\000\000,\000\000\000\017\000\000\0004\000\000\0001\160\176\176$list\144\160\160B@@@\176%array\144\160\160B@@@\176%merge\144\160\160C@@@A", @@ -396416,18 +396416,18 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : Lam.t = begin match args with | [Lvar _ | Lconst _ | Lfunction _ as result ] -> let args = - [ Lam.const (Const_string "done") ; + [ Lam.const Const_js_true ; result ] in - prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY";"value"|],Mutable)) ~args loc + prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY_DONE";"value"|],Mutable)) ~args loc | [computation] -> let args = - [ Lam.const (Const_string "todo") ; + [ Lam.const Const_js_false ; (* FIXME: arity 0 does not get proper supported*) prim ~primitive:(Pjs_fn_make 0) ~args:[Lam.function_ ~arity:1 ~params:[Ident.create "param"] ~body:computation] loc ] in - prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY";"value"|],Mutable)) ~args loc + prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY_DONE";"value"|],Mutable)) ~args loc | _ -> assert false end diff --git a/lib/4.06.1/unstable/js_refmt_compiler.ml b/lib/4.06.1/unstable/js_refmt_compiler.ml index b2ddc19f8d0..759ee1b88eb 100644 --- a/lib/4.06.1/unstable/js_refmt_compiler.ml +++ b/lib/4.06.1/unstable/js_refmt_compiler.ml @@ -385207,7 +385207,7 @@ val module_data : end = struct #1 "builtin_cmj_datasets.ml" -(* 41e7f158a42bd8f0a232242d88578e11 *) +(* 22680a52333cb2d8603ed9cb8b316240 *) let module_names : string array = Obj.magic ( "Gc" (* 220 *), "Js" (* 23 *), @@ -385360,7 +385360,7 @@ let module_data : string array = Obj.magic ( (* Sys *)"\132\149\166\190\000\000\000\139\000\000\000 \000\000\000n\000\000\000d\160\224\176&cygwin\144@\144\146C\176*getenv_opt\144\160\160A@@@\176*set_signal\144\160\160B@@@\176+catch_break\144\160\160A@@@\1767enable_runtime_warnings\144\160\160A@@@\1768runtime_warnings_enabled\144\160\160A@@@A", (* Belt *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A", (* Char *)"\132\149\166\190\000\000\000\223\000\000\000<\000\000\000\197\000\000\000\186\160\b\000\000 \000\176#chr\144\160\160A@@@\176%equal\144\160\160B@@@\176'compare\144\160\160B@@\144\180B\160\176\001\004\001\"c1@\160\176\001\004\002\"c2@@\151\176I\160\144\004\t\160\144\004\b@\176\1922stdlib-406/char.ml\000K\001\n\001\001\n\021\192\004\002\000K\001\n\001\001\n&@\176'escaped\144\160\160A@@@\176)lowercase\144\160\160A@@@\176)uppercase\144\160\160A@@@\176/lowercase_ascii\144\160\160A@@@\176/uppercase_ascii\144\160\160A@@@A", -(* Lazy *)"\132\149\166\190\000\000\001$\000\000\000O\000\000\001\002\000\000\000\241\160\240\176&is_val\144\160\160A@@@\176(from_fun\144\160\160A@@\144\180A\160\176\001\003\239!f@@\151\176\176\001\000\246\146\160'RE_LAZY%valueA\160\146\146$todo\160\180@@\147\192\144\004\018\160\146A@\176\1922stdlib-406/lazy.ml|\001\t\175\001\t\197\192\004\002|\001\t\175\001\t\203@@@\004\004\176(from_val\144\160\160A@@\144\180A\160\176\001\003\241!v@@\151\176\176\001\000\246\146\160'RE_LAZY%valueA\160\146\146$done\160\144\004\015@\176\192\004\027~\001\t\205\001\t\227\192\004\028~\001\t\205\001\t\228@\176)force_val\144\160\160A@@@\176+lazy_is_val\144\004D@\176-lazy_from_fun\144\004B@\176-lazy_from_val\144\004%@A", +(* Lazy *)"\132\149\166\190\000\000\001$\000\000\000K\000\000\000\252\000\000\000\235\160\240\176&is_val\144\160\160A@@@\176(from_fun\144\160\160A@@\144\180A\160\176\001\003\239!f@@\151\176\176\001\000\246\146\160,RE_LAZY_DONE%valueA\160\146C\160\180@@\147\192\144\004\016\160\146A@\176\1922stdlib-406/lazy.ml|\001\t\175\001\t\197\192\004\002|\001\t\175\001\t\203@@@\004\004\176(from_val\144\160\160A@@\144\180A\160\176\001\003\241!v@@\151\176\176\001\000\246\146\160,RE_LAZY_DONE%valueA\160\146B\160\144\004\r@\176\192\004\025~\001\t\205\001\t\227\192\004\026~\001\t\205\001\t\228@\176)force_val\144\160\160A@@@\176+lazy_is_val\144\004@@\176-lazy_from_fun\144\004>@\176-lazy_from_val\144\004#@A", (* List *)"\132\149\166\190\000\000\003\134\000\000\001\020\000\000\003\135\000\000\003T\160\b\000\000\208\000\176\"hd\144\160\160A@@@\176\"tl\144\160\160A@@@\176#map\144\160\160B@@@\176#mem\144\160\160B@@@\176#nth\144\160\160B@@@\176#rev\144\160\160A@@@\176$assq\144\160\160B@@@\176$cons\144\160\160B@@\144\180B\160\176\001\003\241!a@\160\176\001\003\242!l@@\151\176\176@\160\"::A@\160\144\004\012\160\144\004\011@\176\1922stdlib-406/list.mlX\001\004\193\001\004\208\192\004\002X\001\004\193\001\004\212@\176$find\144\160\160B@@@\176$init\144\160\160B@@@\176$iter\144\160\160B@@@\176$map2\144\160\160C@@@\176$mapi\144\160\160B@@@\176$memq\144\160\160B@@@\176$sort\144\160\160B@@@\176%assoc\144\160\160B@@@\176%iter2\144\160\160C@@@\176%iteri\144\160\160B@@@\176%merge\144\160\160C@@@\176%split\144\160\160A@@@\176&append\144\160\160B@@@\176&concat\144\160\160A@@@\176&exists\144\160\160B@@@\176&filter\144\160\160A\160A@@@\176&length\144\160\160A@@@\176'combine\144\160\160B@@@\176'exists2\144\160\160C@@@\176'flatten\144\004\031@\176'for_all\144\160\160B@@@\176'nth_opt\144\160\160B@@@\176'rev_map\144\160\160B@@@\176(assq_opt\144\160\160B@@@\176(find_all\144\004,@\176(find_opt\144\160\160B@@@\176(for_all2\144\160\160C@@@\176(mem_assq\144\160\160B@@@\176(rev_map2\144\160\160C@@@\176)assoc_opt\144\160\160B@@@\176)fast_sort\144\004u@\176)fold_left\144\160\160C@@@\176)mem_assoc\144\160\160B@@@\176)partition\144\160\160B@@@\176)sort_uniq\144\160\160B@@@\176*fold_left2\144\160\160D@@@\176*fold_right\144\160\160C@@@\176*rev_append\144\160\160B@@@\176+fold_right2\144\160\160D@@@\176+remove_assq\144\160\160B@@@\176+stable_sort\144\004\165@\176,remove_assoc\144\160\160B@@@\176/compare_lengths\144\160\160B@@@\1763compare_length_with\144\160\160B@@@A", (* Node *)"\132\149\166\190\000\000\000\016\000\000\000\007\000\000\000\020\000\000\000\019\160\144\176$test\144\160\160A@@@A", (* Sort *)"\132\149\166\190\000\000\000,\000\000\000\017\000\000\0004\000\000\0001\160\176\176$list\144\160\160B@@@\176%array\144\160\160B@@@\176%merge\144\160\160C@@@A", @@ -405698,18 +405698,18 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : Lam.t = begin match args with | [Lvar _ | Lconst _ | Lfunction _ as result ] -> let args = - [ Lam.const (Const_string "done") ; + [ Lam.const Const_js_true ; result ] in - prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY";"value"|],Mutable)) ~args loc + prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY_DONE";"value"|],Mutable)) ~args loc | [computation] -> let args = - [ Lam.const (Const_string "todo") ; + [ Lam.const Const_js_false ; (* FIXME: arity 0 does not get proper supported*) prim ~primitive:(Pjs_fn_make 0) ~args:[Lam.function_ ~arity:1 ~params:[Ident.create "param"] ~body:computation] loc ] in - prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY";"value"|],Mutable)) ~args loc + prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY_DONE";"value"|],Mutable)) ~args loc | _ -> assert false end diff --git a/lib/4.06.1/whole_compiler.ml b/lib/4.06.1/whole_compiler.ml index c980dbf859d..47633b6e76c 100644 --- a/lib/4.06.1/whole_compiler.ml +++ b/lib/4.06.1/whole_compiler.ml @@ -370688,7 +370688,7 @@ val module_data : end = struct #1 "builtin_cmj_datasets.ml" -(* 41e7f158a42bd8f0a232242d88578e11 *) +(* 22680a52333cb2d8603ed9cb8b316240 *) let module_names : string array = Obj.magic ( "Gc" (* 220 *), "Js" (* 23 *), @@ -370841,7 +370841,7 @@ let module_data : string array = Obj.magic ( (* Sys *)"\132\149\166\190\000\000\000\139\000\000\000 \000\000\000n\000\000\000d\160\224\176&cygwin\144@\144\146C\176*getenv_opt\144\160\160A@@@\176*set_signal\144\160\160B@@@\176+catch_break\144\160\160A@@@\1767enable_runtime_warnings\144\160\160A@@@\1768runtime_warnings_enabled\144\160\160A@@@A", (* Belt *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A", (* Char *)"\132\149\166\190\000\000\000\223\000\000\000<\000\000\000\197\000\000\000\186\160\b\000\000 \000\176#chr\144\160\160A@@@\176%equal\144\160\160B@@@\176'compare\144\160\160B@@\144\180B\160\176\001\004\001\"c1@\160\176\001\004\002\"c2@@\151\176I\160\144\004\t\160\144\004\b@\176\1922stdlib-406/char.ml\000K\001\n\001\001\n\021\192\004\002\000K\001\n\001\001\n&@\176'escaped\144\160\160A@@@\176)lowercase\144\160\160A@@@\176)uppercase\144\160\160A@@@\176/lowercase_ascii\144\160\160A@@@\176/uppercase_ascii\144\160\160A@@@A", -(* Lazy *)"\132\149\166\190\000\000\001$\000\000\000O\000\000\001\002\000\000\000\241\160\240\176&is_val\144\160\160A@@@\176(from_fun\144\160\160A@@\144\180A\160\176\001\003\239!f@@\151\176\176\001\000\246\146\160'RE_LAZY%valueA\160\146\146$todo\160\180@@\147\192\144\004\018\160\146A@\176\1922stdlib-406/lazy.ml|\001\t\175\001\t\197\192\004\002|\001\t\175\001\t\203@@@\004\004\176(from_val\144\160\160A@@\144\180A\160\176\001\003\241!v@@\151\176\176\001\000\246\146\160'RE_LAZY%valueA\160\146\146$done\160\144\004\015@\176\192\004\027~\001\t\205\001\t\227\192\004\028~\001\t\205\001\t\228@\176)force_val\144\160\160A@@@\176+lazy_is_val\144\004D@\176-lazy_from_fun\144\004B@\176-lazy_from_val\144\004%@A", +(* Lazy *)"\132\149\166\190\000\000\001$\000\000\000K\000\000\000\252\000\000\000\235\160\240\176&is_val\144\160\160A@@@\176(from_fun\144\160\160A@@\144\180A\160\176\001\003\239!f@@\151\176\176\001\000\246\146\160,RE_LAZY_DONE%valueA\160\146C\160\180@@\147\192\144\004\016\160\146A@\176\1922stdlib-406/lazy.ml|\001\t\175\001\t\197\192\004\002|\001\t\175\001\t\203@@@\004\004\176(from_val\144\160\160A@@\144\180A\160\176\001\003\241!v@@\151\176\176\001\000\246\146\160,RE_LAZY_DONE%valueA\160\146B\160\144\004\r@\176\192\004\025~\001\t\205\001\t\227\192\004\026~\001\t\205\001\t\228@\176)force_val\144\160\160A@@@\176+lazy_is_val\144\004@@\176-lazy_from_fun\144\004>@\176-lazy_from_val\144\004#@A", (* List *)"\132\149\166\190\000\000\003\134\000\000\001\020\000\000\003\135\000\000\003T\160\b\000\000\208\000\176\"hd\144\160\160A@@@\176\"tl\144\160\160A@@@\176#map\144\160\160B@@@\176#mem\144\160\160B@@@\176#nth\144\160\160B@@@\176#rev\144\160\160A@@@\176$assq\144\160\160B@@@\176$cons\144\160\160B@@\144\180B\160\176\001\003\241!a@\160\176\001\003\242!l@@\151\176\176@\160\"::A@\160\144\004\012\160\144\004\011@\176\1922stdlib-406/list.mlX\001\004\193\001\004\208\192\004\002X\001\004\193\001\004\212@\176$find\144\160\160B@@@\176$init\144\160\160B@@@\176$iter\144\160\160B@@@\176$map2\144\160\160C@@@\176$mapi\144\160\160B@@@\176$memq\144\160\160B@@@\176$sort\144\160\160B@@@\176%assoc\144\160\160B@@@\176%iter2\144\160\160C@@@\176%iteri\144\160\160B@@@\176%merge\144\160\160C@@@\176%split\144\160\160A@@@\176&append\144\160\160B@@@\176&concat\144\160\160A@@@\176&exists\144\160\160B@@@\176&filter\144\160\160A\160A@@@\176&length\144\160\160A@@@\176'combine\144\160\160B@@@\176'exists2\144\160\160C@@@\176'flatten\144\004\031@\176'for_all\144\160\160B@@@\176'nth_opt\144\160\160B@@@\176'rev_map\144\160\160B@@@\176(assq_opt\144\160\160B@@@\176(find_all\144\004,@\176(find_opt\144\160\160B@@@\176(for_all2\144\160\160C@@@\176(mem_assq\144\160\160B@@@\176(rev_map2\144\160\160C@@@\176)assoc_opt\144\160\160B@@@\176)fast_sort\144\004u@\176)fold_left\144\160\160C@@@\176)mem_assoc\144\160\160B@@@\176)partition\144\160\160B@@@\176)sort_uniq\144\160\160B@@@\176*fold_left2\144\160\160D@@@\176*fold_right\144\160\160C@@@\176*rev_append\144\160\160B@@@\176+fold_right2\144\160\160D@@@\176+remove_assq\144\160\160B@@@\176+stable_sort\144\004\165@\176,remove_assoc\144\160\160B@@@\176/compare_lengths\144\160\160B@@@\1763compare_length_with\144\160\160B@@@A", (* Node *)"\132\149\166\190\000\000\000\016\000\000\000\007\000\000\000\020\000\000\000\019\160\144\176$test\144\160\160A@@@A", (* Sort *)"\132\149\166\190\000\000\000,\000\000\000\017\000\000\0004\000\000\0001\160\176\176$list\144\160\160B@@@\176%array\144\160\160B@@@\176%merge\144\160\160C@@@A", @@ -399899,18 +399899,18 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : Lam.t = begin match args with | [Lvar _ | Lconst _ | Lfunction _ as result ] -> let args = - [ Lam.const (Const_string "done") ; + [ Lam.const Const_js_true ; result ] in - prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY";"value"|],Mutable)) ~args loc + prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY_DONE";"value"|],Mutable)) ~args loc | [computation] -> let args = - [ Lam.const (Const_string "todo") ; + [ Lam.const Const_js_false ; (* FIXME: arity 0 does not get proper supported*) prim ~primitive:(Pjs_fn_make 0) ~args:[Lam.function_ ~arity:1 ~params:[Ident.create "param"] ~body:computation] loc ] in - prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY";"value"|],Mutable)) ~args loc + prim ~primitive:(Pmakeblock (tag,Blk_record [|"RE_LAZY_DONE";"value"|],Mutable)) ~args loc | _ -> assert false end diff --git a/lib/es6/caml_module.js b/lib/es6/caml_module.js index 35e16a9541a..eb9295ad8b6 100644 --- a/lib/es6/caml_module.js +++ b/lib/es6/caml_module.js @@ -18,7 +18,7 @@ function init_mod(loc, shape) { return ; case /* Lazy */1 : struct_[idx] = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: undef_module }; return ; diff --git a/lib/es6/camlinternalLazy.js b/lib/es6/camlinternalLazy.js index b69edab0e89..32070391b33 100644 --- a/lib/es6/camlinternalLazy.js +++ b/lib/es6/camlinternalLazy.js @@ -2,10 +2,8 @@ import * as Caml_exceptions from "./caml_exceptions.js"; -var status_done = "done"; - function is_val(l) { - return l.RE_LAZY === status_done; + return l.RE_LAZY_DONE; } var Undefined = Caml_exceptions.create("CamlinternalLazy.Undefined"); @@ -13,7 +11,7 @@ var Undefined = Caml_exceptions.create("CamlinternalLazy.Undefined"); function forward_with_closure(blk, closure) { var result = closure(); blk.value = result; - blk.RE_LAZY = status_done; + blk.RE_LAZY_DONE = true; return result; } @@ -25,7 +23,7 @@ function raise_undefined() { } function force(lzv) { - if (lzv.RE_LAZY === status_done) { + if (lzv.RE_LAZY_DONE) { return lzv.value; } else { var closure = lzv.value; @@ -43,7 +41,7 @@ function force(lzv) { } function force_val(lzv) { - if (lzv.RE_LAZY === status_done) { + if (lzv.RE_LAZY_DONE) { return lzv.value; } else { var closure = lzv.value; diff --git a/lib/es6/ephemeron.js b/lib/es6/ephemeron.js index ca21b55a6c6..a3ccf5cd4fc 100644 --- a/lib/es6/ephemeron.js +++ b/lib/es6/ephemeron.js @@ -103,7 +103,7 @@ function MakeSeeded(H) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -635,7 +635,7 @@ function Make(H) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -1268,7 +1268,7 @@ function MakeSeeded$1(H1, H2) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -1828,7 +1828,7 @@ function Make$1(H1, H2) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -2473,7 +2473,7 @@ function MakeSeeded$2(H) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -3063,7 +3063,7 @@ function Make$2(H) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -3640,7 +3640,7 @@ var GenHashTable = { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) diff --git a/lib/es6/filename.js b/lib/es6/filename.js index b691d7d76f6..28472554b1f 100644 --- a/lib/es6/filename.js +++ b/lib/es6/filename.js @@ -455,7 +455,7 @@ function remove_extension(name) { } var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) diff --git a/lib/es6/hashtbl.js b/lib/es6/hashtbl.js index 3575b6adda9..71e831c6678 100644 --- a/lib/es6/hashtbl.js +++ b/lib/es6/hashtbl.js @@ -42,7 +42,7 @@ function is_randomized(param) { } var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) diff --git a/lib/es6/lazy.js b/lib/es6/lazy.js index aaa3b07b288..4188b397d9b 100644 --- a/lib/es6/lazy.js +++ b/lib/es6/lazy.js @@ -5,7 +5,7 @@ import * as CamlinternalLazy from "./camlinternalLazy.js"; function from_fun(f) { return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Curry._1(f, undefined); }) @@ -14,7 +14,7 @@ function from_fun(f) { function from_val(v) { return { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: v }; } diff --git a/lib/es6/stream.js b/lib/es6/stream.js index 64bd503da82..9cac628a653 100644 --- a/lib/es6/stream.js +++ b/lib/es6/stream.js @@ -397,7 +397,7 @@ function lapp(f, s) { return { count: 0, data: /* Slazy */Block.__(2, [{ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return /* Sapp */Block.__(1, [ data(Curry._1(f, undefined)), @@ -412,7 +412,7 @@ function lcons(f, s) { return { count: 0, data: /* Slazy */Block.__(2, [{ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return /* Scons */Block.__(0, [ Curry._1(f, undefined), @@ -427,7 +427,7 @@ function lsing(f) { return { count: 0, data: /* Slazy */Block.__(2, [{ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return /* Scons */Block.__(0, [ Curry._1(f, undefined), @@ -442,7 +442,7 @@ function slazy(f) { return { count: 0, data: /* Slazy */Block.__(2, [{ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return data(Curry._1(f, undefined)); }) diff --git a/lib/js/caml_module.js b/lib/js/caml_module.js index f5fd8ffe5dd..ea043993a83 100644 --- a/lib/js/caml_module.js +++ b/lib/js/caml_module.js @@ -18,7 +18,7 @@ function init_mod(loc, shape) { return ; case /* Lazy */1 : struct_[idx] = { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: undef_module }; return ; diff --git a/lib/js/camlinternalLazy.js b/lib/js/camlinternalLazy.js index 688cc1817e9..b78cdb6c423 100644 --- a/lib/js/camlinternalLazy.js +++ b/lib/js/camlinternalLazy.js @@ -2,10 +2,8 @@ var Caml_exceptions = require("./caml_exceptions.js"); -var status_done = "done"; - function is_val(l) { - return l.RE_LAZY === status_done; + return l.RE_LAZY_DONE; } var Undefined = Caml_exceptions.create("CamlinternalLazy.Undefined"); @@ -13,7 +11,7 @@ var Undefined = Caml_exceptions.create("CamlinternalLazy.Undefined"); function forward_with_closure(blk, closure) { var result = closure(); blk.value = result; - blk.RE_LAZY = status_done; + blk.RE_LAZY_DONE = true; return result; } @@ -25,7 +23,7 @@ function raise_undefined() { } function force(lzv) { - if (lzv.RE_LAZY === status_done) { + if (lzv.RE_LAZY_DONE) { return lzv.value; } else { var closure = lzv.value; @@ -43,7 +41,7 @@ function force(lzv) { } function force_val(lzv) { - if (lzv.RE_LAZY === status_done) { + if (lzv.RE_LAZY_DONE) { return lzv.value; } else { var closure = lzv.value; diff --git a/lib/js/ephemeron.js b/lib/js/ephemeron.js index 73051ff374d..9247177b1aa 100644 --- a/lib/js/ephemeron.js +++ b/lib/js/ephemeron.js @@ -103,7 +103,7 @@ function MakeSeeded(H) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -635,7 +635,7 @@ function Make(H) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -1268,7 +1268,7 @@ function MakeSeeded$1(H1, H2) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -1828,7 +1828,7 @@ function Make$1(H1, H2) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -2473,7 +2473,7 @@ function MakeSeeded$2(H) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -3063,7 +3063,7 @@ function Make$2(H) { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) @@ -3640,7 +3640,7 @@ var GenHashTable = { }; }; var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) diff --git a/lib/js/filename.js b/lib/js/filename.js index 125e90baa28..183b39b6ff0 100644 --- a/lib/js/filename.js +++ b/lib/js/filename.js @@ -455,7 +455,7 @@ function remove_extension(name) { } var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) diff --git a/lib/js/hashtbl.js b/lib/js/hashtbl.js index 0a89ac87ae8..7fbd3a1c545 100644 --- a/lib/js/hashtbl.js +++ b/lib/js/hashtbl.js @@ -42,7 +42,7 @@ function is_randomized(param) { } var prng = { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Random.State.make_self_init(undefined); }) diff --git a/lib/js/lazy.js b/lib/js/lazy.js index 0484d5f7d6a..3ab831b523e 100644 --- a/lib/js/lazy.js +++ b/lib/js/lazy.js @@ -5,7 +5,7 @@ var CamlinternalLazy = require("./camlinternalLazy.js"); function from_fun(f) { return { - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return Curry._1(f, undefined); }) @@ -14,7 +14,7 @@ function from_fun(f) { function from_val(v) { return { - RE_LAZY: "done", + RE_LAZY_DONE: true, value: v }; } diff --git a/lib/js/stream.js b/lib/js/stream.js index 8511d3a6dc8..185248b6731 100644 --- a/lib/js/stream.js +++ b/lib/js/stream.js @@ -397,7 +397,7 @@ function lapp(f, s) { return { count: 0, data: /* Slazy */Block.__(2, [{ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return /* Sapp */Block.__(1, [ data(Curry._1(f, undefined)), @@ -412,7 +412,7 @@ function lcons(f, s) { return { count: 0, data: /* Slazy */Block.__(2, [{ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return /* Scons */Block.__(0, [ Curry._1(f, undefined), @@ -427,7 +427,7 @@ function lsing(f) { return { count: 0, data: /* Slazy */Block.__(2, [{ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return /* Scons */Block.__(0, [ Curry._1(f, undefined), @@ -442,7 +442,7 @@ function slazy(f) { return { count: 0, data: /* Slazy */Block.__(2, [{ - RE_LAZY: "todo", + RE_LAZY_DONE: false, value: (function () { return data(Curry._1(f, undefined)); }) From 9e6e45327591f513d54dea39a4a4fdef345d6a5d Mon Sep 17 00:00:00 2001 From: Hongbo Zhang Date: Thu, 14 May 2020 13:50:33 +0800 Subject: [PATCH 2/2] snapshot --- jscomp/main/builtin_cmj_datasets.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jscomp/main/builtin_cmj_datasets.ml b/jscomp/main/builtin_cmj_datasets.ml index bc0acc0a6da..cda14ffe970 100644 --- a/jscomp/main/builtin_cmj_datasets.ml +++ b/jscomp/main/builtin_cmj_datasets.ml @@ -1,4 +1,4 @@ -(* 41e7f158a42bd8f0a232242d88578e11 *) +(* 22680a52333cb2d8603ed9cb8b316240 *) let module_names : string array = Obj.magic ( "Gc" (* 220 *), "Js" (* 23 *), @@ -151,7 +151,7 @@ let module_data : string array = Obj.magic ( (* Sys *)"\132\149\166\190\000\000\000\139\000\000\000 \000\000\000n\000\000\000d\160\224\176&cygwin\144@\144\146C\176*getenv_opt\144\160\160A@@@\176*set_signal\144\160\160B@@@\176+catch_break\144\160\160A@@@\1767enable_runtime_warnings\144\160\160A@@@\1768runtime_warnings_enabled\144\160\160A@@@A", (* Belt *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A", (* Char *)"\132\149\166\190\000\000\000\223\000\000\000<\000\000\000\197\000\000\000\186\160\b\000\000 \000\176#chr\144\160\160A@@@\176%equal\144\160\160B@@@\176'compare\144\160\160B@@\144\180B\160\176\001\004\001\"c1@\160\176\001\004\002\"c2@@\151\176I\160\144\004\t\160\144\004\b@\176\1922stdlib-406/char.ml\000K\001\n\001\001\n\021\192\004\002\000K\001\n\001\001\n&@\176'escaped\144\160\160A@@@\176)lowercase\144\160\160A@@@\176)uppercase\144\160\160A@@@\176/lowercase_ascii\144\160\160A@@@\176/uppercase_ascii\144\160\160A@@@A", -(* Lazy *)"\132\149\166\190\000\000\001$\000\000\000O\000\000\001\002\000\000\000\241\160\240\176&is_val\144\160\160A@@@\176(from_fun\144\160\160A@@\144\180A\160\176\001\003\239!f@@\151\176\176\001\000\246\146\160'RE_LAZY%valueA\160\146\146$todo\160\180@@\147\192\144\004\018\160\146A@\176\1922stdlib-406/lazy.ml|\001\t\175\001\t\197\192\004\002|\001\t\175\001\t\203@@@\004\004\176(from_val\144\160\160A@@\144\180A\160\176\001\003\241!v@@\151\176\176\001\000\246\146\160'RE_LAZY%valueA\160\146\146$done\160\144\004\015@\176\192\004\027~\001\t\205\001\t\227\192\004\028~\001\t\205\001\t\228@\176)force_val\144\160\160A@@@\176+lazy_is_val\144\004D@\176-lazy_from_fun\144\004B@\176-lazy_from_val\144\004%@A", +(* Lazy *)"\132\149\166\190\000\000\001$\000\000\000K\000\000\000\252\000\000\000\235\160\240\176&is_val\144\160\160A@@@\176(from_fun\144\160\160A@@\144\180A\160\176\001\003\239!f@@\151\176\176\001\000\246\146\160,RE_LAZY_DONE%valueA\160\146C\160\180@@\147\192\144\004\016\160\146A@\176\1922stdlib-406/lazy.ml|\001\t\175\001\t\197\192\004\002|\001\t\175\001\t\203@@@\004\004\176(from_val\144\160\160A@@\144\180A\160\176\001\003\241!v@@\151\176\176\001\000\246\146\160,RE_LAZY_DONE%valueA\160\146B\160\144\004\r@\176\192\004\025~\001\t\205\001\t\227\192\004\026~\001\t\205\001\t\228@\176)force_val\144\160\160A@@@\176+lazy_is_val\144\004@@\176-lazy_from_fun\144\004>@\176-lazy_from_val\144\004#@A", (* List *)"\132\149\166\190\000\000\003\134\000\000\001\020\000\000\003\135\000\000\003T\160\b\000\000\208\000\176\"hd\144\160\160A@@@\176\"tl\144\160\160A@@@\176#map\144\160\160B@@@\176#mem\144\160\160B@@@\176#nth\144\160\160B@@@\176#rev\144\160\160A@@@\176$assq\144\160\160B@@@\176$cons\144\160\160B@@\144\180B\160\176\001\003\241!a@\160\176\001\003\242!l@@\151\176\176@\160\"::A@\160\144\004\012\160\144\004\011@\176\1922stdlib-406/list.mlX\001\004\193\001\004\208\192\004\002X\001\004\193\001\004\212@\176$find\144\160\160B@@@\176$init\144\160\160B@@@\176$iter\144\160\160B@@@\176$map2\144\160\160C@@@\176$mapi\144\160\160B@@@\176$memq\144\160\160B@@@\176$sort\144\160\160B@@@\176%assoc\144\160\160B@@@\176%iter2\144\160\160C@@@\176%iteri\144\160\160B@@@\176%merge\144\160\160C@@@\176%split\144\160\160A@@@\176&append\144\160\160B@@@\176&concat\144\160\160A@@@\176&exists\144\160\160B@@@\176&filter\144\160\160A\160A@@@\176&length\144\160\160A@@@\176'combine\144\160\160B@@@\176'exists2\144\160\160C@@@\176'flatten\144\004\031@\176'for_all\144\160\160B@@@\176'nth_opt\144\160\160B@@@\176'rev_map\144\160\160B@@@\176(assq_opt\144\160\160B@@@\176(find_all\144\004,@\176(find_opt\144\160\160B@@@\176(for_all2\144\160\160C@@@\176(mem_assq\144\160\160B@@@\176(rev_map2\144\160\160C@@@\176)assoc_opt\144\160\160B@@@\176)fast_sort\144\004u@\176)fold_left\144\160\160C@@@\176)mem_assoc\144\160\160B@@@\176)partition\144\160\160B@@@\176)sort_uniq\144\160\160B@@@\176*fold_left2\144\160\160D@@@\176*fold_right\144\160\160C@@@\176*rev_append\144\160\160B@@@\176+fold_right2\144\160\160D@@@\176+remove_assq\144\160\160B@@@\176+stable_sort\144\004\165@\176,remove_assoc\144\160\160B@@@\176/compare_lengths\144\160\160B@@@\1763compare_length_with\144\160\160B@@@A", (* Node *)"\132\149\166\190\000\000\000\016\000\000\000\007\000\000\000\020\000\000\000\019\160\144\176$test\144\160\160A@@@A", (* Sort *)"\132\149\166\190\000\000\000,\000\000\000\017\000\000\0004\000\000\0001\160\176\176$list\144\160\160B@@@\176%array\144\160\160B@@@\176%merge\144\160\160C@@@A",