drnim: phi nodes for 'if' statements (#13990)

This commit is contained in:
Andreas Rumpf 2020-04-19 02:41:16 +02:00 • committed by GitHub
commit a8f030fea2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 172 additions and 15 deletions

23
drnim/tests/tphi.nim Normal file
View file

@ -0,0 +1,23 @@
discard """
nimout: '''tphi.nim(9, 10) Warning: BEGIN [User]
tphi.nim(22, 10) Warning: END [User]'''
cmd: "drnim $file"
action: "compile"
"""
import std/logic
{.push staticBoundChecks: defined(nimDrNim).}
{.warning: "BEGIN".}
proc testAsgn(y: int) =
var a = y
if a > 0:
if a > 3:
a = a + 2
else:
a = a + 1
{.assert: a > 1.}
testAsgn(3)
{.warning: "END".}
{.pop.}