@@ -270,14 +270,13 @@ jsLet (defs,e') = do ds <- mapM toJS defs
270 return $ jsFunc "" (concat ds ++ ret e) ++ "()"
270 return $ jsFunc "" (concat ds ++ ret e) ++ "()"
272caseToJS span e ps = do
272caseToJS span e ps = do
273− match <- caseToMatch ps
273+ (tempVar,match) <- caseToMatch ps
274 e' <- toJS' e
274 e' <- toJS' e
275− let (match',stmt) = case (match,e) of
275+ let (match',stmt) = case e of
276− (Match name _ _, L _ (Var x)) -> (matchSubst [(name,deprime x)] match, "")
276+ L _ (Var x) -> (matchSubst [(tempVar,deprime x)] match, "")
277− (Match name _ _, _) -> (match, assign name e')
277+ _ -> (match, assign tempVar e')
279 matches <- matchToJS span match'
278 matches <- matchToJS span match'
280− return $ "function(){ " ++ stmt ++ matches ++ " }()"
279+ return $ jsFunc "" (stmt ++ matches) ++ "()"
282matchToJS span match =
281matchToJS span match =
283 case match of
282 case match of