Skip to content

Commit a9a8372

Browse files
committed
use String.sub intead of unwrap_uppercase_exotic
1 parent a3f202c commit a9a8372

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

jscomp/syntax/src/res_printer.ml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,10 @@ let printPolyVarIdent txt =
434434
else
435435
match classifyIdentContent ~allowUident:true txt with
436436
| UppercaseExoticIdent ->
437-
Doc.concat
438-
[
439-
Doc.text "\"";
440-
Doc.text (Ext_ident.unwrap_uppercase_exotic txt);
441-
Doc.text "\"";
442-
]
437+
let len = String.length txt in
438+
(* UppercaseExoticIdent follows the \"..." format,
439+
so removing the leading backslash is enough to transform it into polyvar style *)
440+
Doc.text ((String.sub [@doesNotRaise]) txt 1 (len - 1))
443441
| ExoticIdent -> Doc.concat [Doc.text "\""; Doc.text txt; Doc.text "\""]
444442
| NormalIdent -> (
445443
match txt with

0 commit comments

Comments
 (0)