Skip to content

Commit 8730ad8

Browse files
committed
snapshot changes
1 parent 91d4729 commit 8730ad8

File tree

7 files changed

+182
-10
lines changed

7 files changed

+182
-10
lines changed

jscomp/test/prepend_data_ffi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function f(x) {
4242
]);
4343
x.xx(112, 3, "xxx", 1, 2, 3);
4444
x.xx(113, 3, "xxx", 0, "b", 1, 2, 3, 4, 5);
45-
x.xx(114, 3, true, false, ("你好"), (["你好",1,2,3]), ([{ "arr" : ["你好",1,2,3], "encoding" : "utf8"}]), ([{ "arr" : ["你好",1,2,3], "encoding" : "utf8"}]), "xxx", 0, "yyy", "b", 1, 2, 3, 4, 5);
45+
x.xx(114, 3, true, false, "你好", ["你好",1,2,3], [{ "arr" : ["你好",1,2,3], "encoding" : "utf8"}], [{ "arr" : ["你好",1,2,3], "encoding" : "utf8"}], "xxx", 0, "yyy", "b", 1, 2, 3, 4, 5);
4646

4747
}
4848

jscomp/test/reactDOMRe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function createElementVariadic(domClassName, props, children) {
8686
function unsafeAddProp(style, key, value) {
8787
var dict = { };
8888
dict[key] = value;
89-
return Object.assign(({}), style, dict);
89+
return Object.assign({}, style, dict);
9090
}
9191

9292
var Style = {

jscomp/test/reasonReactRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ function useUrl(serverUrl, param) {
182182
return (function (param) {
183183
return unwatchUrl(watcherId);
184184
});
185-
}), ([]));
185+
}), []);
186186
return url$1;
187187
}
188188

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83643,6 +83643,7 @@ type exp =
8364383643
| RegExp of RegExp.t
8364483644
]}
8364583645
*)
83646+
| Js_raw_json
8364683647
| Js_exp_unknown
8364783648

8364883649

@@ -88550,7 +88551,9 @@ and expression_desc cxt ~(level:int) f x : cxt =
8855088551
(match info with
8855188552
| Exp exp_info ->
8855288553
let raw_paren =
88553-
not (match exp_info with Js_literal _ -> true | _ -> false || raw_snippet_exp_simple_enough s) in
88554+
not (match exp_info with
88555+
| Js_literal _ | Js_raw_json -> true
88556+
| Js_function _ | Js_exp_unknown -> false || raw_snippet_exp_simple_enough s) in
8855488557
if raw_paren then P.string f L.lparen;
8855588558
P.string f s ;
8855688559
if raw_paren then P.string f L.rparen;
@@ -109197,7 +109200,7 @@ let translate_arg_cst (cst : External_arg_spec.cst) =
109197109200
E.str i
109198109201
| Arg_js_null -> E.nil
109199109202
| Arg_js_json s
109200-
-> E.raw_js_code (Exp Js_exp_unknown) s
109203+
-> E.raw_js_code (Exp Js_raw_json) s
109201109204

109202109205
| Arg_js_true -> E.bool true
109203109206
| Arg_js_false -> E.bool false

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 168 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12041,6 +12041,7 @@ type exp =
1204112041
| RegExp of RegExp.t
1204212042
]}
1204312043
*)
12044+
| Js_raw_json
1204412045
| Js_exp_unknown
1204512046

1204612047

@@ -380994,7 +380995,9 @@ and expression_desc cxt ~(level:int) f x : cxt =
380994380995
(match info with
380995380996
| Exp exp_info ->
380996380997
let raw_paren =
380997-
not (match exp_info with Js_literal _ -> true | _ -> false || raw_snippet_exp_simple_enough s) in
380998+
not (match exp_info with
380999+
| Js_literal _ | Js_raw_json -> true
381000+
| Js_function _ | Js_exp_unknown -> false || raw_snippet_exp_simple_enough s) in
380998381001
if raw_paren then P.string f L.lparen;
380999381002
P.string f s ;
381000381003
if raw_paren then P.string f L.rparen;
@@ -384188,7 +384191,169 @@ let rec
384188384191
| _ -> false)
384189384192
| Lstaticraise(id,ls) ->
384190384193
(match l2 with Lstaticraise(id1,ls1) ->
384191-
id = id1 t64 cmp a b)
384194+
id = id1 && eq_approx_list ls ls1
384195+
| _ -> false)
384196+
| Lprim info1 ->
384197+
(match l2 with
384198+
Lprim info2 ->
384199+
Lam_primitive.eq_primitive_approx info1.primitive info2.primitive &&
384200+
eq_approx_list info1.args info2.args
384201+
| _ -> false)
384202+
| Lstringswitch _ -> false
384203+
| Lfunction _
384204+
| Llet (_,_,_,_)
384205+
| Lletrec _
384206+
| Lswitch _
384207+
| Lstaticcatch _
384208+
| Ltrywith _
384209+
| Lfor (_,_,_,_,_)
384210+
| Lsend _
384211+
-> false
384212+
384213+
and eq_approx_list ls ls1 = Ext_list.for_all2_no_exn ls ls1 eq_approx
384214+
384215+
384216+
384217+
384218+
let switch lam (lam_switch : lambda_switch) : t =
384219+
match lam with
384220+
| Lconst ((Const_pointer (i,_) | (Const_int {value = i})))
384221+
->
384222+
Ext_list.assoc_by_int lam_switch.sw_consts i lam_switch.sw_failaction
384223+
| Lconst (Const_block (i,_,_)) ->
384224+
Ext_list.assoc_by_int lam_switch.sw_blocks i lam_switch.sw_failaction
384225+
| _ ->
384226+
Lswitch(lam,lam_switch)
384227+
384228+
let stringswitch (lam : t) cases default : t =
384229+
match lam with
384230+
| Lconst (Const_string a) ->
384231+
Ext_list.assoc_by_string cases a default
384232+
| _ -> Lstringswitch(lam, cases, default)
384233+
384234+
384235+
let true_ : t =
384236+
Lconst (Const_js_true)
384237+
384238+
let false_ : t =
384239+
Lconst (Const_js_false)
384240+
384241+
let unit : t = Lconst Const_js_undefined
384242+
384243+
384244+
384245+
384246+
384247+
let rec seq (a : t) b : t =
384248+
match a with
384249+
| Lprim
384250+
{primitive = Pmakeblock(_);
384251+
args= x::xs} ->
384252+
seq (Ext_list.fold_left xs x seq ) b
384253+
| Lprim {primitive = Pnull_to_opt | Pundefined_to_opt | Pnull_undefined_to_opt; args = [a]}
384254+
-> seq a b
384255+
| _ ->
384256+
Lsequence (a, b)
384257+
384258+
384259+
let var id : t = Lvar id
384260+
let global_module id = Lglobal_module id
384261+
let const ct : t = Lconst ct
384262+
let function_ ~arity ~params ~body : t =
384263+
Lfunction { arity; params ; body}
384264+
384265+
let let_ kind id e body : t
384266+
= Llet (kind,id,e,body)
384267+
let letrec bindings body : t =
384268+
Lletrec(bindings,body)
384269+
let while_ a b : t =
384270+
Lwhile(a,b)
384271+
384272+
let try_ body id handler : t =
384273+
Ltrywith(body,id,handler)
384274+
384275+
let for_ v e1 e2 dir e3 : t =
384276+
Lfor(v,e1,e2,dir,e3)
384277+
384278+
let assign v l : t = Lassign(v,l)
384279+
let send u m o ll v : t =
384280+
Lsend(u, m, o, ll, v)
384281+
let staticcatch a b c : t = Lstaticcatch(a,b,c)
384282+
let staticraise a b : t = Lstaticraise(a,b)
384283+
384284+
384285+
module Lift = struct
384286+
let int i : t =
384287+
Lconst ((Const_int {value = i; comment = None}))
384288+
384289+
384290+
(* let int32 i : t =
384291+
Lconst ((Const_int32 i)) *)
384292+
384293+
let bool b = if b then true_ else false_
384294+
384295+
(* ATTENTION: [float, nativeint] constant propogaton is not done
384296+
yet , due to cross platform problem
384297+
*)
384298+
(* let float b : t =
384299+
Lconst ((Const_float b)) *)
384300+
384301+
(* let nativeint b : t =
384302+
Lconst ((Const_nativeint b)) *)
384303+
384304+
let int32 b : t =
384305+
Lconst ((Const_int32 b))
384306+
384307+
let int64 b : t =
384308+
Lconst ((Const_int64 b))
384309+
let string b : t =
384310+
Lconst ((Const_string (b)))
384311+
let char b : t =
384312+
Lconst ((Const_char b))
384313+
end
384314+
384315+
384316+
384317+
let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
384318+
let default () : t = Lprim { primitive = prim ;args; loc} in
384319+
match args with
384320+
| [Lconst a] ->
384321+
begin match prim, a with
384322+
| Pnegint, Const_int {value = a}
384323+
-> Lift.int (- a)
384324+
(* | Pfloatofint, ( (Const_int a)) *)
384325+
(* -> Lift.float (float_of_int a) *)
384326+
| Pintoffloat, ( (Const_float a))
384327+
->
384328+
Lift.int (int_of_float (float_of_string a))
384329+
(* | Pnegfloat -> Lift.float (-. a) *)
384330+
(* | Pabsfloat -> Lift.float (abs_float a) *)
384331+
| Pstringlength, Const_string a
384332+
->
384333+
Lift.int (String.length a)
384334+
(* | Pnegbint Pnativeint, ( (Const_nativeint i)) *)
384335+
(* -> *)
384336+
(* Lift.nativeint (Nativeint.neg i) *)
384337+
| Pnegbint Pint32, Const_int32 a
384338+
->
384339+
Lift.int32 (Int32.neg a)
384340+
| Pnegbint Pint64, Const_int64 a
384341+
->
384342+
Lift.int64 (Int64.neg a)
384343+
| Pnot, Const_js_true -> false_
384344+
| Pnot, Const_js_false -> true_
384345+
| Pnot , Const_pointer (a,_)
384346+
-> Lift.bool (a = 0 )
384347+
| _ -> default ()
384348+
end
384349+
384350+
384351+
| [Lconst a ; Lconst b] ->
384352+
begin match prim, a, b with
384353+
| Pbintcomp(_, cmp), (Const_int32 a), (Const_int32 b)
384354+
-> Lift.bool (Lam_compat.cmp_int32 cmp a b)
384355+
| Pbintcomp(_, cmp), (Const_int64 a), (Const_int64 b)
384356+
-> Lift.bool (Lam_compat.cmp_int64 cmp a b)
384192384357
| Pbintcomp(_, cmp), (Const_nativeint a), (Const_nativeint b)
384193384358
-> Lift.bool (Lam_compat.cmp_nativeint cmp a b)
384194384359
| Pfloatcomp cmp, (Const_float a), (Const_float b)
@@ -397715,7 +397880,7 @@ let translate_arg_cst (cst : External_arg_spec.cst) =
397715397880
E.str i
397716397881
| Arg_js_null -> E.nil
397717397882
| Arg_js_json s
397718-
-> E.raw_js_code (Exp Js_exp_unknown) s
397883+
-> E.raw_js_code (Exp Js_raw_json) s
397719397884

397720397885
| Arg_js_true -> E.bool true
397721397886
| Arg_js_false -> E.bool false

lib/4.06.1/unstable/native_ppx.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9188,6 +9188,7 @@ type exp =
91889188
| RegExp of RegExp.t
91899189
]}
91909190
*)
9191+
| Js_raw_json
91919192
| Js_exp_unknown
91929193

91939194

lib/4.06.1/whole_compiler.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6104,6 +6104,7 @@ type exp =
61046104
| RegExp of RegExp.t
61056105
]}
61066106
*)
6107+
| Js_raw_json
61076108
| Js_exp_unknown
61086109

61096110

@@ -381761,7 +381762,9 @@ and expression_desc cxt ~(level:int) f x : cxt =
381761381762
(match info with
381762381763
| Exp exp_info ->
381763381764
let raw_paren =
381764-
not (match exp_info with Js_literal _ -> true | _ -> false || raw_snippet_exp_simple_enough s) in
381765+
not (match exp_info with
381766+
| Js_literal _ | Js_raw_json -> true
381767+
| Js_function _ | Js_exp_unknown -> false || raw_snippet_exp_simple_enough s) in
381765381768
if raw_paren then P.string f L.lparen;
381766381769
P.string f s ;
381767381770
if raw_paren then P.string f L.rparen;
@@ -391892,7 +391895,7 @@ let translate_arg_cst (cst : External_arg_spec.cst) =
391892391895
E.str i
391893391896
| Arg_js_null -> E.nil
391894391897
| Arg_js_json s
391895-
-> E.raw_js_code (Exp Js_exp_unknown) s
391898+
-> E.raw_js_code (Exp Js_raw_json) s
391896391899

391897391900
| Arg_js_true -> E.bool true
391898391901
| Arg_js_false -> E.bool false

0 commit comments

Comments
 (0)