@abaplint/transpiler 2.1.82 → 2.1.84
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.
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FieldChainTranspiler = void 0;
|
|
4
4
|
const core_1 = require("@abaplint/core");
|
|
5
5
|
const _1 = require(".");
|
|
6
|
+
const traversal_1 = require("../traversal");
|
|
6
7
|
const field_symbol_1 = require("./field_symbol");
|
|
7
8
|
const chunk_1 = require("../chunk");
|
|
8
9
|
class FieldChainTranspiler {
|
|
@@ -27,9 +28,9 @@ class FieldChainTranspiler {
|
|
|
27
28
|
}
|
|
28
29
|
else if (c.get() instanceof core_1.Expressions.AttributeName) {
|
|
29
30
|
const interfaceName = traversal.isInterfaceAttribute(c.getFirstToken());
|
|
30
|
-
let name = c.getFirstToken().getStr().replace("~", "$").toLowerCase();
|
|
31
|
+
let name = traversal_1.Traversal.escapeClassName(c.getFirstToken().getStr()).replace("~", "$").toLowerCase();
|
|
31
32
|
if (prefix && interfaceName && name.startsWith(interfaceName) === false) {
|
|
32
|
-
name = interfaceName + "$" + name;
|
|
33
|
+
name = traversal_1.Traversal.escapeClassName(interfaceName) + "$" + name;
|
|
33
34
|
}
|
|
34
35
|
ret.append(name, c, traversal);
|
|
35
36
|
}
|
package/build/src/unit_test.js
CHANGED
|
@@ -28,7 +28,7 @@ export async function initializeABAP() {\n`;
|
|
|
28
28
|
ret += ` const schemas = {sqlite, hdb, pg};\n`;
|
|
29
29
|
ret += ` const insert = [];\n`;
|
|
30
30
|
for (const i of dbSetup.insert) {
|
|
31
|
-
ret += `insert.push(\`${i}\`);\n`;
|
|
31
|
+
ret += ` insert.push(\`${i}\`);\n`;
|
|
32
32
|
}
|
|
33
33
|
if (extraSetup === undefined) {
|
|
34
34
|
ret += `// no setup logic specified in config\n`;
|
|
@@ -180,9 +180,10 @@ run().then(() => {
|
|
|
180
180
|
}
|
|
181
181
|
buildImports(reg, useImport) {
|
|
182
182
|
// note: ES modules are hoised, so use the dynamic import(), due to setting of globalThis.abap
|
|
183
|
-
//
|
|
184
|
-
|
|
183
|
+
// some sorting required: eg. a class constructor using constant from interface
|
|
184
|
+
var _a;
|
|
185
185
|
const list = [];
|
|
186
|
+
const late = [];
|
|
186
187
|
const imp = (filename) => {
|
|
187
188
|
if (useImport === true) {
|
|
188
189
|
return `import "./${filename}.mjs";`;
|
|
@@ -204,12 +205,21 @@ run().then(() => {
|
|
|
204
205
|
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.fugr.${m.getName().toLowerCase()}`));
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
|
-
else if (obj instanceof abaplint.Objects.Class
|
|
208
|
-
|
|
208
|
+
else if (obj instanceof abaplint.Objects.Class) {
|
|
209
|
+
if (obj.getName().toUpperCase() !== "CL_ABAP_CHAR_UTILITIES"
|
|
210
|
+
&& ((_a = obj.getDefinition()) === null || _a === void 0 ? void 0 : _a.getMethodDefinitions().getByName("CLASS_CONSTRUCTOR")) !== undefined) {
|
|
211
|
+
// this will not solve all problems with class constors 100%, but probably good enough
|
|
212
|
+
late.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
else if (obj instanceof abaplint.Objects.Interface) {
|
|
209
219
|
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
|
|
210
220
|
}
|
|
211
221
|
}
|
|
212
|
-
return list.sort().join("\n");
|
|
222
|
+
return [...list.sort(), ...late].join("\n");
|
|
213
223
|
}
|
|
214
224
|
}
|
|
215
225
|
exports.UnitTest = UnitTest;
|