Skip to content

Commit da8c067

Browse files
authored
Merge pull request #59 from o-marshmallow/master
Corrected new constructor names
2 parents 442eaf8 + 68ea3ad commit da8c067

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/gen_js_api.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ let str_of_payload loc = function
7575
| _ -> error loc Structure_expected
7676

7777
let id_of_expr = function
78-
| {pexp_desc=Pexp_constant (PConst_string (s, _)); _}
78+
| {pexp_desc=Pexp_constant (Pconst_string (s, _)); _}
7979
| {pexp_desc=Pexp_ident {txt=Lident s;_}; _}
8080
| {pexp_desc=Pexp_construct ({txt=Lident s;_}, None); _} -> s
8181
| e -> error e.pexp_loc Identifier_expected
@@ -180,8 +180,8 @@ let get_js_constr ~global_attrs name attributes =
180180
| None -> `String (js_name ~global_attrs name)
181181
| Some (k, v) ->
182182
begin match (expr_of_payload k.loc v).pexp_desc with
183-
| Pexp_constant (PConst_string (s, _)) -> `String s
184-
| Pexp_constant (PConst_int (n, _)) -> `Int (int_of_string n)
183+
| Pexp_constant (Pconst_string (s, _)) -> `String s
184+
| Pexp_constant (Pconst_integer (n, _)) -> `Int (int_of_string n)
185185
| _ -> error k.loc Invalid_expression
186186
end
187187

@@ -553,10 +553,10 @@ and parse_class_field ~global_attrs = function
553553
(** Code generation *)
554554

555555
let var x = Exp.ident (mknoloc (Longident.parse x))
556-
let str s = Exp.constant (PConst_string (s, None))
557-
let int n = Exp.constant (PConst_int (string_of_int n, None))
558-
let pat_int n = Pat.constant (PConst_int (string_of_int n, None))
559-
let pat_str s = Pat.constant (PConst_string (s, None))
556+
let str s = Exp.constant (Pconst_string (s, None))
557+
let int n = Exp.constant (Pconst_integer (string_of_int n, None))
558+
let pat_int n = Pat.constant (Pconst_integer (string_of_int n, None))
559+
let pat_str s = Pat.constant (Pconst_string (s, None))
560560

561561
let attr s e = Str.attribute (mknoloc s, PStr [Str.eval e])
562562

@@ -740,7 +740,7 @@ let get_variant_kind loc attrs =
740740
| PStr [] -> `Union No_discriminator
741741
| _ ->
742742
begin match expr_of_payload k.loc v with
743-
| {pexp_desc = Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident "on_field";_}; _}, [Nolabel, {pexp_desc = Pexp_constant (PConst_string (s, _)); _}]); _} -> `Union (On_field s)
743+
| {pexp_desc = Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident "on_field";_}; _}, [Nolabel, {pexp_desc = Pexp_constant (Pconst_string (s, _)); _}]); _} -> `Union (On_field s)
744744
| _ -> error k.loc Unknown_union_method
745745
end
746746
end

0 commit comments

Comments
 (0)