@abaplint/transpiler
Version:
38 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassDefinitionTranspiler = void 0;
const abaplint = require("@abaplint/core");
const chunk_1 = require("../chunk");
class ClassDefinitionTranspiler {
transpile(node, traversal) {
const className = node.findFirstExpression(abaplint.Expressions.ClassName)?.concatTokens().toUpperCase();
let found = false;
if (className !== undefined) {
for (const a of traversal.getCurrentObject().getABAPFiles()) {
if (a.getInfo().getClassImplementationByName(className) !== undefined) {
found = true;
}
}
}
if (found) {
return new chunk_1.Chunk("");
}
else {
// its an abstract class with only abstract methods
return new chunk_1.Chunk(`
class ${className?.toLowerCase()} {
static INTERNAL_TYPE = 'CLAS';
static IMPLEMENTED_INTERFACES = [];
static INTERNAL_NAME = 'ABSTRACT_CLASS_INTERNAL_NAME';
static ATTRIBUTES = {};
async constructor_() {
this.me = new abap.types.ABAPObject();
this.me.set(this);
return this;
}
}`);
}
}
}
exports.ClassDefinitionTranspiler = ClassDefinitionTranspiler;
//# sourceMappingURL=class_definition.js.map