git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: fix issue with trimming of while/continue
commitaa8aa3ec7f8e2559bda63b73b6983704c4d051c6 authorAndy Arvanitis <andyarvanitis@gmail.com> dateWed 2 Mar 2016, 20:30 (11 years ago) parente9a3a54
1 file changed+6−5
src/Language/PureScript/Pretty/Cpp.hs+6−5
src/Language/PureScript/Pretty/Cpp.hs+6−5
@@ -214,15 +214,16 @@ literals = mkPattern' match
214214 , return " = "
215215 , prettyPrintCpp' value
216216 ]
217− match (CppWhile _ (CppBlock [])) = return []
218− match (CppWhile cond sts@(CppBlock sts')) = fmap concat $ sequence
217+ match (CppWhile cond sts) = fmap concat $ sequence
219218 [ return "while ("
220219 , prettyPrintCpp' cond
221220 , return ") "
222− , prettyPrintCpp' $ if last sts' == CppContinue
223− then CppBlock (init sts')
224− else sts
221+ , prettyPrintCpp' sts'
225222 ]
223+ where
224+ sts' | CppBlock cpps'@(_:_) <- sts,
225+ last cpps' == CppContinue = CppBlock (init cpps')
226+ | otherwise = sts
226227 match (CppIfElse cond thens elses) = fmap concat $ sequence
227228 [ return "if ("
228229 , prettyPrintCpp' cond