in lib/generator.js [355:392]
visitModuleClient(ast, apis, nonStaticFuncs, level) {
if (!ast.extends && (apis.length > 0 || nonStaticFuncs.length > 0)) {
this.emit(`type ${this.structName} struct {\n`, level);
if(!this.noCompatible) {
this.emit(`DisableSDKError *bool\n`, level + 1);
}
for (let i = 0; i < ast.moduleBody.nodes.length; i++) {
const node = ast.moduleBody.nodes[i];
if (node.type === 'type' && node.vid) {
let comments = DSL.comment.getFrontComments(this.comments, node.tokenRange[0]);
this.visitComments(comments, level + 1);
this.emit(`${_format(_name(node.vid).substring(1))} `, level + 1);
this.visitPointerType(node.value, level);
this.emit(`\n`);
}
}
this.emit(`}\n\n`, level);
} else if (ast.extends) {
this.emit(`type ${this.structName} struct {\n`, level);
this.emit('', level + 1);
this.visitModuleName(ast.extends);
this.emit(`.${this.constructFunc[_name(ast.extends)]}\n`);
if(!this.noCompatible) {
this.emit(`DisableSDKError *bool\n`, level + 1);
}
for (let i = 0; i < ast.moduleBody.nodes.length; i++) {
const node = ast.moduleBody.nodes[i];
if (node.type === 'type' && node.vid) {
let comments = DSL.comment.getFrontComments(this.comments, node.tokenRange[0]);
this.visitComments(comments, level + 1);
this.emit(`${_avoidVariableKeywords(_format(_name(node.vid).substring(1)))} `, level + 1);
this.visitPointerType(node.value, level);
this.emit(`\n`);
}
}
this.emit(`}\n\n`, level);
}
}