Expression tree changes
There have been changes to the internal structure of the expression tree generated by the XSLT, XQuery,
and XPath processors, and to the way it is navigated. Most notably, the tree no longer contains any parent pointers
linking a subexpression to its containing expression. These have been removed primarily because the code for maintaining
the parent pointers was complex and prone to bugs. To compensate for the absence of these pointers, the various traversals
of the expression tree (simplify, typeCheck, and optimize), now make use of an ExpressionVisitor
object that
maintains references to all the containing expressions in the form of a stack.
Expressions now have a link to a Container
object that provides access to the outside world, for example to
the Configuration
and NamePool
. However, this is used only for diagnostics, because it is not
guaranteed to be available in 100% of cases, especially while the tree is under construction.
There is now an internal diagnostic switch allowing tracing of the decisions made by the optimizer. Not all rewrites are yet traced in this way.
The class IfExpression
no longer exists; all conditional expressions including xsl:if
,
xsl:choose
, XPath if-then-else
, and XQuery typeswitch
are now compiled
to a (potentially multi-way) Choose
expression.