diff --git a/compiler/core/js_dump.ml b/compiler/core/js_dump.ml index fc61d06b51..11c0aeb4a7 100644 --- a/compiler/core/js_dump.ml +++ b/compiler/core/js_dump.ml @@ -1154,7 +1154,7 @@ and print_jsx cxt ?(spread_props : J.expression option) in let print_prop n x ctx = - let prop_name = Js_dump_property.property_key_string n in + let prop_name = Ext_ident.unwrap_uppercase_exotic n in P.string f prop_name; P.string f "="; print_prop_value x ctx diff --git a/compiler/core/js_dump_property.ml b/compiler/core/js_dump_property.ml index 76bb7ec363..6df115808b 100644 --- a/compiler/core/js_dump_property.ml +++ b/compiler/core/js_dump_property.ml @@ -81,11 +81,9 @@ let property_access f s = | _ -> Js_dump_string.pp_string f s | exception _ -> Js_dump_string.pp_string f s) -let property_key_string (s : string) : string = - let s = Ext_ident.unwrap_uppercase_exotic s in - if obj_property_no_need_quot s then s else Js_dump_string.escape_to_string s - let property_key (s : J.property_name) : string = match s with - | Lit s -> property_key_string s + | Lit s -> + let s = Ext_ident.unwrap_uppercase_exotic s in + if obj_property_no_need_quot s then s else Js_dump_string.escape_to_string s | Symbol_name -> {|[Symbol.for("name")]|} diff --git a/compiler/core/js_dump_property.mli b/compiler/core/js_dump_property.mli index 7404413736..2e675b1816 100644 --- a/compiler/core/js_dump_property.mli +++ b/compiler/core/js_dump_property.mli @@ -25,5 +25,3 @@ val property_access : Ext_pp.t -> string -> unit val property_key : J.property_name -> string - -val property_key_string : string -> string diff --git a/tests/tests/src/jsx_preserve_test.mjs b/tests/tests/src/jsx_preserve_test.mjs index da9c00766f..529ab697ef 100644 --- a/tests/tests/src/jsx_preserve_test.mjs +++ b/tests/tests/src/jsx_preserve_test.mjs @@ -203,6 +203,11 @@ let _optional_props = } />; +let _props_with_hyphen =