Support constant refs with lv:match/@on

We've never done this before (thus this bug lasting so many years), but only
because it doesn't really make much sense in practice; this was caught when
writing test cases.

* src/current/compiler/js.xsl (compile)[lv:match]: Compile `consts' instead
    of `args' when referencing a constant.
master
Mike Gerwitz 2018-01-04 14:36:22 -05:00
parent a62d155eb0
commit 107581017b
1 changed files with 13 additions and 1 deletions

View File

@ -710,6 +710,9 @@
<variable name="name" select="@on" />
<variable name="sym-on" as="element( preproc:sym )"
select="root(.)/preproc:symtable/preproc:sym[ @name = $name ]" />
<text> tmp = </text>
<variable name="input-raw">
@ -721,7 +724,16 @@
</when>
<otherwise>
<text>args['</text>
<choose>
<when test="$sym-on/@type = 'const'">
<text>consts</text>
</when>
<otherwise>
<text>args</text>
</otherwise>
</choose>
<text>['</text>
<value-of select="translate( @on, &quot;'&quot;, '' )" />
<text>']</text>
</otherwise>