git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Make 'prime' handling more like js backend's
715a171Andy Arvanitis
src/CodeGen/Cpp/Common.hs+1−1
@@ -46,7 +46,7 @@ identNeedsEscaping s = s /= properToCpp s || T.null s
46identCharToText :: Char -> Text
46identCharToText :: Char -> Text
47identCharToText c | isAlphaNum c = T.singleton c
47identCharToText c | isAlphaNum c = T.singleton c
48identCharToText '_' = "_"
48identCharToText '_' = "_"
49−identCharToText '\'' = "ʹ"
49+identCharToText '\'' = "$prime"
50identCharToText '$' = "$"
50identCharToText '$' = "$"
51identCharToText c = '$' `T.cons` T.pack (show (ord c))
51identCharToText c = '$' `T.cons` T.pack (show (ord c))
52
52
src/CodeGen/Cpp/Printer.hs+3−2
@@ -27,7 +27,7 @@ import Language.PureScript.AST (SourceSpan(..))
27import Language.PureScript.CoreImp.AST
27import Language.PureScript.CoreImp.AST
28import Language.PureScript.Comments
28import Language.PureScript.Comments
29import Language.PureScript.Crash
29import Language.PureScript.Crash
30−import Language.PureScript.Names (Ident)
30+import Language.PureScript.Names (Ident, runIdent)
31import Language.PureScript.Pretty.Common
31import Language.PureScript.Pretty.Common
32import Language.PureScript.PSString (PSString, decodeString, mkString)
32import Language.PureScript.PSString (PSString, decodeString, mkString)
33import CodeGen.Cpp.Common
33import CodeGen.Cpp.Common
@@ -445,7 +445,8 @@ interfaceSource mn exports foreigns =
445 identToCpp foreign' <>
445 identToCpp foreign' <>
446 "() -> const boxed& { " <>
446 "() -> const boxed& { " <>
447 dispatchOnceBegin <>
447 dispatchOnceBegin <>
448− foreignDict <> "().at(\"" <> identToCpp foreign' <> "\"); " <>
448+ foreignDict <> "().at(" <>
449+ (stringLiteral . mkString $ runIdent foreign') <> "); " <>
449 dispatchOnceEnd <>
450 dispatchOnceEnd <>
450 " };\n") <$> foreigns) <>
451 " };\n") <$> foreigns) <>
451 "\n" <>
452 "\n" <>