Skip to content

Commit

Permalink
[Truffle] Tolerate bad detailed source sections by just using the line.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Nov 6, 2014
1 parent 5ee82b6 commit 8d15c8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Expand Up @@ -44,7 +44,13 @@ public SourceSection translate(Source source, org.jruby.lexer.yacc.ISourcePositi
}
} else if (sourcePosition instanceof DetailedSourcePosition) {
final DetailedSourcePosition detailedSourcePosition = (DetailedSourcePosition) sourcePosition;
return source.createSection(getIdentifier(), detailedSourcePosition.getOffset(), detailedSourcePosition.getLength());

try {
return source.createSection(getIdentifier(), detailedSourcePosition.getOffset(), detailedSourcePosition.getLength());
} catch (IllegalArgumentException e) {
// In some cases we still get bad offsets with the detailed source positions
return source.createSection(getIdentifier(), sourcePosition.getLine() + 1);
}
} else if (Options.TRUFFLE_ALLOW_SIMPLE_SOURCE_SECTIONS.load()) {
// If we didn't run with -X+T, so maybe we're using truffelize, we might still get simple source sections
return source.createSection(getIdentifier(), sourcePosition.getLine() + 1);
Expand Down
1 change: 0 additions & 1 deletion spec/truffle/tags/language/file_tags.txt

This file was deleted.

0 comments on commit 8d15c8a

Please sign in to comment.