Skip to content

Commit 350a2c8

Browse files
committed
Lib: clean for warnings
1 parent 7d1e281 commit 350a2c8

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

lib/ppx/ppx_js.cppo.ml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ open Ast_mapper
55
open Ast_helper
66
open Asttypes
77
open Parsetree
8-
98
open Ast_convenience
109

1110
(** Check if an expression is an identifier and returns it.
1211
Raise a Location.error if it's not.
1312
*)
1413
let exp_to_string = function
15-
| {pexp_desc= Pexp_ident {txt = Longident.Lident s}} -> s
16-
| {pexp_desc= Pexp_construct ({txt = Longident.Lident s}, None)}
14+
| {pexp_desc= Pexp_ident {txt = Longident.Lident s; _}; _} -> s
15+
| {pexp_desc= Pexp_construct ({txt = Longident.Lident s; _}, None); _}
1716
when String.length s > 0
1817
&& s.[0] >= 'A'
1918
&& s.[0] <= 'Z' -> "_"^s
20-
| {pexp_loc} ->
19+
| {pexp_loc; _} ->
2120
Location.raise_errorf
2221
~loc:pexp_loc
2322
"Javascript methods or attributes can only be simple identifiers."
@@ -64,7 +63,7 @@ module Js = struct
6463
then Typ.constr ?loc (lid s) args
6564
else Typ.constr ?loc (lid @@ "Js."^s) args
6665

67-
#if OCAML_VERSION < (4,03,0)
66+
#if OCAML_VERSION < (4, 03, 0)
6867
let nolabel = ""
6968
#else
7069
let nolabel = Nolabel
@@ -309,7 +308,7 @@ let literal_object self_id fields =
309308

310309
let rec annotate_body fun_ty ret_ty body = match fun_ty, body with
311310
| (_,ty) :: types,
312-
({ pexp_desc = Pexp_fun (label, e_opt, pat, body)} as expr) ->
311+
({ pexp_desc = Pexp_fun (label, e_opt, pat, body); _} as expr) ->
313312
let constr = Pat.constraint_ pat ty in
314313
{expr with
315314
pexp_desc =
@@ -367,7 +366,7 @@ let js_mapper _args =
367366
{ default_mapper with
368367
expr = (fun mapper expr ->
369368
default_loc := expr.pexp_loc;
370-
let { pexp_attributes } = expr in
369+
let { pexp_attributes; _ } = expr in
371370
match expr with
372371

373372
(* obj##.var *)
@@ -414,9 +413,10 @@ let js_mapper _args =
414413
(* obj##meth arg1 arg2 .. *)
415414
(* obj##(meth arg1 arg2) .. *)
416415
| {pexp_desc = Pexp_apply
417-
(([%expr [%e? obj] ## [%e? meth]] as expr), args)
416+
(([%expr [%e? obj] ## [%e? meth]] as expr), args);
417+
_
418418
}
419-
| [%expr [%e? obj] ## [%e? {pexp_desc = Pexp_apply((meth as expr),args)}]]
419+
| [%expr [%e? obj] ## [%e? {pexp_desc = Pexp_apply((meth as expr),args); _ }]]
420420
->
421421
let meth = exp_to_string meth in
422422
let new_expr =
@@ -431,22 +431,23 @@ let js_mapper _args =
431431

432432

433433
(* new%js constr] *)
434-
| [%expr [%js [%e? {pexp_desc = Pexp_new constr}]]] ->
434+
| [%expr [%js [%e? {pexp_desc = Pexp_new constr; _}]]] ->
435435
let new_expr =
436436
new_object constr []
437437
in mapper.expr mapper { new_expr with pexp_attributes }
438438
(* new%js constr arg1 arg2 ..)] *)
439439
| {pexp_desc = Pexp_apply
440-
([%expr [%js [%e? {pexp_desc = Pexp_new constr}]]]
441-
, args)
440+
([%expr [%js [%e? {pexp_desc = Pexp_new constr; _}]]]
441+
, args);
442+
_
442443
} ->
443444
let new_expr =
444445
new_object constr args
445446
in mapper.expr mapper { new_expr with pexp_attributes }
446447

447448

448449
(* object%js ... end *)
449-
| [%expr [%js [%e? {pexp_desc = Pexp_object class_struct} ]]] ->
450+
| [%expr [%js [%e? {pexp_desc = Pexp_object class_struct; _} ]]] ->
450451
let fields = preprocess_literal_object class_struct.pcstr_fields in
451452
let new_expr = match fields with
452453
| `Fields fields ->

0 commit comments

Comments
 (0)