File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -490,14 +490,16 @@ Object positions(PCode self) {
490490 continue ;
491491 }
492492 SourceSection section = rootNode .getSourceSectionForLocation (instruction .getLocation ());
493- lines .add (PFactory .createTuple (language , new int []{
494- section .getStartLine (),
495- section .getEndLine (),
496- // 1-based inclusive to 0-based inclusive
497- section .getStartColumn () - 1 ,
498- // 1-based inclusive to 0-based exclusive (-1 + 1 = 0)
499- section .getEndColumn ()
500- }));
493+ if (section != null ) {
494+ lines .add (PFactory .createTuple (language , new int []{
495+ section .getStartLine (),
496+ section .getEndLine (),
497+ // 1-based inclusive to 0-based inclusive
498+ section .getStartColumn () - 1 ,
499+ // 1-based inclusive to 0-based exclusive (-1 + 1 = 0)
500+ section .getEndColumn ()
501+ }));
502+ }
501503 }
502504 } else {
503505 BytecodeCodeUnit bytecodeCo = (BytecodeCodeUnit ) co ;
Original file line number Diff line number Diff line change @@ -892,7 +892,11 @@ protected Source getSource() {
892892
893893 @ TruffleBoundary
894894 public int bciToLine (int bci , BytecodeNode bytecodeNode ) {
895- return getSourceSectionForLocation (bci , bytecodeNode ).getStartLine ();
895+ SourceSection sourceSection = getSourceSectionForLocation (bci , bytecodeNode );
896+ if (sourceSection != null ) {
897+ return sourceSection .getStartLine ();
898+ }
899+ return -1 ;
896900 }
897901
898902 @ TruffleBoundary
You can’t perform that action at this time.
0 commit comments