mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 05:20:31 +00:00
when statements branches exit early (#17143)
When statement branches exit early outside of nimvm. In nimvm it seems that all sides of the branches must be evaluated as the code gen happens at a later stage, this remains intact.
This commit is contained in:
@@ -2364,6 +2364,7 @@ proc semWhen(c: PContext, n: PNode, semCheck = true): PNode =
|
||||
discard
|
||||
elif e.intVal != 0 and result == nil:
|
||||
setResult(it[1])
|
||||
return # we're not in nimvm and we already have a result
|
||||
of nkElse, nkElseExpr:
|
||||
checkSonsLen(it, 1, c.config)
|
||||
if result == nil or whenNimvm:
|
||||
|
||||
Reference in New Issue
Block a user