@abaplint/runtime 2.13.49 → 2.13.50
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.
|
@@ -17,19 +17,22 @@ function concatenate(input) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
if (input.lines === true) {
|
|
20
|
-
|
|
20
|
+
let result = "";
|
|
21
21
|
const tab = input.source[0];
|
|
22
22
|
if (tab instanceof types_1.Table) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
const array = tab.array();
|
|
24
|
+
const length = array.length;
|
|
25
|
+
const respectingBlanks = input.respectingBlanks === true;
|
|
26
|
+
const hasSeparator = sep.length > 0;
|
|
27
|
+
for (let i = 0; i < length; i++) {
|
|
28
|
+
if (hasSeparator === true && i > 0) {
|
|
29
|
+
result += sep;
|
|
29
30
|
}
|
|
31
|
+
const value = array[i].get();
|
|
32
|
+
result += respectingBlanks === true ? value : value.trimEnd();
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
|
-
input.target.set(
|
|
35
|
+
input.target.set(result);
|
|
33
36
|
}
|
|
34
37
|
else {
|
|
35
38
|
let result = "";
|
|
@@ -97,6 +97,19 @@ function insertInternal(options) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
else if (options.initial === true) {
|
|
100
|
+
if (options.table instanceof types_1.HashedTable) {
|
|
101
|
+
const { value: val, subrc: subrc } = options.table.insert(options.table.getRowType());
|
|
102
|
+
if (subrc === 0) {
|
|
103
|
+
if (options.assigning) {
|
|
104
|
+
options.assigning.assign(val);
|
|
105
|
+
}
|
|
106
|
+
if (options.referenceInto) {
|
|
107
|
+
options.referenceInto.assign(val);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
abap.builtin.sy.get().subrc.set(subrc);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
100
113
|
let index = options.table.getArrayLength();
|
|
101
114
|
if (options.index) {
|
|
102
115
|
index = options.index.get() - 1;
|
|
@@ -31,10 +31,10 @@ function dynamicToWhere(condition, evaluate) {
|
|
|
31
31
|
if (evaluate === undefined) {
|
|
32
32
|
throw new Error("Dynamic WHERE evaluation function is not defined");
|
|
33
33
|
}
|
|
34
|
-
const matches = text.matchAll(/([\w-]+)\s+(\w+)\s+([<>\w-]+)/gi);
|
|
34
|
+
const matches = text.matchAll(/([\w-]+)\s+(NOT\s+IN|\w+)\s+([<>\w-]+)/gi);
|
|
35
35
|
for (const match of matches) {
|
|
36
36
|
const left = match[1];
|
|
37
|
-
const comparator = match[2].toLowerCase();
|
|
37
|
+
const comparator = match[2].toLowerCase().replace(/\s+/g, " ");
|
|
38
38
|
let right = "";
|
|
39
39
|
// console.dir({left, right});
|
|
40
40
|
const cleft = "i." + left.toLowerCase().replace(/-/g, ".get().");
|
|
@@ -43,13 +43,21 @@ function dynamicToWhere(condition, evaluate) {
|
|
|
43
43
|
const name = "fs_" + rightMatch[1].toLowerCase() + "_";
|
|
44
44
|
right = `evaluate("${name}").get()["${rightMatch[2].toLowerCase()}"]`;
|
|
45
45
|
}
|
|
46
|
+
const fieldSymbol = match[3].match(/^<(\w+)>$/);
|
|
47
|
+
if (right === "" && fieldSymbol) {
|
|
48
|
+
right = `evaluate("fs_${fieldSymbol[1].toLowerCase()}_").getPointer()`;
|
|
49
|
+
}
|
|
46
50
|
if (right === "") {
|
|
47
|
-
right = `evaluate("${match[3]}")`;
|
|
51
|
+
right = `evaluate("${match[3].toLowerCase()}")`;
|
|
48
52
|
}
|
|
49
53
|
if (comparator === "in") {
|
|
50
54
|
const cnew = `abap.compare.in(${cleft}, ${right})`;
|
|
51
55
|
text = text.replace(match[0], cnew);
|
|
52
56
|
}
|
|
57
|
+
else if (comparator === "not in") {
|
|
58
|
+
const cnew = `!abap.compare.in(${cleft}, ${right})`;
|
|
59
|
+
text = text.replace(match[0], cnew);
|
|
60
|
+
}
|
|
53
61
|
else {
|
|
54
62
|
const cnew = `abap.compare.${comparator}(${cleft}, ${right})`;
|
|
55
63
|
text = text.replace(match[0], cnew);
|
|
@@ -85,11 +85,11 @@ class Integer {
|
|
|
85
85
|
this.set(Math.round(value.getRaw()));
|
|
86
86
|
}
|
|
87
87
|
else if (value instanceof hex_1.Hex || value instanceof xstring_1.XString || value instanceof hex_uint8_1.HexUInt8) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const maxVal = Math.pow(2,
|
|
88
|
+
const hex = value.get();
|
|
89
|
+
let num = parseInt(hex, 16);
|
|
90
|
+
// handle two complement, the first bit is the sign
|
|
91
|
+
if (hex.length >= 8) {
|
|
92
|
+
const maxVal = Math.pow(2, hex.length / 2 * 8);
|
|
93
93
|
if (num > maxVal / 2 - 1) {
|
|
94
94
|
num = num - maxVal;
|
|
95
95
|
}
|