@abaplint/core
Version:
abaplint - Core API
78 lines • 2.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Program = void 0;
const _abap_object_1 = require("./_abap_object");
const _dynpros_1 = require("./_dynpros");
const xml_utils_1 = require("../xml_utils");
class Program extends _abap_object_1.ABAPObject {
getType() {
return "PROG";
}
getSequencedFiles() {
const main = this.getMainABAPFile();
if (main === undefined) {
return [];
}
return [main];
}
getDescription() {
var _a;
this.parseXML();
return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description;
}
getAllowedNaming() {
return {
maxLength: 40,
allowNamespace: true,
};
}
setDirty() {
this.parsedXML = undefined;
super.setDirty();
}
isInclude() {
this.parseXML();
return this.parsedXML.isInclude;
}
isModulePool() {
this.parseXML();
return this.parsedXML.isModulePool;
}
getDynpros() {
this.parseXML();
return this.parsedXML.dynpros || [];
}
////////////////////////////
parseXML() {
var _a, _b, _c;
if (this.parsedXML !== undefined) {
return;
}
const file = this.getXMLFile();
const parsed = this.parseRaw2();
if (parsed === undefined) {
this.parsedXML = {
isInclude: false,
isModulePool: false,
description: undefined,
dynpros: [],
};
return;
}
let description = "";
for (const t of (0, xml_utils_1.xmlToArray)((_c = (_b = (_a = parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]["asx:values"]) === null || _b === void 0 ? void 0 : _b.TPOOL) === null || _c === void 0 ? void 0 : _c.item)) {
if ((t === null || t === void 0 ? void 0 : t.ID) === "R") {
description = t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : "";
}
}
const dynpros = (0, _dynpros_1.parseDynpros)(parsed);
this.parsedXML = {
isInclude: file ? file.getRaw().includes("<SUBC>I</SUBC>") : false,
isModulePool: file ? file.getRaw().includes("<SUBC>M</SUBC>") : false,
dynpros: dynpros,
description: description,
};
}
}
exports.Program = Program;
//# sourceMappingURL=program.js.map