@abaplint/core
Version:
abaplint - Core API
150 lines • 5.04 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SkipLogic = void 0;
const objects_1 = require("./objects");
const include_graph_1 = require("./utils/include_graph");
class SkipLogic {
constructor(reg) {
this.reg = reg;
this.tobj = undefined;
}
skip(obj) {
const global = this.reg.getConfig().getGlobal();
if (global.skipGeneratedGatewayClasses === true
&& obj instanceof objects_1.Class
&& this.isGeneratedGatewayClass(obj)) {
return true;
}
else if (global.skipIncludesWithoutMain === true
&& obj instanceof objects_1.Program
&& obj.isInclude() === true) {
const ig = new include_graph_1.IncludeGraph(this.reg);
const file = obj.getMainABAPFile();
if (file && ig.listMainForInclude(file.getFilename()).length === 0) {
return true;
}
}
else if (global.skipGeneratedPersistentClasses === true
&& obj instanceof objects_1.Class
&& this.isGeneratedPersistentClass(obj)) {
return true;
}
else if (global.skipGeneratedFunctionGroups === true
&& obj instanceof objects_1.FunctionGroup
&& this.isGeneratedFunctionGroup(obj)) {
return true;
}
else if (global.skipGeneratedProxyClasses === true
&& obj instanceof objects_1.Class
&& this.isGeneratedProxyClass(obj)) {
return true;
}
else if (global.skipGeneratedProxyInterfaces === true
&& obj instanceof objects_1.Interface
&& this.isGeneratedProxyInterface(obj)) {
return true;
}
else if (global.skipGeneratedBOPFInterfaces === true
&& obj instanceof objects_1.Interface
&& this.isGeneratedBOPFInterface(obj)) {
return true;
}
return false;
}
///////////////////////////
isGeneratedBOPFInterface(obj) {
var _a;
const implementing = (_a = obj.getDefinition()) === null || _a === void 0 ? void 0 : _a.getImplementing();
if (implementing === undefined) {
return false;
}
for (const i of implementing) {
if (i.name.toUpperCase() === "/BOBF/IF_LIB_CONSTANTS") {
return true;
}
}
return false;
}
isGeneratedProxyInterface(obj) {
const xml = obj.getXML();
if (!xml) {
return false;
}
const result = xml.match(/<CLSPROXY>(.)<\/CLSPROXY>/);
if (result) {
return true;
}
else {
return false;
}
}
isGeneratedProxyClass(obj) {
const xml = obj.getXML();
if (!xml) {
return false;
}
const result = xml.match(/<CLSPROXY>(.)<\/CLSPROXY>/);
if (result) {
return true;
}
else {
return false;
}
}
isGeneratedFunctionGroup(group) {
var _a;
if (this.tobj === undefined) {
this.tobj = {};
for (const obj of this.reg.getObjects()) {
if (obj.getType() !== "TOBJ") {
continue;
}
const tobj = obj;
const area = (_a = tobj.getArea()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
if (area) {
this.tobj[area] = true;
}
}
}
return this.tobj[group.getName().toUpperCase()];
}
isGeneratedGatewayClass(obj) {
var _a;
let sup = undefined;
const definition = obj.getClassDefinition();
if (definition) {
sup = (_a = definition.superClassName) === null || _a === void 0 ? void 0 : _a.toUpperCase();
}
if (obj.getName().match(/_MPC$/i) && sup === "/IWBEP/CL_MGW_PUSH_ABS_MODEL") {
return true;
}
else if (obj.getName().match(/_DPC$/i) && sup === "/IWBEP/CL_MGW_PUSH_ABS_DATA") {
return true;
}
else if (sup === "CL_SADL_GTK_EXPOSURE_MPC") {
return true;
}
return false;
}
isGeneratedPersistentClass(obj) {
if (obj.getCategory() === objects_1.ClassCategory.Persistent) {
return true;
}
else if (obj.getCategory() === objects_1.ClassCategory.PersistentFactory) {
return true;
}
const main = obj.getClassDefinition();
if (main) {
const sup = main.superClassName;
if (sup) {
const sclass = this.reg.getObject("CLAS", sup.toUpperCase());
if (sclass && sclass.getCategory() === objects_1.ClassCategory.PersistentFactory) {
return true;
}
}
}
return false;
}
}
exports.SkipLogic = SkipLogic;
//# sourceMappingURL=skip_logic.js.map