src/current/compiler/js.xsl: Remove dead arg check code

This was removed during The Great Refactoring.
It will be replaced with a better systemin TAMER.
master
Mike Gerwitz 2020-01-20 14:44:58 -05:00
parent e0a78c2ed6
commit 97806d5602
1 changed files with 0 additions and 130 deletions

View File

@ -694,38 +694,6 @@
</template>
<!--
Generate domain checks for require-param nodes
The resulting code will cause an exception to be thrown if the domain check
fails.
FIXME: remove
@return generated domain check code
-->
<template match="lv:required-param" mode="compile">
<!--
<variable name="name" select="@ref" />
<text>vocalDomainCheck( '</text>
<value-of select="$name" />
<text>', '</text>
<value-of select="root(.)//lv:param[ @name=$name ]/@type" />
<text>', args['</text>
<value-of select="$name" />
<text>'] ); </text>
-->
<!-- record that this param was required -->
<!--
<text>req_params['</text>
<value-of select="$name" />
<text>'] = true; </text>
-->
</template>
<!--
Generate code asserting a match
@ -1405,104 +1373,6 @@
};
function argCheck( args, params )
{
var req = {};
for ( var name in params )
{
// if the argument is not required, then we do not yet need to deal
// with it
if ( !( params[ name ].required ) )
{
continue;
}
// first, ensure that required arguments have been provided (note
// the strict check for .length; this is important, since it won't
// have a length property if it's not an array, in which case we do
// not want to trigger an error)
if ( !( args[ name ] ) || ( args[ name ].length === 0 ) )
{
throw Error( "argument required: " + name );
}
var value = args[ name ];
// next, ensure that the argument is within the domain of its type
vocalDomainCheck( name, params[ name ].type, deepClone( value ) );
// record that we required this param
req[ name ] = true;
}
return req;
}
function vocalDomainCheck( name, domain, value )
{
var default_val = ( rater.params[ name ] || {} )['default'];
if ( !( domainCheck( domain, value, default_val ) ) )
{
throw Error(
"argument '" + name + "' value outside domain of '" +
domain + "': " + JSON.stringify( value )
);
}
return true;
}
function domainCheck( domain, value, default_val )
{
var type;
// if it's an object, then the value is assumed to be an array
if ( typeof value === 'object' )
{
if ( value.length < 1 )
{
return true;
}
// clone before popping so that we don't wipe out any values that
// will be used
value = Array.prototype.slice.call( value );
// check each value recursively
return domainCheck( domain, value.pop(), default_val )
&& domainCheck( domain, value, default_val );
}
if ( ( ( value === undefined ) || ( value === '' ) )
&& ( default_val !== undefined )
)
{
value = +default_val;
}
if ( domains[ domain ] )
{
return domains[ domain ]( value );
}
else if ( type = types[ domain ] ) /** XXX: types global **/
{
// custom type checks are two-fold: ensure that the value is within
// the domain of its base type and that it is within its list of
// acceptable values
return !!( domainCheck( type.type, value )
&& type.values[ value ]
);
}
// no domain found
return false;
}
/**
* Checks for matches against values for any param value
*