git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Revert "Merge branch 'tco-case'"

This reverts commit bb83e53952a66715cc5b792e0927a7f33a4c9277, reversing changes made to 8b16e210b88b26e7d42149ac055845932e4e3876.

commitc6ce20ba6cd9a1c2ca9d340275dd15233956b896 authorPhil Freeman <paf31@cantab.net> dateFri 23 May 2014, 15:01 (12 years ago) parentbb83e53
2 files changed+2−13
examples/passing/TCOCase.purs−10 src/Language/PureScript/CodeGen/JS.hs+2−3
examples/passing/TCOCase.pursdeleted−10
@@ -1,10 +0,0 @@
1−module Main where
2−
3−data Data = One | More Data
4−
5−main = Debug.Trace.trace (from (to 10000 One))
6− where
7− to 0 a = a
8− to n a = to (n - 1) (More a)
9− from One = "Done"
10− from (More d) = from d
src/Language/PureScript/CodeGen/JS.hs+2−3
@@ -273,12 +273,11 @@ qualifiedToJS _ f (Qualified _ a) = JSVar $ identToJs (f a)
273273bindersToJs :: (Functor m, Applicative m, Monad m) => Options -> ModuleName -> Environment -> [CaseAlternative] -> [JS] -> SupplyT m JS
274274bindersToJs opts m e binders vals = do
275275 valNames <- replicateM (length vals) freshName
276− let assignments = zipWith JSVariableIntroduction valNames (map Just vals)
277276 jss <- forM binders $ \(CaseAlternative bs grd result) -> do
278277 ret <- valueToJs opts m (bindNames m (concatMap binderNames bs) e) result
279278 go valNames [JSReturn ret] bs grd
280− return $ JSApp (JSFunction Nothing [] (JSBlock (assignments ++ concat jss ++ [JSThrow (JSStringLiteral "Failed pattern match")])))
281− []
279+ return $ JSApp (JSFunction Nothing valNames (JSBlock (concat jss ++ [JSThrow (JSStringLiteral "Failed pattern match")])))
280+ vals
282281 where
283282 go :: (Functor m, Applicative m, Monad m) => [String] -> [JS] -> [Binder] -> Maybe Guard -> SupplyT m [JS]
284283 go _ done [] Nothing = return done