From e6c0dff9671c493e9a13a22a1b8902dee88da064 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 15 Aug 2014 23:47:59 +0100 Subject: py: Viper can now store to global. --- tests/micropython/viper.py | 8 ++++++++ tests/micropython/viper.py.exp | 1 + 2 files changed, 9 insertions(+) (limited to 'tests/micropython') diff --git a/tests/micropython/viper.py b/tests/micropython/viper.py index 2ed70ade6..36849abaf 100644 --- a/tests/micropython/viper.py +++ b/tests/micropython/viper.py @@ -29,6 +29,13 @@ def viper_sum(a:int, b:int) -> int: total += x return total +# accessing a global +@micropython.viper +def access_global(): + global gl + gl = 1 + return gl + # this doesn't work at the moment #@micropython.viper #def g() -> uint: @@ -39,3 +46,4 @@ print(g(1, 2)) print(h(3)) print(i(4, 5)) print(viper_sum(10, 10000)) +print(access_global(), gl) diff --git a/tests/micropython/viper.py.exp b/tests/micropython/viper.py.exp index 6ee698f66..4c308316b 100644 --- a/tests/micropython/viper.py.exp +++ b/tests/micropython/viper.py.exp @@ -3,3 +3,4 @@ 7 20 49994955 +1 1 -- cgit v1.2.3