Skip to content

Commit 2abc2d4

Browse files
committed
snapshot
1 parent d355ccd commit 2abc2d4

File tree

7 files changed

+269
-203
lines changed

7 files changed

+269
-203
lines changed

jscomp/test/caml_compare_test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ var suites = {
622622
(function (param) {
623623
return {
624624
TAG: /* Eq */0,
625-
_0: Caml_obj.caml_compare(({}), ({})),
625+
_0: Caml_obj.caml_compare({}, {}),
626626
_1: 0
627627
};
628628
})
@@ -633,7 +633,7 @@ var suites = {
633633
(function (param) {
634634
return {
635635
TAG: /* Eq */0,
636-
_0: Caml_obj.caml_compare(({}), ({x:1})),
636+
_0: Caml_obj.caml_compare({}, {x:1}),
637637
_1: -1
638638
};
639639
})
@@ -661,7 +661,7 @@ var suites = {
661661
(function (param) {
662662
return {
663663
TAG: /* Eq */0,
664-
_0: Caml_obj.caml_compare(({x:1}), ({x:1, y:2})),
664+
_0: Caml_obj.caml_compare({x:1}, {x:1, y:2}),
665665
_1: -1
666666
};
667667
})
@@ -672,7 +672,7 @@ var suites = {
672672
(function (param) {
673673
return {
674674
TAG: /* Eq */0,
675-
_0: Caml_obj.caml_compare(({x:1, y:2}), ({x:1})),
675+
_0: Caml_obj.caml_compare({x:1, y:2}, {x:1}),
676676
_1: 1
677677
};
678678
})
@@ -847,7 +847,7 @@ var suites = {
847847
(function (param) {
848848
return {
849849
TAG: /* Eq */0,
850-
_0: Caml_obj.caml_equal(({}), ({})),
850+
_0: Caml_obj.caml_equal({}, {}),
851851
_1: true
852852
};
853853
})
@@ -858,7 +858,7 @@ var suites = {
858858
(function (param) {
859859
return {
860860
TAG: /* Eq */0,
861-
_0: Caml_obj.caml_equal(({}), ({x:1})),
861+
_0: Caml_obj.caml_equal({}, {x:1}),
862862
_1: false
863863
};
864864
})
@@ -885,7 +885,7 @@ var suites = {
885885
(function (param) {
886886
return {
887887
TAG: /* Eq */0,
888-
_0: Caml_obj.caml_equal(({x:1}), ({x:1, y:2})),
888+
_0: Caml_obj.caml_equal({x:1}, {x:1, y:2}),
889889
_1: false
890890
};
891891
})
@@ -896,7 +896,7 @@ var suites = {
896896
(function (param) {
897897
return {
898898
TAG: /* Eq */0,
899-
_0: Caml_obj.caml_equal(({x:1, y:2}), ({x:1})),
899+
_0: Caml_obj.caml_equal({x:1, y:2}, {x:1}),
900900
_1: false
901901
};
902902
})

jscomp/test/flow_parser_reg_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17924,7 +17924,7 @@ function parse(content, options) {
1792417924
var e = new Error(String(List.length(l._1)) + " errors");
1792517925
e["name"] = "Parse Error";
1792617926
throw(e);
17927-
return ({});
17927+
return {};
1792817928
}
1792917929
throw l;
1793017930
}

jscomp/test/name_mangle_test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,31 +106,31 @@ function f12(x) {
106106
return x.__;
107107
}
108108

109-
eq("File \"name_mangle_test.ml\", line 85, characters 7-14", f0(({open:0})), 1);
109+
eq("File \"name_mangle_test.ml\", line 85, characters 7-14", f0({open:0}), 1);
110110

111-
eq("File \"name_mangle_test.ml\", line 86, characters 7-14", f1(({in:0})), 1);
111+
eq("File \"name_mangle_test.ml\", line 86, characters 7-14", f1({in:0}), 1);
112112

113-
eq("File \"name_mangle_test.ml\", line 87, characters 7-14", f2(({MAX_LENGTH:0})), 1);
113+
eq("File \"name_mangle_test.ml\", line 87, characters 7-14", f2({MAX_LENGTH:0}), 1);
114114

115-
eq("File \"name_mangle_test.ml\", line 88, characters 7-14", f3(({Capital:0})), 1);
115+
eq("File \"name_mangle_test.ml\", line 88, characters 7-14", f3({Capital:0}), 1);
116116

117-
eq("File \"name_mangle_test.ml\", line 89, characters 7-14", f4(({_open:0})), 1);
117+
eq("File \"name_mangle_test.ml\", line 89, characters 7-14", f4({_open:0}), 1);
118118

119-
eq("File \"name_mangle_test.ml\", line 90, characters 7-14", f5(({open:0})), 1);
119+
eq("File \"name_mangle_test.ml\", line 90, characters 7-14", f5({open:0}), 1);
120120

121-
eq("File \"name_mangle_test.ml\", line 91, characters 7-14", f6(({ "'x" :0})), 1);
121+
eq("File \"name_mangle_test.ml\", line 91, characters 7-14", f6({ "'x" :0}), 1);
122122

123-
eq("File \"name_mangle_test.ml\", line 92, characters 7-14", f7(({_Capital:0})), 1);
123+
eq("File \"name_mangle_test.ml\", line 92, characters 7-14", f7({_Capital:0}), 1);
124124

125-
eq("File \"name_mangle_test.ml\", line 93, characters 7-14", f8(({_MAX:0})), 1);
125+
eq("File \"name_mangle_test.ml\", line 93, characters 7-14", f8({_MAX:0}), 1);
126126

127-
eq("File \"name_mangle_test.ml\", line 94, characters 7-14", f9(({__:0})), 1);
127+
eq("File \"name_mangle_test.ml\", line 94, characters 7-14", f9({__:0}), 1);
128128

129-
eq("File \"name_mangle_test.ml\", line 95, characters 7-14", f10(({__x:0})), 1);
129+
eq("File \"name_mangle_test.ml\", line 95, characters 7-14", f10({__x:0}), 1);
130130

131-
eq("File \"name_mangle_test.ml\", line 96, characters 7-14", f11(({_:0})), 1);
131+
eq("File \"name_mangle_test.ml\", line 96, characters 7-14", f11({_:0}), 1);
132132

133-
eq("File \"name_mangle_test.ml\", line 97, characters 7-14", f12(({__:0})), 1);
133+
eq("File \"name_mangle_test.ml\", line 97, characters 7-14", f12({__:0}), 1);
134134

135135
Mt.from_pair_suites("File \"name_mangle_test.ml\", line 101, characters 23-30", suites.contents);
136136

jscomp/test/unsafe_ppx_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Mt.from_pair_suites("Unsafe_ppx_test", {
9292
return {
9393
TAG: /* Eq */0,
9494
_0: ["a"],
95-
_1: Ffi_js_test.keys(({a : 3}))
95+
_1: Ffi_js_test.keys({a : 3})
9696
};
9797
})
9898
],

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 112 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -117232,96 +117232,6 @@ and compile_lambda
117232117232
| Lsend(meth_kind,met, obj, args,_loc) ->
117233117233
compile_send meth_kind met obj args lambda_cxt
117234117234

117235-
end
117236-
module File_key
117237-
= struct
117238-
#1 "file_key.ml"
117239-
(*
117240-
* Copyright (c) Facebook, Inc. and its affiliates.
117241-
*
117242-
* This source code is licensed under the MIT license found in the
117243-
* LICENSE file in the root directory of this source tree.
117244-
*)
117245-
117246-
type t =
117247-
| LibFile of string
117248-
| SourceFile of string
117249-
| JsonFile of string
117250-
(* A resource that might get required, like .css, .jpg, etc. We don't parse
117251-
these, just check that they exist *)
117252-
| ResourceFile of string
117253-
| Builtins
117254-
[@@deriving show, eq]
117255-
117256-
let to_string = function
117257-
| LibFile x
117258-
| SourceFile x
117259-
| JsonFile x
117260-
| ResourceFile x ->
117261-
x
117262-
| Builtins -> "(global)"
117263-
117264-
(* let to_path = function
117265-
| LibFile x
117266-
| SourceFile x
117267-
| JsonFile x
117268-
| ResourceFile x ->
117269-
Ok x
117270-
| Builtins -> Error "File key refers to a builtin" *)
117271-
117272-
let compare =
117273-
(* builtins, then libs, then source and json files at the same priority since
117274-
JSON files are basically source files. We don't actually read resource
117275-
files so they come last *)
117276-
let order_of_filename = function
117277-
| Builtins -> 1
117278-
| LibFile _ -> 2
117279-
| SourceFile _ -> 3
117280-
| JsonFile _ -> 3
117281-
| ResourceFile _ -> 4
117282-
in
117283-
fun a b ->
117284-
let k = order_of_filename a - order_of_filename b in
117285-
if k <> 0 then
117286-
k
117287-
else
117288-
String.compare (to_string a) (to_string b)
117289-
117290-
let compare_opt a b =
117291-
match (a, b) with
117292-
| (Some _, None) -> -1
117293-
| (None, Some _) -> 1
117294-
| (None, None) -> 0
117295-
| (Some a, Some b) -> compare a b
117296-
117297-
(* let is_lib_file = function
117298-
| LibFile _ -> true
117299-
| Builtins -> true
117300-
| SourceFile _ -> false
117301-
| JsonFile _ -> false
117302-
| ResourceFile _ -> false *)
117303-
117304-
(* let map f = function
117305-
| LibFile filename -> LibFile (f filename)
117306-
| SourceFile filename -> SourceFile (f filename)
117307-
| JsonFile filename -> JsonFile (f filename)
117308-
| ResourceFile filename -> ResourceFile (f filename)
117309-
| Builtins -> Builtins *)
117310-
117311-
(* let exists f = function
117312-
| LibFile filename
117313-
| SourceFile filename
117314-
| JsonFile filename
117315-
| ResourceFile filename ->
117316-
f filename
117317-
| Builtins -> false *)
117318-
117319-
(* let check_suffix filename suffix = exists (fun fn -> Filename.check_suffix fn suffix) filename
117320-
117321-
let chop_suffix filename suffix = map (fun fn -> Filename.chop_suffix fn suffix) filename
117322-
117323-
let with_suffix filename suffix = map (fun fn -> fn ^ suffix) filename *)
117324-
117325117235
end
117326117236
module Flow_ast
117327117237
= struct
@@ -118854,6 +118764,96 @@ end =
118854118764

118855118765
type ('M, 'T) program = 'M * ('M, 'T) Statement.t list * 'M Comment.t list [@@deriving show]
118856118766

118767+
end
118768+
module File_key
118769+
= struct
118770+
#1 "file_key.ml"
118771+
(*
118772+
* Copyright (c) Facebook, Inc. and its affiliates.
118773+
*
118774+
* This source code is licensed under the MIT license found in the
118775+
* LICENSE file in the root directory of this source tree.
118776+
*)
118777+
118778+
type t =
118779+
| LibFile of string
118780+
| SourceFile of string
118781+
| JsonFile of string
118782+
(* A resource that might get required, like .css, .jpg, etc. We don't parse
118783+
these, just check that they exist *)
118784+
| ResourceFile of string
118785+
| Builtins
118786+
[@@deriving show, eq]
118787+
118788+
let to_string = function
118789+
| LibFile x
118790+
| SourceFile x
118791+
| JsonFile x
118792+
| ResourceFile x ->
118793+
x
118794+
| Builtins -> "(global)"
118795+
118796+
(* let to_path = function
118797+
| LibFile x
118798+
| SourceFile x
118799+
| JsonFile x
118800+
| ResourceFile x ->
118801+
Ok x
118802+
| Builtins -> Error "File key refers to a builtin" *)
118803+
118804+
let compare =
118805+
(* builtins, then libs, then source and json files at the same priority since
118806+
JSON files are basically source files. We don't actually read resource
118807+
files so they come last *)
118808+
let order_of_filename = function
118809+
| Builtins -> 1
118810+
| LibFile _ -> 2
118811+
| SourceFile _ -> 3
118812+
| JsonFile _ -> 3
118813+
| ResourceFile _ -> 4
118814+
in
118815+
fun a b ->
118816+
let k = order_of_filename a - order_of_filename b in
118817+
if k <> 0 then
118818+
k
118819+
else
118820+
String.compare (to_string a) (to_string b)
118821+
118822+
let compare_opt a b =
118823+
match (a, b) with
118824+
| (Some _, None) -> -1
118825+
| (None, Some _) -> 1
118826+
| (None, None) -> 0
118827+
| (Some a, Some b) -> compare a b
118828+
118829+
(* let is_lib_file = function
118830+
| LibFile _ -> true
118831+
| Builtins -> true
118832+
| SourceFile _ -> false
118833+
| JsonFile _ -> false
118834+
| ResourceFile _ -> false *)
118835+
118836+
(* let map f = function
118837+
| LibFile filename -> LibFile (f filename)
118838+
| SourceFile filename -> SourceFile (f filename)
118839+
| JsonFile filename -> JsonFile (f filename)
118840+
| ResourceFile filename -> ResourceFile (f filename)
118841+
| Builtins -> Builtins *)
118842+
118843+
(* let exists f = function
118844+
| LibFile filename
118845+
| SourceFile filename
118846+
| JsonFile filename
118847+
| ResourceFile filename ->
118848+
f filename
118849+
| Builtins -> false *)
118850+
118851+
(* let check_suffix filename suffix = exists (fun fn -> Filename.check_suffix fn suffix) filename
118852+
118853+
let chop_suffix filename suffix = map (fun fn -> Filename.chop_suffix fn suffix) filename
118854+
118855+
let with_suffix filename suffix = map (fun fn -> fn ^ suffix) filename *)
118856+
118857118857
end
118858118858
module Loc : sig
118859118859
#1 "loc.mli"
@@ -396397,6 +396397,26 @@ end = struct
396397396397
* along with this program; if not, write to the Free Software
396398396398
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
396399396399

396400+
396401+
let rec is_obj_literal ( x : _ Flow_ast.Expression.t) : bool =
396402+
match snd x with
396403+
| Literal _ -> true
396404+
| Object {properties} ->
396405+
Ext_list.for_all properties is_literal_kv
396406+
| Array {elements} ->
396407+
Ext_list.for_all elements (fun x ->
396408+
match x with
396409+
| None -> true
396410+
| Some (Expression x) -> is_obj_literal x
396411+
| Some _ -> false
396412+
)
396413+
| _ -> false
396414+
and is_literal_kv (x : _ Flow_ast.Expression.Object.property) =
396415+
match x with
396416+
| Property (_ , Init {value}) -> is_obj_literal value
396417+
| _ -> false
396418+
396419+
396400396420
let classify (prog : string) : Js_raw_info.exp =
396401396421
match Parser_flow.parse_expression
396402396422
(Parser_env.init_env None prog) false with
@@ -396426,6 +396446,8 @@ let classify (prog : string) : Js_raw_info.exp =
396426396446
| Some _ -> None
396427396447
in
396428396448
Js_literal {comment}
396449+
| (_,Object _) as exp , _ ->
396450+
if is_obj_literal exp then Js_literal {comment = None} else Js_exp_unknown
396429396451
| _ ->
396430396452
Js_exp_unknown
396431396453
| exception _ ->

0 commit comments

Comments
 (0)