Fix the DFA for "unstructured controlflow" (#14263)

* Fix the DFA for "unstructured controlflow"

* Add testcase from #14233
This commit is contained in:
Clyybber 2020-05-07 21:41:55 +02:00 • committed by GitHub
commit 42db75c970
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 142 additions and 81 deletions

View file

@ -10,6 +10,7 @@ end false
begin true
if
end true
7
'''
cmd: "nim c --gc:arc -d:danger $file"
disabled: "true"
@ -53,3 +54,26 @@ proc orIsHard(cond: bool) =
orIsHard(false)
orIsHard(true)
type
Control = ref object
x: int
MouseEvent = ref object
control: Control
button: int
proc run(data: Control) =
var evt = MouseEvent(button: 1)
evt.control = data
if evt.button == 1:
discard
else:
return
echo data.x
var c = Control(x: 7)
run(c)