git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: fix issues with brace initializers (shown with -Wall)
97de133Andy Arvanitis
src/Language/PureScript/Pretty/Cpp.hs+5−11
@@ -85,24 +85,18 @@ literals = mkPattern' match
85 match (CppCharLiteral c) = return $ "'" <> T.singleton c <> "'"
85 match (CppCharLiteral c) = return $ "'" <> T.singleton c <> "'"
86 match (CppBooleanLiteral True) = return "true"
86 match (CppBooleanLiteral True) = return "true"
87 match (CppBooleanLiteral False) = return "false"
87 match (CppBooleanLiteral False) = return "false"
88− match (CppArrayLiteral [x@CppArrayLiteral {}]) = -- Works around what appears to be a recent clang bug
89− mconcat <$> sequence
90− [ return $ runType arrayType
88+ match (CppArrayLiteral []) = return $ runType arrayType <> "{}"
91− , return "{ { "
92− , prettyPrintCpp' x
93− , return " } }"
94− ]
95 match (CppArrayLiteral xs) = mconcat <$> sequence
89 match (CppArrayLiteral xs) = mconcat <$> sequence
96 [ return $ runType arrayType
90 [ return $ runType arrayType
97− , return "{ "
91+ , return "{{ "
98 , fmap (T.intercalate ", ") $ forM xs prettyPrintCpp'
92 , fmap (T.intercalate ", ") $ forM xs prettyPrintCpp'
99− , return " }"
93+ , return " }}"
100 ]
94 ]
101 match (CppDataLiteral xs) = mconcat <$> sequence
95 match (CppDataLiteral xs) = mconcat <$> sequence
102 [ return $ runType (dataType $ length xs)
96 [ return $ runType (dataType $ length xs)
103− , return "{ "
97+ , return "{{ "
104 , fmap (T.intercalate ", ") $ forM xs prettyPrintCpp'
98 , fmap (T.intercalate ", ") $ forM xs prettyPrintCpp'
105− , return " }"
99+ , return " }}"
106 ]
100 ]
107 match (CppEnum name ty es) = mconcat <$> sequence
101 match (CppEnum name ty es) = mconcat <$> sequence
108 [ return "enum"
102 [ return "enum"