git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
small optimisation in encodeChar
618c990Michael Ficarra
src/Language/PureScript/Pretty/JS.hs+1−1
@@ -164,7 +164,7 @@ string s = '"' : concatMap encodeChar s ++ "\""
164 encodeChar '\r' = "\\r"
164 encodeChar '\r' = "\\r"
165 encodeChar '"' = "\\\""
165 encodeChar '"' = "\\\""
166 encodeChar '\\' = "\\\\"
166 encodeChar '\\' = "\\\\"
167− encodeChar c | fromEnum c > 0xFFFF = "\\u" ++ showHex highSurrogate "" ++ "\\u" ++ showHex lowSurrogate ""
167+ encodeChar c | fromEnum c > 0xFFFF = "\\u" ++ showHex highSurrogate ("\\u" ++ showHex lowSurrogate "")
168 where
168 where
169 (h, l) = divMod (fromEnum c - 0x10000) 0x400
169 (h, l) = divMod (fromEnum c - 0x10000) 0x400
170 highSurrogate = h + 0xD800
170 highSurrogate = h + 0xD800