Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2017-11-29 13:19:41 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2017-11-29 13:19:41 -0500
commite52d6c1eb0fe8e6e1b95f3a5566d17c36da7b6c0 (patch)
tree02f94b957422192280c1d7145358e7bd30b2a7e3
parentdf4d976277795d06796b70043847d020c8d724aa (diff)
downloadtame-e52d6c1eb0fe8e6e1b95f3a5566d17c36da7b6c0.tar.gz
tame-e52d6c1eb0fe8e6e1b95f3a5566d17c36da7b6c0.tar.bz2
tame-e52d6c1eb0fe8e6e1b95f3a5566d17c36da7b6c0.zip
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.
-rw-r--r--src/current/include/depgen.xsl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/current/include/depgen.xsl b/src/current/include/depgen.xsl
index 9b2424f..ab8f30e 100644
--- a/src/current/include/depgen.xsl
+++ b/src/current/include/depgen.xsl
@@ -275,9 +275,15 @@
<xsl:variable name="pkg" as="element( lv:package )"
select="root(.)" />
- <xsl:variable name="rate" as="element( lv:rate )"
+ <xsl:variable name="rate" as="element( lv:rate )*"
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"
select="$rate" />
</xsl:template>