Skip to content

Commit 19e2857

Browse files
committed
[GR-40203] Implement parsing with arguments in bytecode interpreter
PullRequest: graalpython/2379
2 parents 4033e48 + 477cac7 commit 19e2857

File tree

17 files changed

+158
-83
lines changed

17 files changed

+158
-83
lines changed

graalpython/com.oracle.graal.python.pegparser/src/com/oracle/graal/python/pegparser/tokenizer/SourceRange.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
package com.oracle.graal.python.pegparser.tokenizer;
4343

4444
public final class SourceRange {
45+
public static final SourceRange ARTIFICIAL_RANGE = new SourceRange(0, 0, 1, 0, 1, 0);
4546

4647
public final int startOffset;
4748
public final int endOffset;

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/parser/ParseWithArgumentsTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
public class ParseWithArgumentsTests extends ParserTestBase {
5454

5555
@Test
56-
public void testSimpple01() throws Exception {
56+
public void testSimple01() throws Exception {
5757
Source source = createSource("arg1");
5858
CallTarget target = context.getEnv().parsePublic(source, "arg1");
5959
assertEquals(66, target.call(66));
@@ -62,7 +62,7 @@ public void testSimpple01() throws Exception {
6262
}
6363

6464
@Test
65-
public void testSimpple02() throws Exception {
65+
public void testSimple02() throws Exception {
6666
Source source = createSource("arg1 + arg2");
6767
CallTarget target = context.getEnv().parsePublic(source, "arg1", "arg2");
6868
assertEquals(11, target.call(5, 6));
@@ -94,7 +94,7 @@ public void testWitouthReturn() throws Exception {
9494
}
9595

9696
@Test
97-
public void testCompareWithAndWithouthArguments() throws Exception {
97+
public void testCompareWithAndWithoutArguments() throws Exception {
9898
Source source = createSource("22");
9999
CallTarget targetWithout = context.getEnv().parsePublic(source);
100100
CallTarget targetWith = context.getEnv().parsePublic(source, "arg1");

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testImportAs.co

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ Disassembly of <module>:
77
000000 9 POP_TOP
88
000000 10 IMPORT_FROM 2 (c)
99
000000 12 STORE_NAME 3 (d)
10-
000000 14 RETURN_VALUE
10+
000000 14 POP_TOP
11+
000000 15 LOAD_NONE
12+
000000 16 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testImportFrom.co

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ Disassembly of <module>:
66
000000 8 STORE_NAME 1 (sqrt)
77
000000 10 IMPORT_FROM 2 (sin)
88
000000 12 STORE_NAME 3 (sine)
9-
000000 14 RETURN_VALUE
9+
000000 14 POP_TOP
10+
000000 15 LOAD_NONE
11+
000000 16 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testLoadClassDefRef.co

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Disassembly of <module>:
44
000030 5 LOAD_NAME 0 (f)
55
000032 7 LOAD_BYTE_O 1
66
000030 9 CALL_FUNCTION 1
7-
000030 11 RETURN_VALUE
7+
000000 11 RETURN_VALUE
88

99
Disassembly of f:
1010
000015 0 LOAD_BUILD_CLASS

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testTryExcept.co

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ Disassembly of <module>:
4747
000121 >> 78 LOAD_NAME 0 (print)
4848
000127 80 LOAD_STRING 4 ('after')
4949
000121 82 CALL_FUNCTION 1
50-
000121 84 RETURN_VALUE
50+
000104 84 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testTryExceptBare.co

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ Disassembly of <module>:
3737
000109 >> 59 LOAD_NAME 0 (print)
3838
000115 61 LOAD_STRING 4 ('after')
3939
000109 63 CALL_FUNCTION 1
40-
000109 65 RETURN_VALUE
40+
000088 65 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testTryExceptElse.co

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ Disassembly of <module>:
5252
000143 >> 87 LOAD_NAME 0 (print)
5353
000149 89 LOAD_STRING 5 ('after')
5454
000143 91 CALL_FUNCTION 1
55-
000143 93 RETURN_VALUE
55+
000129 93 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testTryExceptElseFinally.co

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ Disassembly of <module>:
6868
000171 112 LOAD_NAME 0 (print)
6969
000177 114 LOAD_STRING 6 ('after')
7070
000171 116 CALL_FUNCTION 1
71-
000171 118 RETURN_VALUE
71+
000154 118 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testTryExceptFinally.co

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ Disassembly of <module>:
6363
000149 103 LOAD_NAME 0 (print)
6464
000155 105 LOAD_STRING 5 ('after')
6565
000149 107 CALL_FUNCTION 1
66-
000149 109 RETURN_VALUE
66+
000132 109 RETURN_VALUE

0 commit comments

Comments
 (0)