Skip to content

Commit 04d37b8

Browse files
msimacektomasstupka
authored andcommitted
Add freevars and cellvars extraction
1 parent 60645c8 commit 04d37b8

File tree

1 file changed

+4
-0
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/code

1 file changed

+4
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/code/PCode.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ private static Set<Object> asSet(Object[] objects) {
189189
private static String[] extractFreeVars(RootNode rootNode) {
190190
if (rootNode instanceof PClosureRootNode) {
191191
return ((PClosureRootNode) rootNode).getFreeVars();
192+
} else if (rootNode instanceof PBytecodeRootNode) {
193+
return ((PBytecodeRootNode) rootNode).getCodeUnit().freevars;
192194
} else {
193195
return PythonUtils.EMPTY_STRING_ARRAY;
194196
}
@@ -197,6 +199,8 @@ private static String[] extractFreeVars(RootNode rootNode) {
197199
private static String[] extractCellVars(RootNode rootNode) {
198200
if (rootNode instanceof PClosureFunctionRootNode) {
199201
return ((PClosureFunctionRootNode) rootNode).getCellVars();
202+
} else if (rootNode instanceof PBytecodeRootNode) {
203+
return ((PBytecodeRootNode) rootNode).getCodeUnit().cellvars;
200204
} else {
201205
return PythonUtils.EMPTY_STRING_ARRAY;
202206
}

0 commit comments

Comments
 (0)