on master help sign in
Fix #1104, escape labels in tail recursive functions properly
f2a40ccEvan Czaplicki
src/Generate/JavaScript/Expression.hs+2−2
@@ -164,7 +164,7 @@ generateCode expr =
164 jsBlock $
164 jsBlock $
165 VarDeclStmt () (zipWith varDecl tempNames args')
165 VarDeclStmt () (zipWith varDecl tempNames args')
166 : zipWith reassign argNames tempNames
166 : zipWith reassign argNames tempNames
167− ++ [ContinueStmt () (Just (Id () name))]
167+ ++ [ContinueStmt () (Just (Id () (Var.safe name)))]
168
168
169 Let defs body ->
169 Let defs body ->
170 do stmts <- mapM generateDef defs
170 do stmts <- mapM generateDef defs
@@ -226,7 +226,7 @@ generateTailFunction name args body =
226 do code <- generateCode body
226 do code <- generateCode body
227 return $ generateFunctionWithArity args $ JsBlock $ (:[]) $
227 return $ generateFunctionWithArity args $ JsBlock $ (:[]) $
228 LabelledStmt ()
228 LabelledStmt ()
229− (Id () name)
229+ (Id () (Var.safe name))
230 (WhileStmt () (BoolLit () True) (toStatement code))
230 (WhileStmt () (BoolLit () True) (toStatement code))
231
231
232
232