fix break/continue causing return after loop

This commit is contained in:
Zachary Snow
2020-07-23 19:04:20 -06:00
parent bbb469463b
commit f0a5a47371
3 changed files with 52 additions and 1 deletions
+7 -1
View File
@@ -261,13 +261,19 @@ convertLoop loop comp stmt = do
(BinOp Ne (Ident jumpState) jsReturn)
(asgn jumpState (Ident jsStackIdent))
Null
let jsCheckReturn = If NoCheck
(BinOp Ne (Ident jumpState) jsReturn)
(asgn jumpState jsNone)
Null
return $
if not afterHasJump then
loop comp stmt'
else if origLoopDepth == 0 then
Block Seq "" []
[ loop comp' body ]
[ loop comp' body
, jsCheckReturn
]
else
Block Seq ""
[ jsStackDecl ]