@abaplint/transpiler 2.4.10 → 2.4.12
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.
|
@@ -12,12 +12,12 @@ class HandleABAP {
|
|
|
12
12
|
}
|
|
13
13
|
runObject(obj, reg) {
|
|
14
14
|
var _a, _b, _c;
|
|
15
|
-
const spaghetti = new abaplint.SyntaxLogic(reg, obj).run().spaghetti;
|
|
16
15
|
let ret = [];
|
|
17
16
|
if (obj instanceof abaplint.Objects.Program && obj.isInclude() === true) {
|
|
18
17
|
// includes are only compiled along with the programs where its used?
|
|
19
18
|
return [];
|
|
20
19
|
}
|
|
20
|
+
const spaghetti = new abaplint.SyntaxLogic(reg, obj).run().spaghetti;
|
|
21
21
|
for (const file of obj.getSequencedFiles()) {
|
|
22
22
|
const chunk = new chunk_1.Chunk();
|
|
23
23
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.addFilenames) === true) {
|
|
@@ -6,6 +6,9 @@ const chunk_1 = require("../chunk");
|
|
|
6
6
|
const expressions_1 = require("../expressions");
|
|
7
7
|
const unique_identifier_1 = require("../unique_identifier");
|
|
8
8
|
const sql_from_1 = require("../expressions/sql_from");
|
|
9
|
+
function escapeRegExp(string) {
|
|
10
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
11
|
+
}
|
|
9
12
|
class SelectTranspiler {
|
|
10
13
|
transpile(node, traversal, targetOverride) {
|
|
11
14
|
var _a;
|
|
@@ -78,7 +81,7 @@ class SelectTranspiler {
|
|
|
78
81
|
const unique = unique_identifier_1.UniqueIdentifier.get();
|
|
79
82
|
const fn = (_a = node.findFirstExpression(abaplint.Expressions.SQLForAllEntries)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(abaplint.Expressions.SQLSource);
|
|
80
83
|
const faeTranspiled = new expressions_1.SQLSourceTranspiler().transpile(fn, traversal).getCode();
|
|
81
|
-
select = select.replace(new RegExp(" " + faeTranspiled, "g"), " " + unique);
|
|
84
|
+
select = select.replace(new RegExp(" " + escapeRegExp(faeTranspiled), "g"), " " + unique);
|
|
82
85
|
select = select.replace(unique + ".get().table_line.get()", unique + ".get()"); // there can be only one?
|
|
83
86
|
const code = `if (${faeTranspiled}.array().length === 0) {
|
|
84
87
|
throw "FAE, todo, empty table";
|