apiBefore()

in lib/generator.js [2239:2258]


  apiBefore(main, filepath, level) {
    let clientName = this.config.clientName;
    if(!main) {
      const beginNotes = DSL.note.getNotes(this.notes, 0, this.ast.moduleBody.nodes[0].tokenRange[0]);
      const clientNote = beginNotes.find(note => note.note.lexeme === '@clientName');
      if(clientNote) {
        clientName = _string(clientNote.arg.value);
      } else {
        const fileInfo = path.parse(filepath);
        clientName = _upperFirst(fileInfo.name);
      }
    }

    this.emit(`class ${clientName}`, level);
    if (this.parentModule) {
      const moduleName = this.getRealClientName(this.parentModule.lexeme);
      this.emit(` extends ${moduleName}`);
    }
    this.emit(' {\n', level);
  }