Skip to content

Commit

Permalink
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -82,7 +82,14 @@ public static SourceSection enclosing(SourceSection base, SourceSection... sourc
}

int startLine = base.getStartLine();
int endLine = base.getEndLine();

int endLine;

try {
endLine = base.getEndLine();
} catch (IllegalArgumentException e) {
endLine = startLine;
}

for (SourceSection sourceSection : sourceSections) {
if (sourceSection == null) {
@@ -91,12 +98,16 @@ public static SourceSection enclosing(SourceSection base, SourceSection... sourc

startLine = Math.min(startLine, sourceSection.getStartLine());

final int nodeEndLine;
int nodeEndLine;

if (sourceSection.getSource() == null) {
nodeEndLine = sourceSection.getStartLine();
} else {
nodeEndLine = sourceSection.getEndLine();
try {
nodeEndLine = sourceSection.getEndLine();
} catch (IllegalArgumentException e) {
nodeEndLine = sourceSection.getStartLine();
}
}

endLine = Math.max(endLine, nodeEndLine);

0 comments on commit 1c8e2ff

Please sign in to comment.