Skip to content

Commit

Permalink
use String.sub intead of unwrap_uppercase_exotic
Browse files Browse the repository at this point in the history
  • Loading branch information
cometkim committed May 29, 2024
1 parent 842fcad commit b0c6f1e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions jscomp/syntax/src/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,10 @@ let print_poly_var_ident txt =
else
match classify_ident_content ~allow_uident:true txt with
| UppercaseExoticIdent ->
Doc.concat
[
Doc.text "\"";
Doc.text (Ext_ident.unwrap_uppercase_exotic txt);
Doc.text "\"";
]
let len = String.length txt in
(* UppercaseExoticIdent follows the \"..." format,
so removing the leading backslash is enough to transform it into polyvar style *)
Doc.text ((String.sub [@doesNotRaise]) txt 1 (len - 1))
| ExoticIdent -> Doc.concat [Doc.text "\""; Doc.text txt; Doc.text "\""]
| NormalIdent -> (
match txt with
Expand Down

0 comments on commit b0c6f1e

Please sign in to comment.