Skip to content

Commit 987ab5d

Browse files
committed
snapshot
1 parent 5e3ed85 commit 987ab5d

File tree

3 files changed

+93
-102
lines changed

3 files changed

+93
-102
lines changed

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -400708,11 +400708,8 @@ val process_bs :
400708400708
val external_needs_to_be_encoded :
400709400709
t -> bool
400710400710

400711-
val has_inline_in_stru :
400712-
t ->
400713-
bool
400714400711

400715-
val has_inline_payload_in_sig :
400712+
val has_inline_payload :
400716400713
t ->
400717400714
attr option
400718400715

@@ -400909,17 +400906,12 @@ let external_needs_to_be_encoded (attrs : t)=
400909400906

400910400907
let is_inline : attr -> bool =
400911400908
(fun
400912-
(({txt;},_) as attr) ->
400913-
let b = txt = "bs.inline" || txt = "inline" in
400914-
(if b then
400915-
Bs_ast_invariant.mark_used_bs_attribute attr);
400916-
b
400917-
) (* still needs to be marked, since we are going to drop it right now *)
400909+
(({txt;},_)) ->
400910+
txt = "bs.inline" || txt = "inline"
400911+
)
400918400912

400919-
let has_inline_in_stru (attrs : t) : bool =
400920-
Ext_list.exists attrs is_inline
400921400913

400922-
let has_inline_payload_in_sig (attrs : t) =
400914+
let has_inline_payload (attrs : t) =
400923400915
Ext_list.find_first attrs is_inline
400924400916

400925400917

@@ -407201,7 +407193,7 @@ let isAbstract (xs :Ast_payload.action list) =
407201407193
match txt with
407202407194
| "abstract" ->
407203407195
Location.raise_errorf ~loc
407204-
"bs.deriving abstract does not work with any other deriving"
407196+
"deriving abstract does not work with any other deriving"
407205407197
| _ -> ()
407206407198
) ;
407207407199
Not_abstract
@@ -407819,7 +407811,12 @@ let () =
407819407811
Ast_derive_js_mapper.init ()
407820407812

407821407813

407822-
407814+
let succeed attr attrs =
407815+
match attrs with
407816+
| [ _ ] -> ()
407817+
| _ ->
407818+
Bs_ast_invariant.mark_used_bs_attribute attr;
407819+
Bs_ast_invariant.warn_discarded_unused_attributes attrs
407823407820

407824407821
type mapper = Bs_ast_mapper.mapper
407825407822
let default_mapper = Bs_ast_mapper.default_mapper
@@ -408002,14 +407999,14 @@ let signature_item_mapper (self : mapper) (sigi : Parsetree.signature_item) =
408002407999
Ast_external.handleExternalInSig self value_desc sigi
408003408000
else
408004408001
(match
408005-
Ast_attributes.has_inline_payload_in_sig
408002+
Ast_attributes.has_inline_payload
408006408003
pval_attributes with
408007-
| Some (_,PStr [{pstr_desc = Pstr_eval ({pexp_desc },_)}]) ->
408004+
| Some ((_,PStr [{pstr_desc = Pstr_eval ({pexp_desc },_)}]) as attr) ->
408008408005
begin match pexp_desc with
408009408006
| Pexp_constant (
408010408007
Pconst_string
408011408008
(s,dec)) ->
408012-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408009+
succeed attr pval_attributes;
408013408010
{ sigi with
408014408011
psig_desc = Psig_value
408015408012
{
@@ -408019,8 +408016,8 @@ let signature_item_mapper (self : mapper) (sigi : Parsetree.signature_item) =
408019408016
}}
408020408017
| Pexp_constant(
408021408018
Pconst_integer (s,None)
408022-
) ->
408023-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408019+
) ->
408020+
succeed attr pval_attributes;
408024408021
let s = Int32.of_string s in
408025408022
{ sigi with
408026408023
psig_desc = Psig_value
@@ -408032,22 +408029,22 @@ let signature_item_mapper (self : mapper) (sigi : Parsetree.signature_item) =
408032408029
| Pexp_constant(Pconst_integer (s, Some 'L'))
408033408030
->
408034408031
let s = Int64.of_string s in
408035-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408032+
succeed attr pval_attributes;
408036408033
{sigi with psig_desc = Psig_value {
408037408034
value_desc with
408038408035
pval_prim = External_ffi_types.inline_int64_primitive s;
408039408036
pval_attributes = [];
408040408037
} }
408041408038
| Pexp_constant (Pconst_float(s,None)) ->
408042-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408039+
succeed attr pval_attributes;
408043408040
{sigi with psig_desc = Psig_value {
408044408041
value_desc with
408045408042
pval_prim = External_ffi_types.inline_float_primitive s;
408046408043
pval_attributes = [];
408047408044
} }
408048408045
| Pexp_construct ({txt = Lident ("true" | "false" as txt)}, None)
408049408046
->
408050-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408047+
succeed attr pval_attributes;
408051408048
{ sigi with
408052408049
psig_desc = Psig_value
408053408050
{
@@ -408085,54 +408082,54 @@ let structure_item_mapper (self : mapper) (str : Parsetree.structure_item) =
408085408082
->
408086408083
let pvb_expr = self.expr self pvb_expr in
408087408084
let pvb_attributes = self.attributes self pvb_attributes in
408088-
let has_inline_property = Ast_attributes.has_inline_in_stru pvb_attributes in
408085+
let has_inline_property = Ast_attributes.has_inline_payload pvb_attributes in
408089408086
begin match has_inline_property, pvb_expr.pexp_desc with
408090-
| true, Pexp_constant(
408087+
| Some attr, Pexp_constant(
408091408088
Pconst_string
408092408089
(s,dec))
408093408090
->
408094-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408091+
succeed attr pvb_attributes;
408095408092
{str with pstr_desc = Pstr_primitive {
408096408093
pval_name = pval_name ;
408097408094
pval_type = Ast_literal.type_string ();
408098408095
pval_loc = pvb_loc;
408099408096
pval_attributes = [];
408100408097
pval_prim = External_ffi_types.inline_string_primitive s dec
408101408098
} }
408102-
| true, Pexp_constant(Pconst_integer (s,None))
408099+
| Some attr, Pexp_constant(Pconst_integer (s,None))
408103408100
->
408104408101
let s = Int32.of_string s in
408105-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408102+
succeed attr pvb_attributes;
408106408103
{str with pstr_desc = Pstr_primitive {
408107408104
pval_name = pval_name ;
408108408105
pval_type = Ast_literal.type_int ();
408109408106
pval_loc = pvb_loc;
408110408107
pval_attributes = [];
408111408108
pval_prim = External_ffi_types.inline_int_primitive s
408112408109
} }
408113-
| true, Pexp_constant(Pconst_integer (s, Some 'L'))
408110+
| Some attr, Pexp_constant(Pconst_integer (s, Some 'L'))
408114408111
->
408115408112
let s = Int64.of_string s in
408116-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408113+
succeed attr pvb_attributes;
408117408114
{str with pstr_desc = Pstr_primitive {
408118408115
pval_name = pval_name ;
408119408116
pval_type = Ast_literal.type_int64;
408120408117
pval_loc = pvb_loc;
408121408118
pval_attributes = [];
408122408119
pval_prim = External_ffi_types.inline_int64_primitive s
408123408120
} }
408124-
| true, Pexp_constant(Pconst_float (s, None))
408121+
| Some attr, Pexp_constant(Pconst_float (s, None))
408125408122
->
408126-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408123+
succeed attr pvb_attributes;
408127408124
{str with pstr_desc = Pstr_primitive {
408128408125
pval_name = pval_name ;
408129408126
pval_type = Ast_literal.type_float;
408130408127
pval_loc = pvb_loc;
408131408128
pval_attributes = [];
408132408129
pval_prim = External_ffi_types.inline_float_primitive s
408133408130
} }
408134-
| true, Pexp_construct ({txt = Lident ("true" | "false" as txt) },None) ->
408135-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408131+
| Some attr, Pexp_construct ({txt = Lident ("true" | "false" as txt) },None) ->
408132+
succeed attr pvb_attributes;
408136408133
{str with pstr_desc = Pstr_primitive {
408137408134
pval_name = pval_name ;
408138408135
pval_type = Ast_literal.type_bool ();

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -400708,11 +400708,8 @@ val process_bs :
400708400708
val external_needs_to_be_encoded :
400709400709
t -> bool
400710400710

400711-
val has_inline_in_stru :
400712-
t ->
400713-
bool
400714400711

400715-
val has_inline_payload_in_sig :
400712+
val has_inline_payload :
400716400713
t ->
400717400714
attr option
400718400715

@@ -400909,17 +400906,12 @@ let external_needs_to_be_encoded (attrs : t)=
400909400906

400910400907
let is_inline : attr -> bool =
400911400908
(fun
400912-
(({txt;},_) as attr) ->
400913-
let b = txt = "bs.inline" || txt = "inline" in
400914-
(if b then
400915-
Bs_ast_invariant.mark_used_bs_attribute attr);
400916-
b
400917-
) (* still needs to be marked, since we are going to drop it right now *)
400909+
(({txt;},_)) ->
400910+
txt = "bs.inline" || txt = "inline"
400911+
)
400918400912

400919-
let has_inline_in_stru (attrs : t) : bool =
400920-
Ext_list.exists attrs is_inline
400921400913

400922-
let has_inline_payload_in_sig (attrs : t) =
400914+
let has_inline_payload (attrs : t) =
400923400915
Ext_list.find_first attrs is_inline
400924400916

400925400917

@@ -407201,7 +407193,7 @@ let isAbstract (xs :Ast_payload.action list) =
407201407193
match txt with
407202407194
| "abstract" ->
407203407195
Location.raise_errorf ~loc
407204-
"bs.deriving abstract does not work with any other deriving"
407196+
"deriving abstract does not work with any other deriving"
407205407197
| _ -> ()
407206407198
) ;
407207407199
Not_abstract
@@ -407819,7 +407811,12 @@ let () =
407819407811
Ast_derive_js_mapper.init ()
407820407812

407821407813

407822-
407814+
let succeed attr attrs =
407815+
match attrs with
407816+
| [ _ ] -> ()
407817+
| _ ->
407818+
Bs_ast_invariant.mark_used_bs_attribute attr;
407819+
Bs_ast_invariant.warn_discarded_unused_attributes attrs
407823407820

407824407821
type mapper = Bs_ast_mapper.mapper
407825407822
let default_mapper = Bs_ast_mapper.default_mapper
@@ -408002,14 +407999,14 @@ let signature_item_mapper (self : mapper) (sigi : Parsetree.signature_item) =
408002407999
Ast_external.handleExternalInSig self value_desc sigi
408003408000
else
408004408001
(match
408005-
Ast_attributes.has_inline_payload_in_sig
408002+
Ast_attributes.has_inline_payload
408006408003
pval_attributes with
408007-
| Some (_,PStr [{pstr_desc = Pstr_eval ({pexp_desc },_)}]) ->
408004+
| Some ((_,PStr [{pstr_desc = Pstr_eval ({pexp_desc },_)}]) as attr) ->
408008408005
begin match pexp_desc with
408009408006
| Pexp_constant (
408010408007
Pconst_string
408011408008
(s,dec)) ->
408012-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408009+
succeed attr pval_attributes;
408013408010
{ sigi with
408014408011
psig_desc = Psig_value
408015408012
{
@@ -408019,8 +408016,8 @@ let signature_item_mapper (self : mapper) (sigi : Parsetree.signature_item) =
408019408016
}}
408020408017
| Pexp_constant(
408021408018
Pconst_integer (s,None)
408022-
) ->
408023-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408019+
) ->
408020+
succeed attr pval_attributes;
408024408021
let s = Int32.of_string s in
408025408022
{ sigi with
408026408023
psig_desc = Psig_value
@@ -408032,22 +408029,22 @@ let signature_item_mapper (self : mapper) (sigi : Parsetree.signature_item) =
408032408029
| Pexp_constant(Pconst_integer (s, Some 'L'))
408033408030
->
408034408031
let s = Int64.of_string s in
408035-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408032+
succeed attr pval_attributes;
408036408033
{sigi with psig_desc = Psig_value {
408037408034
value_desc with
408038408035
pval_prim = External_ffi_types.inline_int64_primitive s;
408039408036
pval_attributes = [];
408040408037
} }
408041408038
| Pexp_constant (Pconst_float(s,None)) ->
408042-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408039+
succeed attr pval_attributes;
408043408040
{sigi with psig_desc = Psig_value {
408044408041
value_desc with
408045408042
pval_prim = External_ffi_types.inline_float_primitive s;
408046408043
pval_attributes = [];
408047408044
} }
408048408045
| Pexp_construct ({txt = Lident ("true" | "false" as txt)}, None)
408049408046
->
408050-
Bs_ast_invariant.warn_discarded_unused_attributes pval_attributes;
408047+
succeed attr pval_attributes;
408051408048
{ sigi with
408052408049
psig_desc = Psig_value
408053408050
{
@@ -408085,54 +408082,54 @@ let structure_item_mapper (self : mapper) (str : Parsetree.structure_item) =
408085408082
->
408086408083
let pvb_expr = self.expr self pvb_expr in
408087408084
let pvb_attributes = self.attributes self pvb_attributes in
408088-
let has_inline_property = Ast_attributes.has_inline_in_stru pvb_attributes in
408085+
let has_inline_property = Ast_attributes.has_inline_payload pvb_attributes in
408089408086
begin match has_inline_property, pvb_expr.pexp_desc with
408090-
| true, Pexp_constant(
408087+
| Some attr, Pexp_constant(
408091408088
Pconst_string
408092408089
(s,dec))
408093408090
->
408094-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408091+
succeed attr pvb_attributes;
408095408092
{str with pstr_desc = Pstr_primitive {
408096408093
pval_name = pval_name ;
408097408094
pval_type = Ast_literal.type_string ();
408098408095
pval_loc = pvb_loc;
408099408096
pval_attributes = [];
408100408097
pval_prim = External_ffi_types.inline_string_primitive s dec
408101408098
} }
408102-
| true, Pexp_constant(Pconst_integer (s,None))
408099+
| Some attr, Pexp_constant(Pconst_integer (s,None))
408103408100
->
408104408101
let s = Int32.of_string s in
408105-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408102+
succeed attr pvb_attributes;
408106408103
{str with pstr_desc = Pstr_primitive {
408107408104
pval_name = pval_name ;
408108408105
pval_type = Ast_literal.type_int ();
408109408106
pval_loc = pvb_loc;
408110408107
pval_attributes = [];
408111408108
pval_prim = External_ffi_types.inline_int_primitive s
408112408109
} }
408113-
| true, Pexp_constant(Pconst_integer (s, Some 'L'))
408110+
| Some attr, Pexp_constant(Pconst_integer (s, Some 'L'))
408114408111
->
408115408112
let s = Int64.of_string s in
408116-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408113+
succeed attr pvb_attributes;
408117408114
{str with pstr_desc = Pstr_primitive {
408118408115
pval_name = pval_name ;
408119408116
pval_type = Ast_literal.type_int64;
408120408117
pval_loc = pvb_loc;
408121408118
pval_attributes = [];
408122408119
pval_prim = External_ffi_types.inline_int64_primitive s
408123408120
} }
408124-
| true, Pexp_constant(Pconst_float (s, None))
408121+
| Some attr, Pexp_constant(Pconst_float (s, None))
408125408122
->
408126-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408123+
succeed attr pvb_attributes;
408127408124
{str with pstr_desc = Pstr_primitive {
408128408125
pval_name = pval_name ;
408129408126
pval_type = Ast_literal.type_float;
408130408127
pval_loc = pvb_loc;
408131408128
pval_attributes = [];
408132408129
pval_prim = External_ffi_types.inline_float_primitive s
408133408130
} }
408134-
| true, Pexp_construct ({txt = Lident ("true" | "false" as txt) },None) ->
408135-
Bs_ast_invariant.warn_discarded_unused_attributes pvb_attributes;
408131+
| Some attr, Pexp_construct ({txt = Lident ("true" | "false" as txt) },None) ->
408132+
succeed attr pvb_attributes;
408136408133
{str with pstr_desc = Pstr_primitive {
408137408134
pval_name = pval_name ;
408138408135
pval_type = Ast_literal.type_bool ();

0 commit comments

Comments
 (0)