Skip to content

Commit dbf3f69

Browse files
committed
clean up
1 parent 1bf1afd commit dbf3f69

File tree

4 files changed

+56
-32
lines changed

4 files changed

+56
-32
lines changed

jscomp/core/js_dump.ml

+14-8
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,20 @@ and expression_desc cxt ~(level : int) f x : cxt =
757757
(if !Js_config.debug then [ (name_symbol, E.str p.name) ] else [])
758758
(fun i -> Js_op.Lit i)
759759
in
760+
let is_optional (names: string list) (pname: Js_op.property_name) =
761+
match pname with
762+
| Lit n -> Ext_list.mem_string names n
763+
| Symbol_name -> false
764+
in
765+
let tails =
766+
match p.optional_labels with
767+
| [] -> tails
768+
| _ ->
769+
Ext_list.filter_map tails (fun (f, x) ->
770+
match x.expression_desc with
771+
| Undefined when is_optional p.optional_labels f -> None
772+
| _ -> Some (f, x))
773+
in
760774
if p.num_nonconst = 1 then tails
761775
else
762776
( Js_op.Lit L.tag,
@@ -766,14 +780,6 @@ and expression_desc cxt ~(level : int) f x : cxt =
766780
in
767781
if p.num_nonconst = 1 && not !Js_config.debug then
768782
pp_comment_option f (Some p.name);
769-
let objs = match p.optional_labels with
770-
| [] -> objs
771-
| _ ->
772-
Ext_list.array_list_filter_map p.fields el (fun f x ->
773-
match x.expression_desc with
774-
| Undefined when List.mem f p.optional_labels -> None
775-
| _ -> Some (Js_op.Lit f, x))
776-
in
777783
expression_desc cxt ~level f (Object objs)
778784
| Caml_block (el, _, tag, Blk_constructor p) ->
779785
let not_is_cons = p.name <> Literals.cons in

lib/4.06.1/unstable/js_compiler.ml

+14-8
Original file line numberDiff line numberDiff line change
@@ -81740,6 +81740,20 @@ and expression_desc cxt ~(level : int) f x : cxt =
8174081740
(if !Js_config.debug then [ (name_symbol, E.str p.name) ] else [])
8174181741
(fun i -> Js_op.Lit i)
8174281742
in
81743+
let is_optional (names: string list) (pname: Js_op.property_name) =
81744+
match pname with
81745+
| Lit n -> Ext_list.mem_string names n
81746+
| Symbol_name -> false
81747+
in
81748+
let tails =
81749+
match p.optional_labels with
81750+
| [] -> tails
81751+
| _ ->
81752+
Ext_list.filter_map tails (fun (f, x) ->
81753+
match x.expression_desc with
81754+
| Undefined when is_optional p.optional_labels f -> None
81755+
| _ -> Some (f, x))
81756+
in
8174381757
if p.num_nonconst = 1 then tails
8174481758
else
8174581759
( Js_op.Lit L.tag,
@@ -81749,14 +81763,6 @@ and expression_desc cxt ~(level : int) f x : cxt =
8174981763
in
8175081764
if p.num_nonconst = 1 && not !Js_config.debug then
8175181765
pp_comment_option f (Some p.name);
81752-
let objs = match p.optional_labels with
81753-
| [] -> objs
81754-
| _ ->
81755-
Ext_list.array_list_filter_map p.fields el (fun f x ->
81756-
match x.expression_desc with
81757-
| Undefined when List.mem f p.optional_labels -> None
81758-
| _ -> Some (Js_op.Lit f, x))
81759-
in
8176081766
expression_desc cxt ~level f (Object objs)
8176181767
| Caml_block (el, _, tag, Blk_constructor p) ->
8176281768
let not_is_cons = p.name <> Literals.cons in

lib/4.06.1/unstable/js_playground_compiler.ml

+14-8
Original file line numberDiff line numberDiff line change
@@ -81740,6 +81740,20 @@ and expression_desc cxt ~(level : int) f x : cxt =
8174081740
(if !Js_config.debug then [ (name_symbol, E.str p.name) ] else [])
8174181741
(fun i -> Js_op.Lit i)
8174281742
in
81743+
let is_optional (names: string list) (pname: Js_op.property_name) =
81744+
match pname with
81745+
| Lit n -> Ext_list.mem_string names n
81746+
| Symbol_name -> false
81747+
in
81748+
let tails =
81749+
match p.optional_labels with
81750+
| [] -> tails
81751+
| _ ->
81752+
Ext_list.filter_map tails (fun (f, x) ->
81753+
match x.expression_desc with
81754+
| Undefined when is_optional p.optional_labels f -> None
81755+
| _ -> Some (f, x))
81756+
in
8174381757
if p.num_nonconst = 1 then tails
8174481758
else
8174581759
( Js_op.Lit L.tag,
@@ -81749,14 +81763,6 @@ and expression_desc cxt ~(level : int) f x : cxt =
8174981763
in
8175081764
if p.num_nonconst = 1 && not !Js_config.debug then
8175181765
pp_comment_option f (Some p.name);
81752-
let objs = match p.optional_labels with
81753-
| [] -> objs
81754-
| _ ->
81755-
Ext_list.array_list_filter_map p.fields el (fun f x ->
81756-
match x.expression_desc with
81757-
| Undefined when List.mem f p.optional_labels -> None
81758-
| _ -> Some (Js_op.Lit f, x))
81759-
in
8176081766
expression_desc cxt ~level f (Object objs)
8176181767
| Caml_block (el, _, tag, Blk_constructor p) ->
8176281768
let not_is_cons = p.name <> Literals.cons in

lib/4.06.1/whole_compiler.ml

+14-8
Original file line numberDiff line numberDiff line change
@@ -257572,6 +257572,20 @@ and expression_desc cxt ~(level : int) f x : cxt =
257572257572
(if !Js_config.debug then [ (name_symbol, E.str p.name) ] else [])
257573257573
(fun i -> Js_op.Lit i)
257574257574
in
257575+
let is_optional (names: string list) (pname: Js_op.property_name) =
257576+
match pname with
257577+
| Lit n -> Ext_list.mem_string names n
257578+
| Symbol_name -> false
257579+
in
257580+
let tails =
257581+
match p.optional_labels with
257582+
| [] -> tails
257583+
| _ ->
257584+
Ext_list.filter_map tails (fun (f, x) ->
257585+
match x.expression_desc with
257586+
| Undefined when is_optional p.optional_labels f -> None
257587+
| _ -> Some (f, x))
257588+
in
257575257589
if p.num_nonconst = 1 then tails
257576257590
else
257577257591
( Js_op.Lit L.tag,
@@ -257581,14 +257595,6 @@ and expression_desc cxt ~(level : int) f x : cxt =
257581257595
in
257582257596
if p.num_nonconst = 1 && not !Js_config.debug then
257583257597
pp_comment_option f (Some p.name);
257584-
let objs = match p.optional_labels with
257585-
| [] -> objs
257586-
| _ ->
257587-
Ext_list.array_list_filter_map p.fields el (fun f x ->
257588-
match x.expression_desc with
257589-
| Undefined when List.mem f p.optional_labels -> None
257590-
| _ -> Some (Js_op.Lit f, x))
257591-
in
257592257598
expression_desc cxt ~level f (Object objs)
257593257599
| Caml_block (el, _, tag, Blk_constructor p) ->
257594257600
let not_is_cons = p.name <> Literals.cons in

0 commit comments

Comments
 (0)