git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: fix issue with trimming of while/continue
aa8aa3eAndy Arvanitis
src/Language/PureScript/Pretty/Cpp.hs+6−5
@@ -214,15 +214,16 @@ literals = mkPattern' match
214 , return " = "
214 , return " = "
215 , prettyPrintCpp' value
215 , prettyPrintCpp' value
216 ]
216 ]
217− match (CppWhile _ (CppBlock [])) = return []
218− match (CppWhile cond sts@(CppBlock sts')) = fmap concat $ sequence
217+ match (CppWhile cond sts) = fmap concat $ sequence
219 [ return "while ("
218 [ return "while ("
220 , prettyPrintCpp' cond
219 , prettyPrintCpp' cond
221 , return ") "
220 , return ") "
222− , prettyPrintCpp' $ if last sts' == CppContinue
221+ , prettyPrintCpp' sts'
223− then CppBlock (init sts')
224− else sts
225 ]
222 ]
223+ where
224+ sts' | CppBlock cpps'@(_:_) <- sts,
225+ last cpps' == CppContinue = CppBlock (init cpps')
226+ | otherwise = sts
226 match (CppIfElse cond thens elses) = fmap concat $ sequence
227 match (CppIfElse cond thens elses) = fmap concat $ sequence
227 [ return "if ("
228 [ return "if ("
228 , prettyPrintCpp' cond
229 , prettyPrintCpp' cond