depgen: Add error for rate block name conflicts
This can occur during template expansion if the user is not careful in ensuring that all generated blocks will have unique names. The error was not useful: it failed type validation, which results in an internal error in the compiler (from the user's perspective) and outputs no useful information to aid in debugging. * src/current/include/depgen.xsl (preproc:depgen preproc:sym): User-friendly error if more than one rate element. [rate]: Allow multiple rate elements.master
parent
df4d976277
commit
e52d6c1eb0
|
@ -275,9 +275,15 @@
|
||||||
<xsl:variable name="pkg" as="element( lv:package )"
|
<xsl:variable name="pkg" as="element( lv:package )"
|
||||||
select="root(.)" />
|
select="root(.)" />
|
||||||
|
|
||||||
<xsl:variable name="rate" as="element( lv:rate )"
|
<xsl:variable name="rate" as="element( lv:rate )*"
|
||||||
select="$pkg/lv:rate[ @yields=$name ]" />
|
select="$pkg/lv:rate[ @yields=$name ]" />
|
||||||
|
|
||||||
|
<xsl:if test="count( $rate ) gt 1">
|
||||||
|
<xsl:message terminate="yes"
|
||||||
|
select="'error: rate block name conflict:',
|
||||||
|
string( $rate/@yields[1] )" />
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
<xsl:apply-templates mode="preproc:depgen"
|
<xsl:apply-templates mode="preproc:depgen"
|
||||||
select="$rate" />
|
select="$rate" />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
Loading…
Reference in New Issue