Closed ghost closed 11 years ago
Ok, I just tried to replace it with COND and appears that causes a segmentation fault. I think it's a problem with tail recursion but I'm not sure...
Could you post the code that's causing the problem? A segfault might be a problem in something else.
(class Mage-Checkout-Block-Links
(access private
(when addLink (text type width css-class)
(let [parent-block (-> this getParentBlock)]
(if parent-block
(-> parent-block addLink text type text TRUE (array) width
(. "class=\"top-link-" css-class "\""))))))
(fn addCartLink ()
(let [count (-> (-> this helper "checkout/cart") getSummaryCount)]
(-> this addLink
(cond ((== count 1) (-> this __ "My Cart (%s item)" count))
((> count 0) (-> this __ "My Cart (%s items)" count))
(TRUE (-> this __ "My Cart")))
"checkout/cart" 50 "cart"))
this)
(fn addCheckoutLink ()
(when (-> (-> this helper "checkout") canOnepageCheckout)
(-> this addLink (-> this __ "Checkout") "checkout" 60 "checkout")))
)
(fn print-messages (type)
(print (if (> (-> messageStack type) 0)
(-> messageStack output type)
"")))
(print (-> payment-modules javascript-validation))
(print "div class\"centerColumn\" id=\"checkoutPayment\">")
(print (zen-draw-form "checkout_payment"
(zen-href-link FILENAME-CHECKOUT-CONFIRMATION "" "SSL")
"post" (if flagOnSubmit "onsubmit=\"return check_form();\"" "")))
(print (. "<h1>" HEADING-TITLE "</h1>"))
(print-messages "redemptions")
(print-messages "checkout")
(print-messages "checkout_payment")
(if (not (-> payment-modules in-special-checkout))
(include "paypal_express_checkout.php"))
I didn't realize the IF statement requires two expressions and when I did, I changed to a WHEN. After I did this, I kept getting a segmentation fault when running pharen. I changed the code back to using IFs and I still ended up getting segmentation faults.