diff options
author | Mike Gerwitz <mike.gerwitz@ryansg.com> | 2020-01-20 14:44:58 -0500 |
---|---|---|
committer | Mike Gerwitz <mike.gerwitz@ryansg.com> | 2020-01-22 16:30:53 -0500 |
commit | 97806d5602467614e3604c7a246d3d3404b467ca (patch) | |
tree | 7191d51a1d4017b8272edcb2eccfab2ad5f846ae /src | |
parent | e0a78c2ed6546414812ef67934ead2bed2230d7f (diff) | |
download | tame-97806d5602467614e3604c7a246d3d3404b467ca.tar.gz tame-97806d5602467614e3604c7a246d3d3404b467ca.tar.bz2 tame-97806d5602467614e3604c7a246d3d3404b467ca.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/current/compiler/js.xsl | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/src/current/compiler/js.xsl b/src/current/compiler/js.xsl index 1b7b19b..ce66135 100644 --- a/src/current/compiler/js.xsl +++ b/src/current/compiler/js.xsl @@ -695,38 +695,6 @@ <!-- - 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 Siblings are joined by default with ampersands to denote an AND relationship, @@ -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 * |