lib/saigrammar.js
function TaskClauseFormatter(o) {
        var params=[];
        if (!o.nodefaultparam) {
          params.push('p');
        }
        var expects='',locals=[];//$unused=this';
        if (o.expects && o.as) fail("SAI compile: cannot have both EXPECTS and AS in a function declaration");
        if (o.expects && o.expects.length) {
          expects=GetExpectsTester(o.expects,'in-line');
        } else if (o.as) {
          for (var i in o.as) {
            if (i==0) {
              locals.push(o.as[i][0][1]+'='+params[0]);
            } else {
              params.push(o.as[i][0][1]);
            }
          }
        }
        if (!o.preface) o.preface='';
        if (!o.postface) o.postface='';
        var finallocals=[];
        for (var i in locals) if (!References[locals[i]]) finallocals.push(locals[i]);
        locals=locals.length?('var '+finallocals.join(',')+';'):'';
        var code = o.kind+'('+params.join(',')+'){'+o.preface+locals+expects+'{'+o.block+'}'+o.postface+'}';
        if (o.execute) code+='()';
        return code;
      }
function TaskClauseFormatter(o) {
        var params=[];
        if (!o.nodefaultparam) {
          params.push('p');
        }
        var expects='',locals=[];//$unused=this';
        if (o.expects && o.as) fail("SAI compile: cannot have both EXPECTS and AS in a function declaration");
        if (o.expects && o.expects.length) {
          expects=GetExpectsTester(o.expects,'in-line');
        } else if (o.as) {
          for (var i in o.as) {
            if (i==0) {
              locals.push(o.as[i][0][1]+'='+params[0]);
            } else {
              params.push(o.as[i][0][1]);
            }
          }
        }
        if (!o.preface) o.preface='';
        if (!o.postface) o.postface='';
        var finallocals=[];
        for (var i in locals) if (!References[locals[i]]) finallocals.push(locals[i]);
        locals=locals.length?('var '+finallocals.join(',')+';'):'';
        var code = o.kind+'('+params.join(',')+'){'+o.preface+locals+expects+'{'+o.block+'}'+o.postface+'}';
        if (o.execute) code+='()';
        return code;
      }
function TaskClauseFormatter ( o ) { var params = [ ] ; if ( ! o . nodefaultparam ) { params . push ( 'p' ) ; } var expects = '' , locals = [ ] ; //$unused=this'; if ( o . expects && o . as ) fail ( "SAI compile: cannot have both EXPECTS and AS in a function declaration" ) ; if ( o . expects && o . expects . length ) { expects = GetExpectsTester ( o . expects , 'in-line' ) ; } else if ( o . as ) { for ( var i in o . as ) { if ( i == 0 ) { locals . push ( o . as [ i ] [ 0 ] [ 1 ] + '=' + params [ 0 ] ) ; } else { params . push ( o . as [ i ] [ 0 ] [ 1 ] ) ; } } } if ( ! o . preface ) o . preface = '' ; if ( ! o . postface ) o . postface = '' ; var finallocals = [ ] ; for ( var i in locals ) if ( ! References [ locals [ i ] ] ) finallocals . push ( locals [ i ] ) ; locals = locals . length ? ( 'var ' + finallocals . join ( ',' ) + ';' ) : '' ; var code = o . kind + '(' + params . join ( ',' ) + '){' + o . preface + locals + expects + '{' + o . block + '}' + o . postface + '}' ; if ( o . execute ) code += '()' ; return code ; }
expects as kind body preface appendix
expects as kind body preface appendix