Skip to content

Commit 7cd0155

Browse files
committed
Fix invalid parser test
1 parent f33e1c2 commit 7cd0155

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

graalpython/com.oracle.graal.python.pegparser.test/src/com/oracle/graal/python/pegparser/test/AwaitAndAsyncTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ public void asyncFor02() throws Exception {
9797

9898
@Test
9999
public void asyncComprehension() throws Exception {
100-
checkScopeAndTree("[i async for i in foo()]");
100+
checkScopeAndTree("async def f():\n [i async for i in foo()]");
101101
}
102102
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
ScopeEnvironment
22
Scope null Module
33
Symbols:
4-
foo: [Use, GlobalImplicit]
5-
Scope listcomp Function
6-
Flags: [IsCoroutine, IsComprehension]
7-
Varnames: .0
4+
f: [DefLocal, Local]
5+
Scope f Function
6+
Flags: [IsCoroutine]
87
Symbols:
9-
.0: [DefParam, Local]
10-
i: [DefLocal, Use, DefCompIter, Local]
8+
foo: [Use, GlobalImplicit]
9+
Scope listcomp Function
10+
Flags: [IsNested, IsCoroutine, IsComprehension]
11+
Varnames: .0
12+
Symbols:
13+
.0: [DefParam, Local]
14+
i: [DefLocal, Use, DefCompIter, Local]
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
Input:
22
------
3-
[i async for i in foo()]
3+
async def f():
4+
[i async for i in foo()]
45

56
Output:
67
-------
7-
Module[1:0-1:24]
8-
ListComp[1:0-1:24]
9-
Element: Name[1:1-1:2] Value: "i"
10-
ComprehensionTy[1:3-1:23]
11-
Target: Name[1:13-1:14] Value: "i" Store
12-
Iterator:
13-
Call[1:18-1:23]
14-
Target: Name[1:18-1:21] Value: "foo"
8+
Module[1:0-2:25]
9+
AsyncFunctionDef[1:0-2:25]
10+
Name:f
11+
ArgumentsTy[1:0-1:0]
12+
---- Function body of f ----
13+
ListComp[2:1-2:25]
14+
Element: Name[2:2-2:3] Value: "i"
15+
ComprehensionTy[2:4-2:24]
16+
Target: Name[2:14-2:15] Value: "i" Store
17+
Iterator:
18+
Call[2:19-2:24]
19+
Target: Name[2:19-2:22] Value: "foo"
20+
---- End of f function ----

0 commit comments

Comments
 (0)