forked from killvxk/pycdc
-
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.
Merge pull request zrax#181 from Aralox/Issue-124-handle-async-for-GE…
…T_AITER_GET_ANEXT Add support for `async for`
- Loading branch information
Showing
9 changed files
with
323 additions
and
21 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
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
Binary file not shown.
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,75 @@ | ||
async def a(b, c): | ||
async for b in c: | ||
pass | ||
|
||
async def a(b, c): | ||
async for b in c: | ||
continue | ||
|
||
async def a(b, c): | ||
async for b in c: | ||
break | ||
|
||
async def time_for_some_fun(): | ||
async for (x, y) in myfunc(c): | ||
print(123) | ||
if (x == 3): | ||
print('something') | ||
break | ||
|
||
for i in regular_for: | ||
var1 = var2 + var3 | ||
async for x1 in print: | ||
print('test LOAD_GLOBAL') | ||
async for x2 in inner: | ||
for x3 in regular: | ||
async for x4 in inner2: | ||
async for x5 in inner3: | ||
async for x6 in inner4: | ||
print('ridiculous nesting') | ||
|
||
async for (q, w, e, r) in qwer: | ||
u = 1 + 2 + 3 | ||
|
||
async for x4 in inner2: | ||
async for x5 in inner3: | ||
pass | ||
|
||
print('outside loop') | ||
|
||
async def tryBlocks(): | ||
async for b in c: | ||
stuff | ||
await things(x) | ||
try: | ||
STUFF | ||
except MyException: | ||
running = False | ||
BLOCK_AFTER | ||
|
||
try: | ||
async for b in c: | ||
stuff | ||
await things(x) | ||
async for b2 in c2: | ||
stuff2 | ||
await things2(x) | ||
try: | ||
STUFF2 | ||
except MyException2: | ||
running2 = False | ||
AFTER | ||
try: | ||
STUFF | ||
except MyException: | ||
running = False | ||
BLOCK_AFTER | ||
|
||
except MyException2: | ||
OUTEREXCEPT | ||
|
||
print ('outside function') | ||
|
||
# The following will LOAD_METHOD, not GET_AITER or GET_ANEXT. | ||
# test.__anext__(iter) | ||
# test.__aiter__(iter) |
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 @@ | ||
async def myFunc(): | ||
async for b in c: | ||
try: | ||
STUFF | ||
except MyException: | ||
running = False | ||
|
||
for b in c: | ||
stuff | ||
try: | ||
STUFF | ||
except MyException: | ||
running = False | ||
|
||
while a: | ||
stuff | ||
try: | ||
STUFF | ||
except MyException: | ||
running = False |
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,122 @@ | ||
async def a ( b , c ) : <EOL> | ||
<INDENT> | ||
async for b in c : <EOL> | ||
<INDENT> | ||
pass <EOL> | ||
<OUTDENT> | ||
<OUTDENT> | ||
async def a ( b , c ) : <EOL> | ||
<INDENT> | ||
async for b in c : <EOL> | ||
<INDENT> | ||
continue <EOL> | ||
<OUTDENT> | ||
<OUTDENT> | ||
async def a ( b , c ) : <EOL> | ||
<INDENT> | ||
async for b in c : <EOL> | ||
<INDENT> | ||
break <EOL> | ||
<OUTDENT> | ||
<OUTDENT> | ||
async def time_for_some_fun ( ) : <EOL> | ||
<INDENT> | ||
async for ( x , y ) in myfunc ( c ) : <EOL> | ||
<INDENT> | ||
print ( 123 ) <EOL> | ||
if x == 3 : <EOL> | ||
<INDENT> | ||
print ( 'something' ) <EOL> | ||
break <EOL> | ||
<OUTDENT> | ||
for i in regular_for : <EOL> | ||
<INDENT> | ||
var1 = var2 + var3 <EOL> | ||
async for x1 in print : <EOL> | ||
<INDENT> | ||
print ( 'test LOAD_GLOBAL' ) <EOL> | ||
async for x2 in inner : <EOL> | ||
<INDENT> | ||
for x3 in regular : <EOL> | ||
<INDENT> | ||
async for x4 in inner2 : <EOL> | ||
<INDENT> | ||
async for x5 in inner3 : <EOL> | ||
<INDENT> | ||
async for x6 in inner4 : <EOL> | ||
<INDENT> | ||
print ( 'ridiculous nesting' ) <EOL> | ||
<OUTDENT> | ||
<OUTDENT> | ||
<OUTDENT> | ||
<OUTDENT> | ||
<OUTDENT> | ||
<OUTDENT> | ||
<OUTDENT> | ||
<OUTDENT> | ||
async for ( q , w , e , r ) in qwer : <EOL> | ||
<INDENT> | ||
u = 6 <EOL> | ||
<OUTDENT> | ||
async for x4 in inner2 : <EOL> | ||
<INDENT> | ||
async for x5 in inner3 : <EOL> | ||
<INDENT> | ||
pass <EOL> | ||
<OUTDENT> | ||
<OUTDENT> | ||
print ( 'outside loop' ) <EOL> | ||
<OUTDENT> | ||
async def tryBlocks ( ) : <EOL> | ||
<INDENT> | ||
async for b in c : <EOL> | ||
<INDENT> | ||
stuff <EOL> | ||
await things ( x ) <EOL> | ||
try : <EOL> | ||
<INDENT> | ||
STUFF <EOL> | ||
<OUTDENT> | ||
except MyException : <EOL> | ||
<INDENT> | ||
running = False <EOL> | ||
<OUTDENT> | ||
BLOCK_AFTER <EOL> | ||
<OUTDENT> | ||
try : <EOL> | ||
<INDENT> | ||
async for b in c : <EOL> | ||
<INDENT> | ||
stuff <EOL> | ||
await things ( x ) <EOL> | ||
async for b2 in c2 : <EOL> | ||
<INDENT> | ||
stuff2 <EOL> | ||
await things2 ( x ) <EOL> | ||
try : <EOL> | ||
<INDENT> | ||
STUFF2 <EOL> | ||
<OUTDENT> | ||
except MyException2 : <EOL> | ||
<INDENT> | ||
running2 = False <EOL> | ||
<OUTDENT> | ||
AFTER <EOL> | ||
<OUTDENT> | ||
try : <EOL> | ||
<INDENT> | ||
STUFF <EOL> | ||
<OUTDENT> | ||
except MyException : <EOL> | ||
<INDENT> | ||
running = False <EOL> | ||
<OUTDENT> | ||
BLOCK_AFTER <EOL> | ||
<OUTDENT> | ||
<OUTDENT> | ||
except MyException2 : <EOL> | ||
<INDENT> | ||
OUTEREXCEPT <EOL> | ||
<OUTDENT> | ||
<OUTDENT> | ||
print ( 'outside function' ) <EOL> |
Oops, something went wrong.