Bug #3363
Updated by Michael Kay almost 4 years ago
When an expression is loop-lifted out of a loop, or out of an xsl:choose, it must be evaluated lazily to ensure that evaluation does not occur if the loop is executed zero times (or if the relevant branch of a conditional is not chosen). The SEF export file reflects this requirement with the value of let/@eval. But Saxon-JS ignores this attribute, meaning that the expression may be evaluated eagerly, leading to unwanted costs, unwanted failures, or premature side-effects. (It might be that the appropriate solution is to avoid such aggressive optimization when -target:js is set). Reported informally by John Lumley.