Project

Profile

Help

Bug #2496

closed

Incorrect tracing line number for LocalVariableReference and VariableReference

Added by Grzegorz Ligas over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2015-11-14
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
9.6, 9.7
Fix Committed on Branch:
9.7
Fixed in Maintenance Release:
Platforms:

Description

Hi,

I'm using tracing to identify number of line that given expression is on.

In most cases everything is fine apart form LocalVariableReference (and based on a brief look on the code also VariableReference).

Easy way to reproduce this is to have the main file prepared like below:

declare function local:a() {

let $a := 'a'

return $a

};

local:a()

and have an instance of TraceListener configured that has a method enter() like below:

@Override

public void enter(InstructionInfo instructionInfo, XPathContext xPathContext) {

    System.out.print("enter " + instructionInfo.toString());

    System.out.println(" line: " + instructionInfo.getLineNumber());

    System.out.println(" constructType: " + instructionInfo.getConstructType());

}

With this in place just running the sample main file will show that the line with return (constructType: 2014 = RETURN EXPRESSION) is shown with line number of the closing curly brace instead of the line where the return actually is.

I've been able to fix the issue locally (don't know if this is a proper solution though) on Saxon by adding the typical construct of first capturing the offset (on the beggining of the method) and use it to set location at the end.

Please find the diff and the modified file version attached.

Saxon versions affected: 9.5.1.10, 9.6.0.7 (actually all versions that I could find)

Saxon version with fixed issue (attached file): 9.6.0.7


Files

XPathParser.java.diff (241 Bytes) XPathParser.java.diff Diff file Grzegorz Ligas, 2015-11-14 03:35
XPathParser.java (130 KB) XPathParser.java Complete file with fix Grzegorz Ligas, 2015-11-14 03:35

Please register to edit this issue

Also available in: Atom PDF