functionBodyRetrun()

in lib/generator.js [3702:3721]


  functionBodyRetrun(stmt, env) {
    if(stmt.type === 'return') {
      return false;
    }

    if(stmt.type === 'throw') {
      return false;
    }

    if(!(stmt.type !== 'if' || !stmt.elseStmts)) {
      return false;
    }

    if(stmt.type === 'try' && (stmt.tryBlock && stmt.tryBlock.stmts.length > 0 
      && !this.functionBodyRetrun(stmt.tryBlock.stmts[stmt.tryBlock.stmts.length - 1])) && !env.hasReturn) {
      return false;
    }

    return true;
  }