in lib/generator.js [1363:1413]
visitExtendOn(extendOn, type = 'model') {
if (!extendOn) {
type === 'model' ? this.pushImports(`${CORE}Model`) : this.pushImports(`${CORE}Exception`);
return type === 'model' ? this.emit(`(${CORE}Model)`) : this.emit(`(${CORE}Exception)`);
}
switch(_name(extendOn)) {
case '$Error':
this.pushImports(`${CORE}Exception`);
this.emit(`(${CORE}Exception)`);
return;
case '$ResponseError':
this.pushImports('ResponseException');
this.emit('(ResponseException)');
return;
case '$Model':
this.pushImports(`${CORE}Model`);
this.emit(`(${CORE}Model)`);
return;
}
let needBaseException = false;
if (extendOn.type === 'moduleModel') {
const [moduleId, ...rest] = extendOn.path;
const moduleName = _name(moduleId);
const modelName = _subModelName(rest.map((item) => {
return item.lexeme;
}).join('.'));
const externModel = this.usedExternModel.get(moduleName);
if (externModel && externModel.has(modelName) && type === 'exception') {
needBaseException = true;
}
this.emit(`(${this.getModelName(modelName, moduleName, type)}`);
} else if (extendOn.type === 'subModel') {
const [moduleId, ...rest] = extendOn.path;
const subModelName = _subModelName([moduleId.lexeme, ...rest.map((item) => {
return item.lexeme;
})].join('.'));
this.emit(`(${this.emit(this.getModelName(subModelName, '', type))}`);
} else {
this.emit('(');
this.emit(this.getModelName(_upperFirst(_name(extendOn)), extendOn.moduleName, type));
}
if(needBaseException) {
this.emit(`, ${CORE}Exception`);
}
this.emit(')');
}