diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-07-01 13:26:17 +0000 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2009-02-13 00:01:43 +0200 |
commit | 2b1c6b6a5cd99ad3ef268d2b24144a7b2420613f (patch) | |
tree | c98985ee934629d861d2463abb16b269ddb947aa | |
parent | 18a6a65ca2bfcbef69aea57fbdec8fd68b5be04c (diff) |
doc-generator.xsl: fail if a method has no name, is not a direct child of an interface, or has arguments with no type, no direction or an invalid direction
-rw-r--r-- | tools/doc-generator.xsl | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tools/doc-generator.xsl b/tools/doc-generator.xsl index c6e5358..f1e8cf4 100644 --- a/tools/doc-generator.xsl +++ b/tools/doc-generator.xsl @@ -577,6 +577,62 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA </xsl:template> <xsl:template match="method"> + + <xsl:if test="not(parent::interface)"> + <xsl:message terminate="yes"> + <xsl:text>ERR: method </xsl:text> + <xsl:value-of select="@name"/> + <xsl:text> does not have an interface as parent </xsl:text> + </xsl:message> + </xsl:if> + + <xsl:if test="not(@name) or @name = ''"> + <xsl:message terminate="yes"> + <xsl:text>ERR: missing @name on method </xsl:text> + <xsl:value-of select="concat(../@name, '.', @name)"/> + <xsl:text>: '</xsl:text> + <xsl:value-of select="@access"/> + <xsl:text>' </xsl:text> + </xsl:message> + </xsl:if> + + <xsl:for-each select="arg"> + <xsl:if test="not(@type) or @type = ''"> + <xsl:message terminate="yes"> + <xsl:text>ERR: an arg of method </xsl:text> + <xsl:value-of select="concat(../../@name, '.', ../@name)"/> + <xsl:text> has no type</xsl:text> + </xsl:message> + </xsl:if> + <xsl:choose> + <xsl:when test="@direction='in'"> + <xsl:if test="not(@name) or @name = ''"> + <xsl:message terminate="yes"> + <xsl:text>ERR: an 'in' arg of method </xsl:text> + <xsl:value-of select="concat(../../@name, '.', ../@name)"/> + <xsl:text> has no name</xsl:text> + </xsl:message> + </xsl:if> + </xsl:when> + <xsl:when test="@direction='out'"> + <!--<xsl:if test="not(@name) or @name = ''"> + <xsl:message terminate="no"> + <xsl:text>INFO: an 'out' arg of method </xsl:text> + <xsl:value-of select="concat(../../@name, '.', ../@name)"/> + <xsl:text> has no name</xsl:text> + </xsl:message> + </xsl:if>--> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes"> + <xsl:text>ERR: an arg of method </xsl:text> + <xsl:value-of select="concat(../../@name, '.', ../@name)"/> + <xsl:text> has direction neither 'in' nor 'out'</xsl:text> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <div xmlns="http://www.w3.org/1999/xhtml" class="method"> <h3 xmlns="http://www.w3.org/1999/xhtml"> <a name="{concat(../@name, concat('.', @name))}"> |