map: Always terminate on missing destination symbol
This was a bit of a nasty one. Fortunately, this was only used as a validation, so the code that the compiler produced was still correct. The problem was that a version of Saxon sometime between 9.5 and 9.8 added an optimization to eliminate conditionals with no body. Consequently, the kluge to force the variable to be evaluated was optimized away, `lvmc:get-symbol' was never called, and no error was ever produced. This would be best refactored, but that's not something I have time to take up at the moment priority-wise. This should be future-proof since this would never be a noop. * src/current/compiler/map.xsl (lvmc:compile)[lvm:map//lvm:from[*]]: Force evaluation of `$sym' by ensuring that the condition will not be a noop.master
parent
cd5440b8da
commit
10106993b5
|
@ -491,6 +491,8 @@
|
|||
string( $symname ),
|
||||
''' (did you import the package?)' )" />
|
||||
</if>
|
||||
|
||||
<sequence select="$sym" />
|
||||
</function>
|
||||
|
||||
|
||||
|
@ -700,13 +702,20 @@
|
|||
<variable name="nested" as="xs:boolean"
|
||||
select="exists( ancestor::lvm:from )" />
|
||||
|
||||
<!-- XXX: we rely on the side-effect of this blowing up if the
|
||||
symbol does not exist -->
|
||||
<variable name="sym" as="element( preproc:sym )?"
|
||||
select="lvmc:get-symbol( $symtable, $type, $to, @name )" />
|
||||
|
||||
<!-- kluge to force function call (it's lazy) -->
|
||||
<if test="not( $sym )" />
|
||||
<!-- Saxon evaluates variables lazily. Rather than using the
|
||||
Saxon-specific @saxon:assign="true" attribute above, we just need to
|
||||
use the value. This conditional cannot be empty, otherwise it'll be
|
||||
optimized away. -->
|
||||
<if test="not( $sym )">
|
||||
<!-- Consequently, this should never be hit -->
|
||||
<message terminate="yes"
|
||||
select="concat( 'internal: unexpected condition in ',
|
||||
'lvm:map//lvm:from processing of ',
|
||||
$to, ' to ', @name )" />
|
||||
</if>
|
||||
|
||||
<!-- oval = orig val -->
|
||||
<text>(function(oval){</text>
|
||||
|
|
Loading…
Reference in New Issue