src/compile/blocks.js
function(str, local, contextId) {

      if (!local) {

        if (utils.isArray(str)) {
          return this._render(str);
        } else {
          return this.evalStr(str);
        }

      } else {

        var asts = [];
        var parse = Velocity.parse;
        contextId = contextId || ('eval:' + utils.guid());

        if (utils.isArray(str)) {

          asts = str;

        } else if (parse) {

          asts = parse(str);

        }

        if (asts.length) {

          this.local[contextId] = local;
          var ret = this._render(asts, contextId);
          this.local[contextId] = {};
          this.conditions.shift();
          this.condition = this.conditions[0] || '';

          return ret;
        }

      }

    }
function(str, local, contextId) {

      if (!local) {

        if (utils.isArray(str)) {
          return this._render(str);
        } else {
          return this.evalStr(str);
        }

      } else {

        var asts = [];
        var parse = Velocity.parse;
        contextId = contextId || ('eval:' + utils.guid());

        if (utils.isArray(str)) {

          asts = str;

        } else if (parse) {

          asts = parse(str);

        }

        if (asts.length) {

          this.local[contextId] = local;
          var ret = this._render(asts, contextId);
          this.local[contextId] = {};
          this.conditions.shift();
          this.condition = this.conditions[0] || '';

          return ret;
        }

      }

    }
function ( str , local , contextId ) { if ( ! local ) { if ( utils . isArray ( str ) ) { return this . _render ( str ) ; } else { return this . evalStr ( str ) ; } } else { var asts = [ ] ; var parse = Velocity . parse ; contextId = contextId || ( 'eval:' + utils . guid ( ) ) ; if ( utils . isArray ( str ) ) { asts = str ; } else if ( parse ) { asts = parse ( str ) ; } if ( asts . length ) { this . local [ contextId ] = local ; var ret = this . _render ( asts , contextId ) ; this . local [ contextId ] = { } ; this . conditions . shift ( ) ; this . condition = this . conditions [ 0 ] || '' ; return ret ; } } }
eval
@param str {array|string} 需要解析的字符串
@param local {object} 局部变量
@param contextId {string}
@return {string}
eval