git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Minor rendering cleanup
commitb72f7f34342cbe6011969f5c86c7a3d7bb909939 authorAndy Arvanitis <andyarvanitis@gmail.com> dateTue 7 Aug 2018, 21:22 (8 years ago) parent6461a24
1 file changed+11−5
src/CodeGen/Cpp/Printer.hs+11−5
src/CodeGen/Cpp/Printer.hs+11−5
@@ -241,8 +241,8 @@ literals = mkPattern' match'
241241 , maybe (return mempty) (fmap (emit " else " <>) . prettyPrintCpp') elses
242242 ]
243243 where
244− t | Left _ <- n = "int"
245− | Right _ <- n = "double"
244+ t | Left _ <- n = int
245+ | Right _ <- n = float
246246
247247 match (IfElse _ cond thens elses) = mconcat <$> sequence
248248 [ return $ emit "if ("
@@ -403,11 +403,11 @@ unboxType :: Text -> Maybe Text
403403unboxType t
404404 | t == C.semiringInt ||
405405 t == C.ringInt
406− = Just "int"
406+ = Just int
407407 | t == C.semiringNumber ||
408408 t == C.ringNumber ||
409409 t == C.euclideanRingNumber
410− = Just "double"
410+ = Just float
411411 | otherwise = Nothing
412412
413413renderOp :: Text -> Text
@@ -452,7 +452,7 @@ implFooterSource :: Text -> [Ident] -> Text
452452implFooterSource mn foreigns =
453453 "\n\n" <>
454454 (if null foreigns then "" else ("auto " <> foreignDict <> "() -> " <> dictType <> "& {\n" <>
455− " static dict_t _dict_;\n" <>
455+ " static " <> dictType <> " _dict_;\n" <>
456456 " return _dict_;\n" <>
457457 "}\n\n")) <>
458458 "} // end namespace " <> mn <>
@@ -470,6 +470,12 @@ implFooterSource mn foreigns =
470470dictType :: Text
471471dictType = "dict_t"
472472
473+int :: Text
474+int = "int"
475+
476+float :: Text
477+float = "double"
478+
473479foreignDict :: Text
474480foreignDict = "_foreign_"
475481