Skip to content

Commit 4ef63f4

Browse files
committed
Fix source section of empty modules
1 parent cf2c4cc commit 4ef63f4

File tree

1 file changed

+2
-2
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler

1 file changed

+2
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/SourceMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ private static int readNum(ByteArrayInputStream offsets) {
118118

119119
public static SourceSection getSourceSection(Source source, int startLine, int startColumn, int endLine, int endColumn) {
120120
/* Truffle columns are 1-based and it doesn't consider the newline a part of the line */
121-
startColumn++;
122-
endColumn = Math.min(endColumn + 1, source.getLineLength(endLine));
121+
startColumn = Math.max(startColumn + 1, 1);
122+
endColumn = Math.max(Math.min(endColumn + 1, source.getLineLength(endLine)), 1);
123123
return source.createSection(startLine, startColumn, endLine, endColumn);
124124
}
125125

0 commit comments

Comments
 (0)