Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Change char payload #709

Merged
merged 16 commits into from
Oct 31, 2022
Merged

Conversation

butterunderflow
Copy link
Contributor

@butterunderflow butterunderflow changed the title Char payload Change char payload Oct 28, 2022
@butterunderflow butterunderflow marked this pull request as ready for review October 28, 2022 06:00
compiler-libs-406/parmatch.ml Show resolved Hide resolved
@@ -192,7 +192,7 @@ let rec longident f = function
let longident_loc f x = pp f "%a" longident x.txt

let constant f = function
| Pconst_char i -> pp f "%C" i
| Pconst_char i -> pp f "%C" (Char.unsafe_chr i) (* todo: consider safety *)
| Pconst_string (i, None) -> pp f "%S" i
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

src/res_printer.ml Outdated Show resolved Hide resolved
src/res_scanner.ml Outdated Show resolved Hide resolved
@butterunderflow butterunderflow marked this pull request as draft October 28, 2022 13:39
@@ -553,7 +553,7 @@ let printConstant ?(templateLiteral = false) c =
| Pconst_float (s, _) -> Doc.text s
| Pconst_char c ->
let str =
match c with
match Char.unsafe_chr c with
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still a unsafe_char usage, but I think this one is safe because it's just value testing and no I/O is involved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems okay, but there may be some duplication with string_of_int_as_char, you may do a clean up later after this commit landed

Copy link
Member

@bobzhang bobzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@butterunderflow butterunderflow marked this pull request as ready for review October 31, 2022 02:53
@bobzhang bobzhang merged commit c6807e8 into rescript-lang:master Oct 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants