Bug #5696
closedCreated LetClause does not have location set to it
100%
Description
Using Saxon 11. In the method "net.sf.saxon.query.XQueryParser.parseGroupByClause(FLWORExpression, List)" a LetClause is created:
LetClause letClause = new LetClause();
maybe a location should also be set on it:
setLocation(letClause, t.currentTokenStartOffset);
otherwise the localization for such elements will be off.
Also the method "net.sf.saxon.expr.Locatable.getLocation()" has no Javadoc, does it allow the possibility to return a null item?
Updated by Michael Kay over 1 year ago
Yes, it would be better to set the location explicitly (we can usually get away with not doing, because if we don't set the location explicitly, it's usually picked up from other nearby expressions in the tree; but it's safer not to rely on that).
The convention should be that methods like getLocation()
return Loc.NONE
rather than null if no information is available. I can't guarantee that that's always going to be the case, though. It would definitely be prudent to check for the result being null.
Updated by Radu Coravu over 1 year ago
Right, thanks. On our side in the debugger code we usually assume the getLocation() method never returns null and usually this is the case, except in this particular situation.
Updated by Michael Kay over 1 year ago
- Category set to Diagnostics
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Applies to branch 11, trunk added
- Fix Committed on Branch 11, trunk added
- Platforms .NET, Java added
Updated by Michael Kay over 1 year ago
In fact, while Expression.getLocation()
searches around the tree for a location on an ancestor node, the same is not true for Clause.getLocation()
- if it hasn't been set, it returns null.
Updated by Community Admin over 1 year ago
- % Done changed from 0 to 100
- Fixed in Maintenance Release 12.0 added
Bug issue fix applied in the Saxon 12.0 Major Release. Leaving this bug marked as Resolved until fix applied
Updated by O'Neil Delpratt about 1 year ago
- Fixed in Maintenance Release 11.5 added
Bug applied in the Saxon 11.5 Maintenance release.
Updated by O'Neil Delpratt about 1 year ago
- Status changed from Resolved to Closed
Please register to edit this issue