File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -448,7 +448,17 @@ public RootCallTarget getRootCallTarget() {
448
448
@ Override
449
449
@ ExportMessage
450
450
public SourceSection getSourceLocation () {
451
- return getRootNode ().getSourceSection ();
451
+ RootNode rootNode = getRootNode ();
452
+ if (rootNode instanceof PRootNode ) {
453
+ return ((PRootNode ) rootNode ).getSourceSection ();
454
+ } else {
455
+ return getForeignSourceSection (rootNode );
456
+ }
457
+ }
458
+
459
+ @ TruffleBoundary
460
+ private static SourceSection getForeignSourceSection (RootNode rootNode ) {
461
+ return rootNode .getSourceSection ();
452
462
}
453
463
454
464
@ Override
Original file line number Diff line number Diff line change 33
33
import com .oracle .graal .python .builtins .objects .object .PythonObject ;
34
34
import com .oracle .graal .python .builtins .objects .object .PythonObjectLibrary ;
35
35
import com .oracle .graal .python .builtins .objects .type .LazyPythonClass ;
36
+ import com .oracle .graal .python .nodes .PRootNode ;
36
37
import com .oracle .graal .python .nodes .SpecialMethodNames ;
37
38
import com .oracle .graal .python .nodes .attributes .WriteAttributeToDynamicObjectNode ;
38
39
import com .oracle .graal .python .nodes .generator .GeneratorFunctionRootNode ;
@@ -207,7 +208,17 @@ public boolean isCallable() {
207
208
@ Override
208
209
@ ExportMessage
209
210
public SourceSection getSourceLocation () {
210
- return getCallTarget ().getRootNode ().getSourceSection ();
211
+ RootNode rootNode = getCallTarget ().getRootNode ();
212
+ if (rootNode instanceof PRootNode ) {
213
+ return ((PRootNode ) rootNode ).getSourceSection ();
214
+ } else {
215
+ return getForeignSourceSection (rootNode );
216
+ }
217
+ }
218
+
219
+ @ TruffleBoundary
220
+ private static SourceSection getForeignSourceSection (RootNode rootNode ) {
221
+ return rootNode .getSourceSection ();
211
222
}
212
223
213
224
@ Override
You can’t perform that action at this time.
0 commit comments