visitMethodCall()

in lib/generator.js [1727:1746]


  visitMethodCall(ast, level) {
    assert.equal(ast.left.type, 'method_call');
    const name = _name(ast.left.id);
    const functionName = _avoidKeywords(_snakeCase(name));
    if (name.startsWith('$') && this.builtin[name]) {
      const method = name.replace('$', '');
      this.builtin[name][method](ast, level, ast.isAsync && this.isAsyncFunction);
      return;
    } else if(this.isStaticFunction === false && this.isAsyncFunction && ast.isAsync){
      this.emit(`await self.${functionName}_async`);
    } else if(this.isStaticFunction === false) {
      this.emit(`self.${functionName}`);
    } else if(ast.isAsync && this.isAsyncFunction) {
      this.emit(`await ${this.className}.${functionName}_async`);
    } else  {
      const functionName = _snakeCase(name);
      this.emit(`${this.className}.${functionName}`);
    }
    this.visitArgs(ast.args, level);
  }