Project

Profile

Help

Bug #5696

closed

Created LetClause does not have location set to it

Added by Radu Coravu over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2022-09-26
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, trunk
Fix Committed on Branch:
11, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

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?

Actions #1

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.

Actions #2

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.

Actions #3

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
Actions #4

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.

Actions #5

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

Actions #6

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.

Actions #7

Updated by O'Neil Delpratt about 1 year ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF