Skip to content

Commit 00d12ff

Browse files
committed
tweak
1 parent de3b14a commit 00d12ff

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

jscomp/syntax/ast_core_type.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ let lift_option_type ({ptyp_loc} as ty:t) : t =
4242
ptyp_attributes = []
4343
}
4444

45-
let is_any (ty : t) =
46-
ty.ptyp_desc = Ptyp_any
4745

4846
open Ast_helper
4947

jscomp/syntax/ast_core_type.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type t = Parsetree.core_type
2828

2929

3030
val lift_option_type : t -> t
31-
val is_any : t -> bool
31+
3232
(* val replace_result : t -> t -> t *)
3333

3434
(* val opt_arrow: Location.t -> string -> t -> t -> t *)

jscomp/syntax/ast_external_process.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ let spec_of_ptyp
9797
*)
9898
let refine_arg_type ~(nolabel:bool) (ptyp : Ast_core_type.t)
9999
: Ast_core_type.t * External_arg_spec.attr =
100-
if Ast_core_type.is_any ptyp then (* (_[@bs.as ])*)
100+
if ptyp.ptyp_desc = Ptyp_any then
101101
let ptyp_attrs = ptyp.ptyp_attributes in
102102
let result = Ast_attributes.iter_process_bs_string_or_int_as ptyp_attrs in
103103
(* when ppx start dropping attributes
@@ -108,7 +108,7 @@ let refine_arg_type ~(nolabel:bool) (ptyp : Ast_core_type.t)
108108
match result with
109109
| None ->
110110
Bs_syntaxerr.err ptyp.ptyp_loc Invalid_underscore_type_in_external
111-
| Some (Int i) ->
111+
| Some (Int i) -> (* (_[@bs.as ])*)
112112
(* This type is used in bs.obj only to construct obj type*)
113113
Ast_literal.type_int ~loc:ptyp.ptyp_loc (), Arg_cst(External_arg_spec.cst_int i)
114114
| Some (Str i)->
@@ -133,7 +133,7 @@ let get_opt_arg_type
133133
~(nolabel : bool)
134134
(ptyp : Ast_core_type.t) :
135135
External_arg_spec.attr =
136-
if Ast_core_type.is_any ptyp then (* (_[@bs.as ])*)
136+
if ptyp.ptyp_desc = Ptyp_any then (* (_[@bs.as ])*)
137137
(* extenral f : ?x:_ -> y:int -> _ = "" [@@bs.obj] is not allowed *)
138138
Bs_syntaxerr.err ptyp.ptyp_loc Invalid_underscore_type_in_external;
139139
(* ([`a|`b] [@bs.string]) *)
@@ -496,7 +496,7 @@ let process_obj
496496
output_tys) in
497497

498498
let result =
499-
if Ast_core_type.is_any result_type then
499+
if result_type.ptyp_desc = Ptyp_any then
500500
Ast_core_type.make_obj ~loc result_types
501501
else
502502
fst (refine_arg_type ~nolabel:true result_type)
@@ -882,7 +882,7 @@ let handle_attributes
882882
Location.raise_errorf ~loc "[@@@@bs.splice] expect the last type to be a non optional"
883883
| Labelled _ | Nolabel
884884
->
885-
if Ast_core_type.is_any ty then
885+
if ty.ptyp_desc = Ptyp_any then
886886
Location.raise_errorf ~loc "[@@@@bs.splice] expect the last type to be an array";
887887
if spec_of_ptyp true ty <> Nothing then
888888
Location.raise_errorf ~loc "[@@@@bs.splice] expect the last type to be an array";

0 commit comments

Comments
 (0)