From 6f81348fa25216f03686b342765f337ab57e2e5f Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 29 Sep 2014 16:41:37 +0100 Subject: py: Allow viper to use ints as direct conditionals in jumps. Allows things like: if 1: ... --- tests/micropython/viper_cond.py | 15 +++++++++++++++ tests/micropython/viper_cond.py.exp | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 tests/micropython/viper_cond.py create mode 100644 tests/micropython/viper_cond.py.exp (limited to 'tests/micropython') diff --git a/tests/micropython/viper_cond.py b/tests/micropython/viper_cond.py new file mode 100644 index 000000000..258a37812 --- /dev/null +++ b/tests/micropython/viper_cond.py @@ -0,0 +1,15 @@ +# using a bool as a conditional +@micropython.viper +def f(): + x = True + if x: + print("x", x) +f() + +# using an int as a conditional +@micropython.viper +def g(): + y = 1 + if y: + print("y", y) +g() diff --git a/tests/micropython/viper_cond.py.exp b/tests/micropython/viper_cond.py.exp new file mode 100644 index 000000000..244817f1f --- /dev/null +++ b/tests/micropython/viper_cond.py.exp @@ -0,0 +1,2 @@ +x True +y 1 -- cgit v1.2.3