@@ -75,8 +75,7 @@ let get_length ~loc label_declaration =
7575 | None -> raise_errorf ~loc " [%s] length attribute must be set" deriver
7676
7777
78- let field_name ~loc txt =
79- pexp_constant ~loc (Pconst_string (txt, None ))
78+ let field_name ~loc txt = estring ~loc txt
8079
8180let get_rtlname ~loc txt label_declaration =
8281 match Attribute. (find rtlname) label_declaration with
@@ -104,7 +103,7 @@ let get_doc ~loc label_declaration =
104103 match Attribute. (find doc) label_declaration with
105104 | Some (expr ) -> (
106105 match expr.pexp_desc with
107- | Pexp_constant (Pconst_string(str , _ )) -> Some str
106+ | Pexp_constant (Pconst_string(str , _ , _ )) -> Some str
108107 | _ -> raise_errorf ~loc " [%s] doc atttribute must be a string" deriver)
109108 | None -> None
110109
@@ -507,7 +506,7 @@ let expand_ast_label opts var
507506 let ast = pexp_ident ~loc (Located. mk ~loc (Ldot (mname, " ast" ))) in
508507 let mname =
509508 let mname = Longident. flatten_exn mname |> String. concat ~sep: " ." in
510- pexp_constant ~loc ( Pconst_string ( mname, None )) in
509+ estring ~loc mname in
511510 [% expr Module { name = [% e mname]
512511 ; ast = [% e ast] }]
513512 in
@@ -559,7 +558,7 @@ let expand_ast_label opts var
559558 let doc =
560559 match get_doc ~loc label_declaration with
561560 | None -> [% expr None ]
562- | Some doc -> [% expr Some [% e pexp_constant ~loc ( Pconst_string ( doc, None )) ]]
561+ | Some doc -> [% expr Some [% e estring ~loc doc]]
563562 in
564563 [% expr { Ppx_deriving_hardcaml_runtime.Interface.Ast.Field.
565564 name = [% e field_name]
0 commit comments