git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: minor cleanup (map terminator)
35ee24bAndy Arvanitis
src/Language/PureScript/Pretty/Cpp.hs+3−2
@@ -109,13 +109,14 @@ literals = mkPattern' match
109 match (CppMapLiteral _ ps) = mconcat <$> sequence
109 match (CppMapLiteral _ ps) = mconcat <$> sequence
110 [ return $ runType (mapType $ length ps + 1) <> "{{\n"
110 [ return $ runType (mapType $ length ps + 1) <> "{{\n"
111 , withIndent $ do
111 , withIndent $ do
112+ let ps' = ps ++ [(CppVar "nullptr", CppVar "nullptr")]
112 cpps <-
113 cpps <-
113− forM ps $ \(key, value) -> do
114+ forM ps' $ \(key, value) -> do
114 value' <- prettyPrintCpp' value
115 value' <- prettyPrintCpp' value
115 key' <- prettyPrintCpp' key
116 key' <- prettyPrintCpp' key
116 return $ "{ " <> key' <> ", " <> value' <> " }"
117 return $ "{ " <> key' <> ", " <> value' <> " }"
117 indentString <- currentIndent
118 indentString <- currentIndent
118− return $ T.intercalate ", \n" $ map (indentString <>) (cpps ++ ["{ nullptr, nullptr }"])
119+ return $ T.intercalate ", \n" $ map (indentString <>) cpps
119 , return "\n"
120 , return "\n"
120 , currentIndent
121 , currentIndent
121 , return "}}"
122 , return "}}"