forked from adafruit/circuitpython
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
py/emitnative: Ensure load_subscr does not clobber existing REG_RET.
Fixes issue adafruit#7782, and part of issue adafruit#6314. Signed-off-by: Damien George <damien@micropython.org>
- Loading branch information
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# test viper with multiple subscripts in a single expression | ||
|
||
|
||
@micropython.viper | ||
def f1(b: ptr8): | ||
b[0] += b[1] | ||
|
||
|
||
@micropython.viper | ||
def f2(b: ptr8, i: int): | ||
b[0] += b[i] | ||
|
||
|
||
b = bytearray(b"\x01\x02") | ||
f1(b) | ||
print(b) | ||
|
||
b = bytearray(b"\x01\x02") | ||
f2(b, 1) | ||
print(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bytearray(b'\x03\x02') | ||
bytearray(b'\x03\x02') |