Skip to content

Commit

Permalink
minor refactoring for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Nov 27, 2023
1 parent 0979e1c commit 16fe281
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/org/rascalmpl/library/lang/xml/IO.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,20 @@ private static Attribute removeNamespace(Attribute a, Attributes otherAttributes
}

private ISourceLocation attrToLoc(Attribute a, ISourceLocation file) {
Range startRange = a.sourceRange().valueRange();
Range range = a.sourceRange().valueRange();

if (range.start().pos() < 0) {
// this is strange
return file;
}

return vf.sourceLocation(file,
startRange.start().pos(),
startRange.end().pos() - startRange.start().pos(),
startRange.start().lineNumber(),
startRange.end().lineNumber(),
startRange.start().columnNumber() - 1,
startRange.end().columnNumber() - 1
range.start().pos(),
range.end().pos() - range.start().pos(),
range.start().lineNumber(),
range.end().lineNumber(),
range.start().columnNumber() - 1,
range.end().columnNumber() - 1
);
}

Expand Down

0 comments on commit 16fe281

Please sign in to comment.