forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
py: Fix 2 bugs in native emitter: jump_or_pop and stack settling.
Addresses issue micropython#838.
- Loading branch information
Showing
3 changed files
with
43 additions
and
2 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,5 @@ | ||
# test short circuit expressions outside if conditionals | ||
print(() or 1) | ||
print((1,) or 1) | ||
print(() and 1) | ||
print((1,) and 1) |
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,35 @@ | ||
# test if conditions which are optimised by the compiler | ||
|
||
f2 = 0 | ||
|
||
def f(t1, t2, f1): | ||
if False: | ||
print(1) | ||
if True: | ||
print(1) | ||
if (): | ||
print(1) | ||
if (1,): | ||
print(1) | ||
if (1, 2): | ||
print(1) | ||
if t1 and t2: | ||
print(1) | ||
if (t1 and t2): # parsed differently to above | ||
print(1) | ||
if not (t1 and f1): | ||
print(1) | ||
if t1 or t2: | ||
print(1) | ||
if (t1 or t2): # parse differently to above | ||
print(1) | ||
if f1 or t1: | ||
print(1) | ||
if not (f1 or f2): | ||
print(1) | ||
if t1 and f1 or t1 and t2: | ||
print(1) | ||
if (f1 or t1) and (f2 or t2): | ||
print(1) | ||
|
||
f(True, 1, False) |