git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Make 'prime' handling more like js backend's
commit715a1710a014391fb8e84105a7ce21f05914abec authorAndy Arvanitis <andyarvanitis@gmail.com> dateMon 13 Aug 2018, 19:37 (8 years ago) parentdc515f3
2 files changed+4−3
src/CodeGen/Cpp/Common.hs+1−1 src/CodeGen/Cpp/Printer.hs+3−2
src/CodeGen/Cpp/Common.hs+1−1
@@ -46,7 +46,7 @@ identNeedsEscaping s = s /= properToCpp s || T.null s
4646identCharToText :: Char -> Text
4747identCharToText c | isAlphaNum c = T.singleton c
4848identCharToText '_' = "_"
49−identCharToText '\'' = "ʹ"
49+identCharToText '\'' = "$prime"
5050identCharToText '$' = "$"
5151identCharToText c = '$' `T.cons` T.pack (show (ord c))
5252
src/CodeGen/Cpp/Printer.hs+3−2
@@ -27,7 +27,7 @@ import Language.PureScript.AST (SourceSpan(..))
2727import Language.PureScript.CoreImp.AST
2828import Language.PureScript.Comments
2929import Language.PureScript.Crash
30−import Language.PureScript.Names (Ident)
30+import Language.PureScript.Names (Ident, runIdent)
3131import Language.PureScript.Pretty.Common
3232import Language.PureScript.PSString (PSString, decodeString, mkString)
3333import CodeGen.Cpp.Common
@@ -445,7 +445,8 @@ interfaceSource mn exports foreigns =
445445 identToCpp foreign' <>
446446 "() -> const boxed& { " <>
447447 dispatchOnceBegin <>
448− foreignDict <> "().at(\"" <> identToCpp foreign' <> "\"); " <>
448+ foreignDict <> "().at(" <>
449+ (stringLiteral . mkString $ runIdent foreign') <> "); " <>
449450 dispatchOnceEnd <>
450451 " };\n") <$> foreigns) <>
451452 "\n" <>