From 42db75c9707d6501cb1ef1908e7092286b25ac45 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Thu, 7 May 2020 21:41:55 +0200 Subject: Fix the DFA for "unstructured controlflow" (#14263) * Fix the DFA for "unstructured controlflow" * Add testcase from #14233 --- tests/arc/tcontrolflow.nim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/arc') diff --git a/tests/arc/tcontrolflow.nim b/tests/arc/tcontrolflow.nim index 8fc9bf61d..efe51cc32 100644 --- a/tests/arc/tcontrolflow.nim +++ b/tests/arc/tcontrolflow.nim @@ -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) + -- cgit 1.4.1-2-gfad0