mirror of
https://github.com/zachjs/sv2v.git
synced 2026-09-02 10:27:21 +02:00
fix break/continue causing return after loop
This commit is contained in:
+7
-1
@@ -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 ]
|
||||
|
||||
Reference in New Issue
Block a user