@abaplint/transpiler-cli 2.10.38 → 2.10.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle.js +176 -166
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -80657,6 +80657,7 @@ const handle_smim_1 = __webpack_require__(/*! ./handlers/handle_smim */ "./node_
|
|
|
80657
80657
|
const handle_msag_1 = __webpack_require__(/*! ./handlers/handle_msag */ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_msag.js");
|
|
80658
80658
|
const handle_oa2p_1 = __webpack_require__(/*! ./handlers/handle_oa2p */ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_oa2p.js");
|
|
80659
80659
|
const handle_fugr_1 = __webpack_require__(/*! ./handlers/handle_fugr */ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_fugr.js");
|
|
80660
|
+
const initialization_1 = __webpack_require__(/*! ./initialization */ "./node_modules/@abaplint/transpiler/build/src/initialization.js");
|
|
80660
80661
|
class Transpiler {
|
|
80661
80662
|
constructor(options) {
|
|
80662
80663
|
this.options = options;
|
|
@@ -80681,8 +80682,8 @@ class Transpiler {
|
|
|
80681
80682
|
objects: [],
|
|
80682
80683
|
unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, this.options?.skip),
|
|
80683
80684
|
unitTestScriptOpen: new unit_test_1.UnitTest().unitTestScriptOpen(reg, this.options?.skip),
|
|
80684
|
-
initializationScript: new
|
|
80685
|
-
initializationScript2: new
|
|
80685
|
+
initializationScript: new initialization_1.Initialization().script(reg, dbSetup, this.options?.extraSetup),
|
|
80686
|
+
initializationScript2: new initialization_1.Initialization().script(reg, dbSetup, this.options?.extraSetup, true),
|
|
80686
80687
|
databaseSetup: dbSetup,
|
|
80687
80688
|
reg: reg,
|
|
80688
80689
|
};
|
|
@@ -80745,6 +80746,135 @@ exports.Transpiler = Transpiler;
|
|
|
80745
80746
|
|
|
80746
80747
|
/***/ }),
|
|
80747
80748
|
|
|
80749
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/initialization.js":
|
|
80750
|
+
/*!***********************************************************************!*\
|
|
80751
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/initialization.js ***!
|
|
80752
|
+
\***********************************************************************/
|
|
80753
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
80754
|
+
|
|
80755
|
+
"use strict";
|
|
80756
|
+
|
|
80757
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
80758
|
+
exports.Initialization = void 0;
|
|
80759
|
+
exports.escapeNamespaceFilename = escapeNamespaceFilename;
|
|
80760
|
+
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
80761
|
+
function escapeNamespaceFilename(filename) {
|
|
80762
|
+
// ES modules are resolved and cached as URLs. This means that special characters must be
|
|
80763
|
+
// percent-encoded, such as # with %23 and ? with %3F.
|
|
80764
|
+
return filename.replace(/\//g, "%23");
|
|
80765
|
+
}
|
|
80766
|
+
class Initialization {
|
|
80767
|
+
script(reg, dbSetup, extraSetup, useImport) {
|
|
80768
|
+
let ret = "";
|
|
80769
|
+
if (useImport === true) {
|
|
80770
|
+
ret = `/* eslint-disable import/newline-after-import */
|
|
80771
|
+
import "./_top.mjs";\n`;
|
|
80772
|
+
}
|
|
80773
|
+
else {
|
|
80774
|
+
ret = `/* eslint-disable import/newline-after-import */
|
|
80775
|
+
import runtime from "@abaplint/runtime";
|
|
80776
|
+
globalThis.abap = new runtime.ABAP();\n`;
|
|
80777
|
+
}
|
|
80778
|
+
ret += `${this.buildImports(reg, useImport)}
|
|
80779
|
+
|
|
80780
|
+
export async function initializeABAP() {\n`;
|
|
80781
|
+
ret += ` const sqlite = [];\n`;
|
|
80782
|
+
for (const i of dbSetup.schemas.sqlite) {
|
|
80783
|
+
ret += ` sqlite.push(\`${i}\`);\n`;
|
|
80784
|
+
}
|
|
80785
|
+
ret += ` const hdb = \`${dbSetup.schemas.hdb}\`;\n`;
|
|
80786
|
+
ret += ` const pg = [];\n`;
|
|
80787
|
+
for (const i of dbSetup.schemas.pg) {
|
|
80788
|
+
ret += ` pg.push(\`${i}\`);\n`;
|
|
80789
|
+
}
|
|
80790
|
+
ret += ` const snowflake = [];\n`;
|
|
80791
|
+
for (const i of dbSetup.schemas.snowflake) {
|
|
80792
|
+
ret += ` snowflake.push(\`${i}\`);\n`;
|
|
80793
|
+
}
|
|
80794
|
+
ret += ` const schemas = {sqlite, hdb, pg, snowflake};\n`;
|
|
80795
|
+
ret += `\n`;
|
|
80796
|
+
ret += ` const insert = [];\n`;
|
|
80797
|
+
for (const i of dbSetup.insert) {
|
|
80798
|
+
ret += ` insert.push(\`${i}\`);\n`;
|
|
80799
|
+
}
|
|
80800
|
+
ret += `\n`;
|
|
80801
|
+
if (extraSetup === undefined || extraSetup === "") {
|
|
80802
|
+
ret += `// no setup logic specified in config\n`;
|
|
80803
|
+
}
|
|
80804
|
+
else {
|
|
80805
|
+
ret += ` const {setup} = await import("${extraSetup}");\n` +
|
|
80806
|
+
` await setup(globalThis.abap, schemas, insert);\n`;
|
|
80807
|
+
}
|
|
80808
|
+
ret += `}`;
|
|
80809
|
+
return ret;
|
|
80810
|
+
}
|
|
80811
|
+
buildImports(reg, useImport) {
|
|
80812
|
+
// note: ES modules are hoised, so use the dynamic import(), due to setting of globalThis.abap
|
|
80813
|
+
// some sorting required: eg. a class constructor using constant from interface
|
|
80814
|
+
const list = [];
|
|
80815
|
+
const late = [];
|
|
80816
|
+
const imp = (filename) => {
|
|
80817
|
+
if (useImport === true) {
|
|
80818
|
+
return `import "./${filename}.mjs";`;
|
|
80819
|
+
}
|
|
80820
|
+
else {
|
|
80821
|
+
return `await import("./${filename}.mjs");`;
|
|
80822
|
+
}
|
|
80823
|
+
};
|
|
80824
|
+
for (const obj of reg.getObjects()) {
|
|
80825
|
+
if (obj instanceof abaplint.Objects.Table
|
|
80826
|
+
|| obj instanceof abaplint.Objects.DataElement
|
|
80827
|
+
|| obj instanceof abaplint.Objects.LockObject
|
|
80828
|
+
|| obj instanceof abaplint.Objects.MessageClass
|
|
80829
|
+
|| obj instanceof abaplint.Objects.MIMEObject
|
|
80830
|
+
|| obj instanceof abaplint.Objects.Oauth2Profile
|
|
80831
|
+
|| obj instanceof abaplint.Objects.WebMIME
|
|
80832
|
+
|| obj instanceof abaplint.Objects.TypePool
|
|
80833
|
+
|| obj instanceof abaplint.Objects.TableType) {
|
|
80834
|
+
list.push(imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
80835
|
+
}
|
|
80836
|
+
}
|
|
80837
|
+
for (const obj of reg.getObjects()) {
|
|
80838
|
+
if (obj instanceof abaplint.Objects.FunctionGroup) {
|
|
80839
|
+
list.push(imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.fugr`));
|
|
80840
|
+
}
|
|
80841
|
+
else if (obj instanceof abaplint.Objects.Class) {
|
|
80842
|
+
if (obj.getName().toUpperCase() !== "CL_ABAP_CHAR_UTILITIES"
|
|
80843
|
+
&& this.hasClassConstructor(reg, obj)) {
|
|
80844
|
+
// this will not solve all problems with class constors 100%, but probably good enough
|
|
80845
|
+
late.push(imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
80846
|
+
}
|
|
80847
|
+
else {
|
|
80848
|
+
list.push(imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
80849
|
+
}
|
|
80850
|
+
}
|
|
80851
|
+
else if (obj instanceof abaplint.Objects.Interface) {
|
|
80852
|
+
list.push(imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
80853
|
+
}
|
|
80854
|
+
}
|
|
80855
|
+
return [...list.sort(), ...late].join("\n");
|
|
80856
|
+
}
|
|
80857
|
+
// class constructors might make early use of eg. constants from interfaces
|
|
80858
|
+
// sub classes will import() super classes and trigger a class constructor of the super
|
|
80859
|
+
hasClassConstructor(reg, clas) {
|
|
80860
|
+
if (clas.getDefinition()?.getMethodDefinitions().getByName("CLASS_CONSTRUCTOR") !== undefined) {
|
|
80861
|
+
return true;
|
|
80862
|
+
}
|
|
80863
|
+
const sup = clas.getDefinition()?.getSuperClass();
|
|
80864
|
+
if (sup !== undefined) {
|
|
80865
|
+
const superClass = reg.getObject("CLAS", sup);
|
|
80866
|
+
if (superClass) {
|
|
80867
|
+
return this.hasClassConstructor(reg, superClass);
|
|
80868
|
+
}
|
|
80869
|
+
}
|
|
80870
|
+
return false;
|
|
80871
|
+
}
|
|
80872
|
+
}
|
|
80873
|
+
exports.Initialization = Initialization;
|
|
80874
|
+
//# sourceMappingURL=initialization.js.map
|
|
80875
|
+
|
|
80876
|
+
/***/ }),
|
|
80877
|
+
|
|
80748
80878
|
/***/ "./node_modules/@abaplint/transpiler/build/src/keywords.js":
|
|
80749
80879
|
/*!*****************************************************************!*\
|
|
80750
80880
|
!*** ./node_modules/@abaplint/transpiler/build/src/keywords.js ***!
|
|
@@ -88897,56 +89027,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
88897
89027
|
exports.UnitTest = void 0;
|
|
88898
89028
|
/* eslint-disable max-len */
|
|
88899
89029
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
89030
|
+
const initialization_1 = __webpack_require__(/*! ./initialization */ "./node_modules/@abaplint/transpiler/build/src/initialization.js");
|
|
88900
89031
|
class UnitTest {
|
|
88901
|
-
// todo, move this method somewhere else, its much more than just unit test relevant
|
|
88902
|
-
initializationScript(reg, dbSetup, extraSetup, useImport) {
|
|
88903
|
-
let ret = "";
|
|
88904
|
-
if (useImport === true) {
|
|
88905
|
-
ret = `/* eslint-disable import/newline-after-import */
|
|
88906
|
-
import "./_top.mjs";\n`;
|
|
88907
|
-
}
|
|
88908
|
-
else {
|
|
88909
|
-
ret = `/* eslint-disable import/newline-after-import */
|
|
88910
|
-
import runtime from "@abaplint/runtime";
|
|
88911
|
-
globalThis.abap = new runtime.ABAP();\n`;
|
|
88912
|
-
}
|
|
88913
|
-
ret += `${this.buildImports(reg, useImport)}
|
|
88914
|
-
|
|
88915
|
-
export async function initializeABAP() {\n`;
|
|
88916
|
-
ret += ` const sqlite = [];\n`;
|
|
88917
|
-
for (const i of dbSetup.schemas.sqlite) {
|
|
88918
|
-
ret += ` sqlite.push(\`${i}\`);\n`;
|
|
88919
|
-
}
|
|
88920
|
-
ret += ` const hdb = \`${dbSetup.schemas.hdb}\`;\n`;
|
|
88921
|
-
ret += ` const pg = [];\n`;
|
|
88922
|
-
for (const i of dbSetup.schemas.pg) {
|
|
88923
|
-
ret += ` pg.push(\`${i}\`);\n`;
|
|
88924
|
-
}
|
|
88925
|
-
ret += ` const snowflake = [];\n`;
|
|
88926
|
-
for (const i of dbSetup.schemas.snowflake) {
|
|
88927
|
-
ret += ` snowflake.push(\`${i}\`);\n`;
|
|
88928
|
-
}
|
|
88929
|
-
ret += ` const schemas = {sqlite, hdb, pg, snowflake};\n`;
|
|
88930
|
-
ret += `\n`;
|
|
88931
|
-
ret += ` const insert = [];\n`;
|
|
88932
|
-
for (const i of dbSetup.insert) {
|
|
88933
|
-
ret += ` insert.push(\`${i}\`);\n`;
|
|
88934
|
-
}
|
|
88935
|
-
ret += `\n`;
|
|
88936
|
-
if (extraSetup === undefined || extraSetup === "") {
|
|
88937
|
-
ret += `// no setup logic specified in config\n`;
|
|
88938
|
-
}
|
|
88939
|
-
else {
|
|
88940
|
-
ret += ` const {setup} = await import("${extraSetup}");\n` +
|
|
88941
|
-
` await setup(globalThis.abap, schemas, insert);\n`;
|
|
88942
|
-
}
|
|
88943
|
-
ret += `}`;
|
|
88944
|
-
return ret;
|
|
88945
|
-
}
|
|
88946
|
-
escapeNamespace(filename) {
|
|
88947
|
-
// ES modules are resolved and cached as URLs. This means that special characters must be percent-encoded, such as # with %23 and ? with %3F.
|
|
88948
|
-
return filename.replace(/\//g, "%23");
|
|
88949
|
-
}
|
|
88950
89032
|
unitTestScriptOpen(reg, _skip) {
|
|
88951
89033
|
let ret = `/* eslint-disable curly */
|
|
88952
89034
|
import fs from "fs";
|
|
@@ -88968,7 +89050,7 @@ async function run() {
|
|
|
88968
89050
|
}
|
|
88969
89051
|
const hasTestFile = obj.getFiles().some(f => { return f.getFilename().includes(".testclasses."); });
|
|
88970
89052
|
if (hasTestFile === true) {
|
|
88971
|
-
ret += ` await import("./${
|
|
89053
|
+
ret += ` await import("./${(0, initialization_1.escapeNamespaceFilename)(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}.testclasses.mjs");\n`;
|
|
88972
89054
|
}
|
|
88973
89055
|
for (const file of obj.getABAPFiles()) {
|
|
88974
89056
|
for (const def of file.getInfo().listClassDefinitions()) {
|
|
@@ -89030,7 +89112,8 @@ run().then(() => {
|
|
|
89030
89112
|
}
|
|
89031
89113
|
tests.push({
|
|
89032
89114
|
obj,
|
|
89033
|
-
|
|
89115
|
+
filename: `./${(0, initialization_1.escapeNamespaceFilename)(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}.testclasses.mjs`,
|
|
89116
|
+
localClass: def.name.toLowerCase(),
|
|
89034
89117
|
riskLevel: def.riskLevel,
|
|
89035
89118
|
duration: def.duration,
|
|
89036
89119
|
methods: methods,
|
|
@@ -89086,65 +89169,53 @@ run().then(() => {
|
|
|
89086
89169
|
return tests;
|
|
89087
89170
|
}
|
|
89088
89171
|
unitTestScript(reg, skip) {
|
|
89172
|
+
const callSpecial = (name) => {
|
|
89173
|
+
let ret = "";
|
|
89174
|
+
ret += `if (test.${name}) await test.${name}();\n`;
|
|
89175
|
+
ret += ` if (test.FRIENDS_ACCESS_INSTANCE.${name}) await test.FRIENDS_ACCESS_INSTANCE.${name}();\n`;
|
|
89176
|
+
ret += ` if (test.FRIENDS_ACCESS_INSTANCE.SUPER && test.FRIENDS_ACCESS_INSTANCE.SUPER.${name}) await test.FRIENDS_ACCESS_INSTANCE.SUPER.${name}();`;
|
|
89177
|
+
return ret;
|
|
89178
|
+
};
|
|
89089
89179
|
let ret = `/* eslint-disable curly */
|
|
89090
|
-
|
|
89091
|
-
import path from "path";
|
|
89092
|
-
import {fileURLToPath} from "url";
|
|
89180
|
+
/* eslint-disable max-len */
|
|
89093
89181
|
import {initializeABAP} from "./init.mjs";
|
|
89094
|
-
import runtime from "@abaplint/runtime";
|
|
89095
89182
|
|
|
89096
|
-
|
|
89183
|
+
function getData() {
|
|
89184
|
+
const ret = [];\n`;
|
|
89185
|
+
for (const st of this.getSortedTests(reg)) {
|
|
89186
|
+
const methods = [];
|
|
89187
|
+
for (const m of st.methods) {
|
|
89188
|
+
const skipThis = (skip || []).some(a => a.object.toUpperCase() === st.obj.getName().toUpperCase()
|
|
89189
|
+
&& a.class.toUpperCase() === st.localClass.toUpperCase()
|
|
89190
|
+
&& a.method.toUpperCase() === m.toUpperCase());
|
|
89191
|
+
methods.push({
|
|
89192
|
+
name: m,
|
|
89193
|
+
skip: skipThis,
|
|
89194
|
+
});
|
|
89195
|
+
}
|
|
89196
|
+
ret += ` ret.push({objectName: "${st.obj.getName()}", localClass: "${st.localClass}", methods: ${JSON.stringify(methods)}, filename: "${st.filename}"});\n`;
|
|
89197
|
+
}
|
|
89198
|
+
ret += ` return ret;
|
|
89199
|
+
}
|
|
89097
89200
|
|
|
89098
89201
|
async function run() {
|
|
89099
89202
|
await initializeABAP();
|
|
89100
|
-
const
|
|
89101
|
-
|
|
89102
|
-
|
|
89103
|
-
|
|
89104
|
-
|
|
89105
|
-
|
|
89106
|
-
|
|
89107
|
-
|
|
89108
|
-
|
|
89109
|
-
|
|
89110
|
-
|
|
89111
|
-
|
|
89112
|
-
|
|
89113
|
-
|
|
89114
|
-
const skipThis = (skip || []).some(a => a.object === st.obj.getName() && a.class === lc && a.method === m);
|
|
89115
|
-
if (skipThis) {
|
|
89116
|
-
ret += ` console.log('${st.obj.getName()}: running ${lc}->${m}, skipped');\n`;
|
|
89117
|
-
ret += ` meth = locl.addMethod("${m}");\n`;
|
|
89118
|
-
ret += ` meth.skip();\n`;
|
|
89119
|
-
continue;
|
|
89120
|
-
}
|
|
89121
|
-
const callSpecial = (name) => {
|
|
89122
|
-
let ret = "";
|
|
89123
|
-
ret += ` if (test.${name}) await test.${name}();\n`;
|
|
89124
|
-
ret += ` if (test.FRIENDS_ACCESS_INSTANCE.${name}) await test.FRIENDS_ACCESS_INSTANCE.${name}();\n`;
|
|
89125
|
-
ret += ` if (test.FRIENDS_ACCESS_INSTANCE.SUPER && test.FRIENDS_ACCESS_INSTANCE.SUPER.${name}) await test.FRIENDS_ACCESS_INSTANCE.SUPER.${name}();\n`;
|
|
89126
|
-
return ret;
|
|
89127
|
-
};
|
|
89128
|
-
ret += ` {\n const test = await (new ${lc}()).constructor_();\n`;
|
|
89129
|
-
ret += callSpecial("setup");
|
|
89130
|
-
ret += ` console.log("${st.obj.getName()}: running ${lc}->${m}");\n`;
|
|
89131
|
-
ret += ` meth = locl.addMethod("${m}");\n`;
|
|
89132
|
-
ret += ` await test.FRIENDS_ACCESS_INSTANCE.${m}();\n`;
|
|
89133
|
-
ret += ` meth.pass();\n`;
|
|
89134
|
-
ret += callSpecial("teardown");
|
|
89135
|
-
ret += ` }\n`;
|
|
89136
|
-
}
|
|
89137
|
-
ret += ` if (${lc}.class_teardown) await ${lc}.class_teardown();\n`;
|
|
89138
|
-
ret += ` }\n`;
|
|
89139
|
-
}
|
|
89140
|
-
ret += `// -------------------END-------------------
|
|
89141
|
-
fs.writeFileSync(__dirname + path.sep + "_output.xml", unit.xUnitXML());
|
|
89142
|
-
} catch (e) {
|
|
89143
|
-
if (meth) {
|
|
89144
|
-
meth.fail();
|
|
89203
|
+
for (const st of getData()) {
|
|
89204
|
+
const imported = await import(st.filename);
|
|
89205
|
+
const localClass = imported[st.localClass];
|
|
89206
|
+
if (localClass.class_setup) await localClass.class_setup();
|
|
89207
|
+
for (const m of st.methods) {
|
|
89208
|
+
if (m.skip) {
|
|
89209
|
+
console.log(st.objectName + ": running " + st.localClass + "->" + m.name + ", skipped");
|
|
89210
|
+
} else {
|
|
89211
|
+
const test = await (new localClass()).constructor_();
|
|
89212
|
+
${callSpecial("setup")}
|
|
89213
|
+
console.log(st.objectName + ": running " + st.localClass + "->" + m.name);
|
|
89214
|
+
await test.FRIENDS_ACCESS_INSTANCE[m.name]();
|
|
89215
|
+
${callSpecial("teardown")}
|
|
89216
|
+
}
|
|
89145
89217
|
}
|
|
89146
|
-
|
|
89147
|
-
throw e;
|
|
89218
|
+
if (localClass.class_teardown) await localClass.class_teardown();
|
|
89148
89219
|
}
|
|
89149
89220
|
}
|
|
89150
89221
|
|
|
@@ -89156,67 +89227,6 @@ run().then(() => {
|
|
|
89156
89227
|
});`;
|
|
89157
89228
|
return ret;
|
|
89158
89229
|
}
|
|
89159
|
-
buildImports(reg, useImport) {
|
|
89160
|
-
// note: ES modules are hoised, so use the dynamic import(), due to setting of globalThis.abap
|
|
89161
|
-
// some sorting required: eg. a class constructor using constant from interface
|
|
89162
|
-
const list = [];
|
|
89163
|
-
const late = [];
|
|
89164
|
-
const imp = (filename) => {
|
|
89165
|
-
if (useImport === true) {
|
|
89166
|
-
return `import "./${filename}.mjs";`;
|
|
89167
|
-
}
|
|
89168
|
-
else {
|
|
89169
|
-
return `await import("./${filename}.mjs");`;
|
|
89170
|
-
}
|
|
89171
|
-
};
|
|
89172
|
-
for (const obj of reg.getObjects()) {
|
|
89173
|
-
if (obj instanceof abaplint.Objects.Table
|
|
89174
|
-
|| obj instanceof abaplint.Objects.DataElement
|
|
89175
|
-
|| obj instanceof abaplint.Objects.LockObject
|
|
89176
|
-
|| obj instanceof abaplint.Objects.MessageClass
|
|
89177
|
-
|| obj instanceof abaplint.Objects.MIMEObject
|
|
89178
|
-
|| obj instanceof abaplint.Objects.Oauth2Profile
|
|
89179
|
-
|| obj instanceof abaplint.Objects.WebMIME
|
|
89180
|
-
|| obj instanceof abaplint.Objects.TypePool
|
|
89181
|
-
|| obj instanceof abaplint.Objects.TableType) {
|
|
89182
|
-
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
89183
|
-
}
|
|
89184
|
-
}
|
|
89185
|
-
for (const obj of reg.getObjects()) {
|
|
89186
|
-
if (obj instanceof abaplint.Objects.FunctionGroup) {
|
|
89187
|
-
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.fugr`));
|
|
89188
|
-
}
|
|
89189
|
-
else if (obj instanceof abaplint.Objects.Class) {
|
|
89190
|
-
if (obj.getName().toUpperCase() !== "CL_ABAP_CHAR_UTILITIES"
|
|
89191
|
-
&& this.hasClassConstructor(reg, obj)) {
|
|
89192
|
-
// this will not solve all problems with class constors 100%, but probably good enough
|
|
89193
|
-
late.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
89194
|
-
}
|
|
89195
|
-
else {
|
|
89196
|
-
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
89197
|
-
}
|
|
89198
|
-
}
|
|
89199
|
-
else if (obj instanceof abaplint.Objects.Interface) {
|
|
89200
|
-
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
89201
|
-
}
|
|
89202
|
-
}
|
|
89203
|
-
return [...list.sort(), ...late].join("\n");
|
|
89204
|
-
}
|
|
89205
|
-
// class constructors might make early use of eg. constants from interfaces
|
|
89206
|
-
// sub classes will import() super classes and trigger a class constructor of the super
|
|
89207
|
-
hasClassConstructor(reg, clas) {
|
|
89208
|
-
if (clas.getDefinition()?.getMethodDefinitions().getByName("CLASS_CONSTRUCTOR") !== undefined) {
|
|
89209
|
-
return true;
|
|
89210
|
-
}
|
|
89211
|
-
const sup = clas.getDefinition()?.getSuperClass();
|
|
89212
|
-
if (sup !== undefined) {
|
|
89213
|
-
const superClass = reg.getObject("CLAS", sup);
|
|
89214
|
-
if (superClass) {
|
|
89215
|
-
return this.hasClassConstructor(reg, superClass);
|
|
89216
|
-
}
|
|
89217
|
-
}
|
|
89218
|
-
return false;
|
|
89219
|
-
}
|
|
89220
89230
|
}
|
|
89221
89231
|
exports.UnitTest = UnitTest;
|
|
89222
89232
|
//# sourceMappingURL=unit_test.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.40",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@abaplint/core": "^2.113.108",
|
|
31
|
-
"@abaplint/transpiler": "^2.10.
|
|
31
|
+
"@abaplint/transpiler": "^2.10.40",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/node": "^22.14.0",
|
|
34
34
|
"@types/progress": "^2.0.7",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"ts-json-schema-generator": "^2.4.0",
|
|
38
38
|
"typescript": "^5.8.3",
|
|
39
39
|
"webpack-cli": "^6.0.1",
|
|
40
|
-
"webpack": "^5.99.
|
|
40
|
+
"webpack": "^5.99.5"
|
|
41
41
|
}
|
|
42
42
|
}
|