Project

Profile

Help

Bug #2807

closed

Operands of LocalParam

Added by Michael Kay almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Internals
Sprint/Milestone:
-
Start date:
2016-06-21
Due date:
% Done:

100%

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

Description

The LocalParam class has two Expression fields (select and conversion), and its operands() method constructs Operand objects on demand to wrap these expressions. This is incorrect, and has the consequence that if any rewrite methods alter the select or conversion expressions, the rewritten expression is used to update the transient Operand object which is then discarded, so the change does not take effect.

This can be seen in action on the 9.8 branch in test as-1216, where the initializer for a template parameter is converted to a global variable, but the global variable reference is not written back to the LocalParam object.

The correct design is for the Operand objects to be fields of the LocalParam and for the underlying Expression objects to be fetched when required.

Actions #1

Updated by Michael Kay over 7 years ago

The xsl:number expression (NumberInstruction) also creates Operand objects dynamically, for the two pattern-valued attributes "count" and "from".

Actions #2

Updated by Michael Kay over 7 years ago

I have hit this problem in a production stylesheet schema-reformatter.xsl, with the classic symptom

* Internal Saxon error: local variable encountered whose binding has been deleted

To solve this I have retrofitted the 9.8 code to 9.7. This involves combining the LocalParam and LocalParamSetter classes into a single class (LocalParam).

This solves the test case where it arose; leaving the bug open to do more regression testing.

Actions #3

Updated by Michael Kay over 7 years ago

  • Category set to Internals
  • Status changed from New to Resolved
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal
  • Applies to branch 9.7 added
  • Fix Committed on Branch 9.7 added

The fix appears to work.

Actions #4

Updated by O'Neil Delpratt over 7 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.7.0.12 added

Bug fix applied in the Saxon 9.7.0.12 maintenance release.

Actions #5

Updated by Michael Kay over 7 years ago

The patch had the side-effect of preventing byte-code generation for LocalParam elements, leading to "Cannot compile" warnings and fallback to interpreter mode. This is being fixed in a subsequent patch.

Please register to edit this issue

Also available in: Atom PDF