@abaplint/cli 2.120.74 → 2.120.76
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/cli.js +3152 -314
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -1875,6 +1875,9 @@ const Tokens = __importStar(__webpack_require__(/*! ../1_lexer/tokens */ "../cor
|
|
|
1875
1875
|
const nodes_1 = __webpack_require__(/*! ../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
1876
1876
|
const version_1 = __webpack_require__(/*! ../../version */ "../core/build/src/version.js");
|
|
1877
1877
|
const result_1 = __webpack_require__(/*! ./result */ "../core/build/src/abap/2_statements/result.js");
|
|
1878
|
+
// shared result for "nothing matched", frozen so accidental mutation throws instead of leaking between calls.
|
|
1879
|
+
// Returned arrays are never mutated by callers, which allows returning shared/input arrays as is
|
|
1880
|
+
const EMPTY = Object.freeze([]);
|
|
1878
1881
|
class Regex {
|
|
1879
1882
|
constructor(r) {
|
|
1880
1883
|
this.regexp = r;
|
|
@@ -1886,17 +1889,23 @@ class Regex {
|
|
|
1886
1889
|
return [];
|
|
1887
1890
|
}
|
|
1888
1891
|
run(r) {
|
|
1889
|
-
|
|
1892
|
+
let result = undefined;
|
|
1890
1893
|
for (const input of r) {
|
|
1891
1894
|
if (input.remainingLength() === 0) {
|
|
1892
1895
|
continue;
|
|
1893
1896
|
}
|
|
1894
1897
|
const token = input.peek();
|
|
1895
1898
|
if (this.regexp.test(token.getStr()) === true) {
|
|
1896
|
-
|
|
1899
|
+
const shifted = input.shift(new nodes_1.TokenNodeRegex(token));
|
|
1900
|
+
if (result === undefined) {
|
|
1901
|
+
result = [shifted];
|
|
1902
|
+
}
|
|
1903
|
+
else {
|
|
1904
|
+
result.push(shifted);
|
|
1905
|
+
}
|
|
1897
1906
|
}
|
|
1898
1907
|
}
|
|
1899
|
-
return result;
|
|
1908
|
+
return result !== null && result !== void 0 ? result : EMPTY;
|
|
1900
1909
|
}
|
|
1901
1910
|
railroad() {
|
|
1902
1911
|
return "Railroad.Terminal(\"" + this.regexp.source.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\")";
|
|
@@ -1919,15 +1928,20 @@ class Word {
|
|
|
1919
1928
|
return [];
|
|
1920
1929
|
}
|
|
1921
1930
|
run(r) {
|
|
1922
|
-
|
|
1931
|
+
let result = undefined;
|
|
1923
1932
|
for (const input of r) {
|
|
1924
1933
|
if (input.remainingLength() !== 0
|
|
1925
1934
|
&& input.peek().getUpperStr() === this.s) {
|
|
1926
|
-
|
|
1927
|
-
result
|
|
1935
|
+
const shifted = input.shift(new nodes_1.TokenNode(input.peek()));
|
|
1936
|
+
if (result === undefined) {
|
|
1937
|
+
result = [shifted];
|
|
1938
|
+
}
|
|
1939
|
+
else {
|
|
1940
|
+
result.push(shifted);
|
|
1941
|
+
}
|
|
1928
1942
|
}
|
|
1929
1943
|
}
|
|
1930
|
-
return result;
|
|
1944
|
+
return result !== null && result !== void 0 ? result : EMPTY;
|
|
1931
1945
|
}
|
|
1932
1946
|
railroad() {
|
|
1933
1947
|
return "Railroad.Terminal('\"" + this.s + "\"')";
|
|
@@ -1951,14 +1965,20 @@ class Token {
|
|
|
1951
1965
|
return [];
|
|
1952
1966
|
}
|
|
1953
1967
|
run(r) {
|
|
1954
|
-
|
|
1968
|
+
let result = undefined;
|
|
1955
1969
|
for (const input of r) {
|
|
1956
1970
|
if (input.remainingLength() !== 0
|
|
1957
1971
|
&& input.peek().constructor === this.tokenType) {
|
|
1958
|
-
|
|
1972
|
+
const shifted = input.shift(new nodes_1.TokenNode(input.peek()));
|
|
1973
|
+
if (result === undefined) {
|
|
1974
|
+
result = [shifted];
|
|
1975
|
+
}
|
|
1976
|
+
else {
|
|
1977
|
+
result.push(shifted);
|
|
1978
|
+
}
|
|
1959
1979
|
}
|
|
1960
1980
|
}
|
|
1961
|
-
return result;
|
|
1981
|
+
return result !== null && result !== void 0 ? result : EMPTY;
|
|
1962
1982
|
}
|
|
1963
1983
|
railroad() {
|
|
1964
1984
|
let text = this.name;
|
|
@@ -1996,9 +2016,9 @@ class Vers {
|
|
|
1996
2016
|
if (this.also === AlsoIn.OpenABAP) {
|
|
1997
2017
|
return this.runnable.run(r);
|
|
1998
2018
|
}
|
|
1999
|
-
return (0, version_1.releaseAtLeast)(version_1.Release.v702, this.release) ? this.runnable.run(r) :
|
|
2019
|
+
return (0, version_1.releaseAtLeast)(version_1.Release.v702, this.release) ? this.runnable.run(r) : EMPTY;
|
|
2000
2020
|
}
|
|
2001
|
-
return (0, version_1.releaseAtLeast)(Combi.getRelease(), this.release) ? this.runnable.run(r) :
|
|
2021
|
+
return (0, version_1.releaseAtLeast)(Combi.getRelease(), this.release) ? this.runnable.run(r) : EMPTY;
|
|
2002
2022
|
}
|
|
2003
2023
|
getUsing() {
|
|
2004
2024
|
return this.runnable.getUsing();
|
|
@@ -2046,7 +2066,7 @@ class LangVers {
|
|
|
2046
2066
|
return this.runnable.run(r);
|
|
2047
2067
|
}
|
|
2048
2068
|
else {
|
|
2049
|
-
return
|
|
2069
|
+
return EMPTY;
|
|
2050
2070
|
}
|
|
2051
2071
|
}
|
|
2052
2072
|
railroad() {
|
|
@@ -2079,7 +2099,7 @@ class LangVersNot {
|
|
|
2079
2099
|
return this.runnable.run(r);
|
|
2080
2100
|
}
|
|
2081
2101
|
else {
|
|
2082
|
-
return
|
|
2102
|
+
return EMPTY;
|
|
2083
2103
|
}
|
|
2084
2104
|
}
|
|
2085
2105
|
railroad() {
|
|
@@ -2107,6 +2127,22 @@ class OptionalPriority {
|
|
|
2107
2127
|
return this.optional.getUsing();
|
|
2108
2128
|
}
|
|
2109
2129
|
run(r) {
|
|
2130
|
+
if (r.length === 1) {
|
|
2131
|
+
// single input, pass and return the input array without wrapping
|
|
2132
|
+
const res = this.optional.run(r);
|
|
2133
|
+
if (res.length > 1) {
|
|
2134
|
+
return res;
|
|
2135
|
+
}
|
|
2136
|
+
else if (res.length === 0) {
|
|
2137
|
+
return r;
|
|
2138
|
+
}
|
|
2139
|
+
else if (res[0].remainingLength() < r[0].remainingLength()) {
|
|
2140
|
+
return res;
|
|
2141
|
+
}
|
|
2142
|
+
else {
|
|
2143
|
+
return r;
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2110
2146
|
const result = [];
|
|
2111
2147
|
for (const input of r) {
|
|
2112
2148
|
const res = this.optional.run([input]);
|
|
@@ -2146,6 +2182,11 @@ class Optional {
|
|
|
2146
2182
|
return this.optional.getUsing();
|
|
2147
2183
|
}
|
|
2148
2184
|
run(r) {
|
|
2185
|
+
if (r.length === 1) {
|
|
2186
|
+
// single input, pass and return the input array without wrapping
|
|
2187
|
+
const res = this.optional.run(r);
|
|
2188
|
+
return res.length === 0 ? r : r.concat(res);
|
|
2189
|
+
}
|
|
2149
2190
|
const result = [];
|
|
2150
2191
|
for (const input of r) {
|
|
2151
2192
|
result.push(input);
|
|
@@ -2183,14 +2224,16 @@ class Star {
|
|
|
2183
2224
|
let result = r;
|
|
2184
2225
|
try {
|
|
2185
2226
|
let res = r;
|
|
2186
|
-
let input = [];
|
|
2187
2227
|
for (;;) {
|
|
2188
|
-
|
|
2189
|
-
res = this.sta.run(input);
|
|
2228
|
+
res = this.sta.run(res);
|
|
2190
2229
|
if (res.length === 0) {
|
|
2191
2230
|
break;
|
|
2192
2231
|
}
|
|
2193
|
-
if (
|
|
2232
|
+
if (result === r) {
|
|
2233
|
+
// copy on first match, the input array must not be mutated
|
|
2234
|
+
result = r.concat(res);
|
|
2235
|
+
}
|
|
2236
|
+
else if (res.length > 1000) {
|
|
2194
2237
|
// avoid stack overflow
|
|
2195
2238
|
result = result.concat(res);
|
|
2196
2239
|
}
|
|
@@ -2332,6 +2375,17 @@ class Sequence {
|
|
|
2332
2375
|
return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);
|
|
2333
2376
|
}
|
|
2334
2377
|
run(r) {
|
|
2378
|
+
if (r.length === 1) {
|
|
2379
|
+
// single input, pass it down without wrapping and return the last result as is
|
|
2380
|
+
let temp = r;
|
|
2381
|
+
for (const sequence of this.list) {
|
|
2382
|
+
temp = sequence.run(temp);
|
|
2383
|
+
if (temp.length === 0) {
|
|
2384
|
+
return EMPTY;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
return temp;
|
|
2388
|
+
}
|
|
2335
2389
|
let result = [];
|
|
2336
2390
|
for (const input of r) {
|
|
2337
2391
|
let temp = [input];
|
|
@@ -2409,12 +2463,33 @@ class Expression {
|
|
|
2409
2463
|
this.runnable = undefined;
|
|
2410
2464
|
}
|
|
2411
2465
|
run(r) {
|
|
2412
|
-
const results = [];
|
|
2413
2466
|
if (this.runnable === undefined) {
|
|
2414
2467
|
this.runnable = this.getRunnable();
|
|
2415
2468
|
}
|
|
2469
|
+
if (r.length === 1) {
|
|
2470
|
+
// single input, pass it down without wrapping
|
|
2471
|
+
const input = r[0];
|
|
2472
|
+
const temp = this.runnable.run(r);
|
|
2473
|
+
if (temp.length === 0) {
|
|
2474
|
+
return EMPTY;
|
|
2475
|
+
}
|
|
2476
|
+
const results = new Array(temp.length);
|
|
2477
|
+
for (let i = 0; i < temp.length; i++) {
|
|
2478
|
+
const t = temp[i];
|
|
2479
|
+
const consumed = input.remainingLength() - t.remainingLength();
|
|
2480
|
+
results[i] = consumed > 0 ? t.wrapConsumed(consumed, new nodes_1.ExpressionNode(this)) : t;
|
|
2481
|
+
}
|
|
2482
|
+
return results;
|
|
2483
|
+
}
|
|
2484
|
+
let results = undefined;
|
|
2416
2485
|
for (const input of r) {
|
|
2417
2486
|
const temp = this.runnable.run([input]);
|
|
2487
|
+
if (temp.length === 0) {
|
|
2488
|
+
continue;
|
|
2489
|
+
}
|
|
2490
|
+
else if (results === undefined) {
|
|
2491
|
+
results = [];
|
|
2492
|
+
}
|
|
2418
2493
|
for (const t of temp) {
|
|
2419
2494
|
const consumed = input.remainingLength() - t.remainingLength();
|
|
2420
2495
|
if (consumed > 0) {
|
|
@@ -2426,8 +2501,7 @@ class Expression {
|
|
|
2426
2501
|
}
|
|
2427
2502
|
}
|
|
2428
2503
|
}
|
|
2429
|
-
|
|
2430
|
-
return results;
|
|
2504
|
+
return results !== null && results !== void 0 ? results : EMPTY;
|
|
2431
2505
|
}
|
|
2432
2506
|
listKeywords() {
|
|
2433
2507
|
// do not recurse, all Expressions are evaluated only on first level
|
|
@@ -2468,12 +2542,16 @@ class Permutation {
|
|
|
2468
2542
|
return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);
|
|
2469
2543
|
}
|
|
2470
2544
|
run(r) {
|
|
2471
|
-
|
|
2472
|
-
|
|
2545
|
+
let result = undefined;
|
|
2546
|
+
let copy = undefined;
|
|
2473
2547
|
for (let index = 0; index < this.list.length; index++) {
|
|
2474
2548
|
const temp = this.list[index].run(r);
|
|
2475
2549
|
if (temp.length !== 0) {
|
|
2476
2550
|
// match
|
|
2551
|
+
if (result === undefined || copy === undefined) {
|
|
2552
|
+
result = [];
|
|
2553
|
+
copy = this.list.slice();
|
|
2554
|
+
}
|
|
2477
2555
|
result.push(...temp);
|
|
2478
2556
|
const left = copy;
|
|
2479
2557
|
left.splice(index, 1);
|
|
@@ -2485,7 +2563,7 @@ class Permutation {
|
|
|
2485
2563
|
}
|
|
2486
2564
|
}
|
|
2487
2565
|
}
|
|
2488
|
-
return result;
|
|
2566
|
+
return result !== null && result !== void 0 ? result : EMPTY;
|
|
2489
2567
|
}
|
|
2490
2568
|
railroad() {
|
|
2491
2569
|
const children = this.list.map((e) => { return e.railroad(); });
|
|
@@ -2562,17 +2640,31 @@ class Alternative {
|
|
|
2562
2640
|
return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);
|
|
2563
2641
|
}
|
|
2564
2642
|
run(r) {
|
|
2565
|
-
|
|
2643
|
+
var _a;
|
|
2644
|
+
// only allocate a new array when more than one alternative matches
|
|
2645
|
+
let single = undefined;
|
|
2646
|
+
let result = undefined;
|
|
2566
2647
|
for (const sequ of this.list) {
|
|
2567
2648
|
const temp = sequ.run(r);
|
|
2568
|
-
if (temp.length ===
|
|
2569
|
-
|
|
2649
|
+
if (temp.length === 0) {
|
|
2650
|
+
continue;
|
|
2651
|
+
}
|
|
2652
|
+
else if (result !== undefined) {
|
|
2653
|
+
if (temp.length === 1) {
|
|
2654
|
+
result.push(temp[0]);
|
|
2655
|
+
}
|
|
2656
|
+
else {
|
|
2657
|
+
result.push(...temp);
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
else if (single !== undefined) {
|
|
2661
|
+
result = single.concat(temp);
|
|
2570
2662
|
}
|
|
2571
2663
|
else {
|
|
2572
|
-
|
|
2664
|
+
single = temp;
|
|
2573
2665
|
}
|
|
2574
2666
|
}
|
|
2575
|
-
return result;
|
|
2667
|
+
return (_a = result !== null && result !== void 0 ? result : single) !== null && _a !== void 0 ? _a : EMPTY;
|
|
2576
2668
|
}
|
|
2577
2669
|
railroad() {
|
|
2578
2670
|
const children = this.list.map((e) => { return e.railroad(); });
|
|
@@ -2623,21 +2715,13 @@ class AlternativePriority {
|
|
|
2623
2715
|
return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);
|
|
2624
2716
|
}
|
|
2625
2717
|
run(r) {
|
|
2626
|
-
const result = [];
|
|
2627
2718
|
for (const sequ of this.list) {
|
|
2628
|
-
// console.log(seq.toStr());
|
|
2629
2719
|
const temp = sequ.run(r);
|
|
2630
2720
|
if (temp.length > 0) {
|
|
2631
|
-
|
|
2632
|
-
result.push(temp[0]);
|
|
2633
|
-
}
|
|
2634
|
-
else {
|
|
2635
|
-
result.push(...temp);
|
|
2636
|
-
}
|
|
2637
|
-
break;
|
|
2721
|
+
return temp;
|
|
2638
2722
|
}
|
|
2639
2723
|
}
|
|
2640
|
-
return
|
|
2724
|
+
return EMPTY;
|
|
2641
2725
|
}
|
|
2642
2726
|
railroad() {
|
|
2643
2727
|
const children = this.list.map((e) => { return e.railroad(); });
|
|
@@ -2843,18 +2927,21 @@ class StopBefore2 {
|
|
|
2843
2927
|
getUsing() { return []; }
|
|
2844
2928
|
run(r) {
|
|
2845
2929
|
var _a;
|
|
2846
|
-
|
|
2847
|
-
|
|
2930
|
+
// only copy when something is filtered out
|
|
2931
|
+
let result = undefined;
|
|
2932
|
+
for (let i = 0; i < r.length; i++) {
|
|
2933
|
+
const input = r[i];
|
|
2848
2934
|
const next = input.peek();
|
|
2849
|
-
if (next === undefined
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2935
|
+
if (next === undefined
|
|
2936
|
+
|| (next.getUpperStr() === this.t1 && ((_a = input.peekAt(1)) === null || _a === void 0 ? void 0 : _a.getUpperStr()) === this.t2)) {
|
|
2937
|
+
if (result === undefined) {
|
|
2938
|
+
result = r.slice(0, i);
|
|
2939
|
+
}
|
|
2853
2940
|
continue;
|
|
2854
2941
|
}
|
|
2855
|
-
result.push(input);
|
|
2942
|
+
result === null || result === void 0 ? void 0 : result.push(input);
|
|
2856
2943
|
}
|
|
2857
|
-
return result;
|
|
2944
|
+
return result !== null && result !== void 0 ? result : r;
|
|
2858
2945
|
}
|
|
2859
2946
|
railroad() { return "Railroad.Terminal('stopBefore(" + this.t1 + " " + this.t2 + ")')"; }
|
|
2860
2947
|
toStr() { return "stopBefore(" + this.t1 + "," + this.t2 + ")"; }
|
|
@@ -2869,15 +2956,20 @@ class StopBefore1 {
|
|
|
2869
2956
|
getUsing() { return []; }
|
|
2870
2957
|
run(r) {
|
|
2871
2958
|
var _a;
|
|
2872
|
-
|
|
2873
|
-
|
|
2959
|
+
// only copy when something is filtered out
|
|
2960
|
+
let result = undefined;
|
|
2961
|
+
for (let i = 0; i < r.length; i++) {
|
|
2962
|
+
const input = r[i];
|
|
2874
2963
|
const next = (_a = input.peek()) === null || _a === void 0 ? void 0 : _a.getUpperStr();
|
|
2875
2964
|
if (next !== undefined && this.words.includes(next)) {
|
|
2965
|
+
if (result === undefined) {
|
|
2966
|
+
result = r.slice(0, i);
|
|
2967
|
+
}
|
|
2876
2968
|
continue;
|
|
2877
2969
|
}
|
|
2878
|
-
result.push(input);
|
|
2970
|
+
result === null || result === void 0 ? void 0 : result.push(input);
|
|
2879
2971
|
}
|
|
2880
|
-
return result;
|
|
2972
|
+
return result !== null && result !== void 0 ? result : r;
|
|
2881
2973
|
}
|
|
2882
2974
|
railroad() { return "Railroad.Terminal('stopBefore(" + this.words.join("|") + ")')"; }
|
|
2883
2975
|
toStr() { return "stopBefore(" + this.words.join(",") + ")"; }
|
|
@@ -24903,6 +24995,12 @@ class BuiltIn {
|
|
|
24903
24995
|
}
|
|
24904
24996
|
return BuiltIn.unnamedArgument.has(name.toUpperCase());
|
|
24905
24997
|
}
|
|
24998
|
+
static returnsArgumentType(name) {
|
|
24999
|
+
if (name === undefined) {
|
|
25000
|
+
return false;
|
|
25001
|
+
}
|
|
25002
|
+
return BuiltIn.argumentTypedReturn.has(name.toUpperCase());
|
|
25003
|
+
}
|
|
24906
25004
|
static isPredicate(name) {
|
|
24907
25005
|
if (name === undefined) {
|
|
24908
25006
|
return undefined;
|
|
@@ -26010,6 +26108,8 @@ BuiltIn.unnamedArgument = new Set([
|
|
|
26010
26108
|
"FRAC", "LINES", "LOG", "LOG10", "NUMOFCHAR", "SIGN", "SIN", "SINH", "SQRT", "STRLEN", "TAN", "TANH",
|
|
26011
26109
|
"TRUNC", "XSTRLEN"
|
|
26012
26110
|
]);
|
|
26111
|
+
// numeric functions returning a value of the type of the argument
|
|
26112
|
+
BuiltIn.argumentTypedReturn = new Set(["ABS", "CEIL", "FLOOR", "FRAC", "SIGN", "TRUNC"]);
|
|
26013
26113
|
//# sourceMappingURL=_builtin.js.map
|
|
26014
26114
|
|
|
26015
26115
|
/***/ },
|
|
@@ -26591,6 +26691,142 @@ exports.CurrentScope = CurrentScope;
|
|
|
26591
26691
|
|
|
26592
26692
|
/***/ },
|
|
26593
26693
|
|
|
26694
|
+
/***/ "../core/build/src/abap/5_syntax/_loop_table_change.js"
|
|
26695
|
+
/*!*************************************************************!*\
|
|
26696
|
+
!*** ../core/build/src/abap/5_syntax/_loop_table_change.js ***!
|
|
26697
|
+
\*************************************************************/
|
|
26698
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
26699
|
+
|
|
26700
|
+
"use strict";
|
|
26701
|
+
|
|
26702
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
26703
|
+
if (k2 === undefined) k2 = k;
|
|
26704
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26705
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26706
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26707
|
+
}
|
|
26708
|
+
Object.defineProperty(o, k2, desc);
|
|
26709
|
+
}) : (function(o, m, k, k2) {
|
|
26710
|
+
if (k2 === undefined) k2 = k;
|
|
26711
|
+
o[k2] = m[k];
|
|
26712
|
+
}));
|
|
26713
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26714
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26715
|
+
}) : function(o, v) {
|
|
26716
|
+
o["default"] = v;
|
|
26717
|
+
});
|
|
26718
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26719
|
+
var ownKeys = function(o) {
|
|
26720
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26721
|
+
var ar = [];
|
|
26722
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26723
|
+
return ar;
|
|
26724
|
+
};
|
|
26725
|
+
return ownKeys(o);
|
|
26726
|
+
};
|
|
26727
|
+
return function (mod) {
|
|
26728
|
+
if (mod && mod.__esModule) return mod;
|
|
26729
|
+
var result = {};
|
|
26730
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
26731
|
+
__setModuleDefault(result, mod);
|
|
26732
|
+
return result;
|
|
26733
|
+
};
|
|
26734
|
+
})();
|
|
26735
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26736
|
+
exports.LoopTableChange = void 0;
|
|
26737
|
+
const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
26738
|
+
const Statements = __importStar(__webpack_require__(/*! ../2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
26739
|
+
const nodes_1 = __webpack_require__(/*! ../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
26740
|
+
const basic_1 = __webpack_require__(/*! ../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
26741
|
+
const _scope_type_1 = __webpack_require__(/*! ./_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
|
|
26742
|
+
const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
26743
|
+
/** In a method, the body of the table an enclosing LOOP AT walks cannot be replaced or freed,
|
|
26744
|
+
* "you cannot access the entire table body in change mode in a loop. If this is known statically,
|
|
26745
|
+
* a syntax error occurs in classes", see the ABAP keyword documentation for LOOP AT itab.
|
|
26746
|
+
* Only tables named directly are handled, a field symbol or a reference is a runtime matter. */
|
|
26747
|
+
class LoopTableChange {
|
|
26748
|
+
constructor() {
|
|
26749
|
+
this.tables = [];
|
|
26750
|
+
}
|
|
26751
|
+
/** returns true if the LOOP structure was pushed, then pop() must be called after it */
|
|
26752
|
+
push(node, scope) {
|
|
26753
|
+
var _a, _b;
|
|
26754
|
+
if (scope.getType() !== _scope_type_1.ScopeType.Method) {
|
|
26755
|
+
return false;
|
|
26756
|
+
}
|
|
26757
|
+
const loop = node.findDirectStatement(Statements.Loop);
|
|
26758
|
+
if (loop === undefined || loop.findDirectExpression(Expressions.LoopGroupBy) !== undefined) {
|
|
26759
|
+
return false;
|
|
26760
|
+
}
|
|
26761
|
+
const chain = (_b = (_a = loop.findDirectExpression(Expressions.LoopSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.SimpleSource2)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.FieldChain);
|
|
26762
|
+
const children = (chain === null || chain === void 0 ? void 0 : chain.getChildren()) || [];
|
|
26763
|
+
if (children.length !== 1 && !(children.length === 2 && children[1].get() instanceof Expressions.TableBody)) {
|
|
26764
|
+
return false;
|
|
26765
|
+
}
|
|
26766
|
+
const found = LoopTableChange.findTable(children[0], scope);
|
|
26767
|
+
if (found === undefined) {
|
|
26768
|
+
return false;
|
|
26769
|
+
}
|
|
26770
|
+
this.tables.push(found);
|
|
26771
|
+
return true;
|
|
26772
|
+
}
|
|
26773
|
+
pop() {
|
|
26774
|
+
this.tables.pop();
|
|
26775
|
+
}
|
|
26776
|
+
check(node, input) {
|
|
26777
|
+
if (this.tables.length === 0 || input.scope.getType() !== _scope_type_1.ScopeType.Method) {
|
|
26778
|
+
return;
|
|
26779
|
+
}
|
|
26780
|
+
// DELETE itab WHERE is not refused, abapGit does it in zcl_abapgit_syntax_xml->order_matches,
|
|
26781
|
+
// SORT is left out, it is not certain that it is checked statically
|
|
26782
|
+
const s = node.get();
|
|
26783
|
+
if (!(s instanceof Statements.Clear)
|
|
26784
|
+
&& !(s instanceof Statements.Free)
|
|
26785
|
+
&& !(s instanceof Statements.Refresh)
|
|
26786
|
+
&& !(s instanceof Statements.Move)) {
|
|
26787
|
+
return;
|
|
26788
|
+
}
|
|
26789
|
+
for (const target of node.findDirectExpressions(Expressions.Target)) {
|
|
26790
|
+
const children = target.getChildren();
|
|
26791
|
+
const body = children.length === 2 && children[1].get() instanceof Expressions.TableBody;
|
|
26792
|
+
if (children.length !== 1 && body === false) {
|
|
26793
|
+
continue;
|
|
26794
|
+
}
|
|
26795
|
+
else if (!(children[0].get() instanceof Expressions.TargetField)) {
|
|
26796
|
+
continue;
|
|
26797
|
+
}
|
|
26798
|
+
const found = LoopTableChange.findTable(children[0], input.scope);
|
|
26799
|
+
if (found === undefined || this.tables.includes(found) === false) {
|
|
26800
|
+
continue;
|
|
26801
|
+
}
|
|
26802
|
+
else if (found.getType().isWithHeader() === true && body === false) {
|
|
26803
|
+
// without [] the statement works on the header line
|
|
26804
|
+
continue;
|
|
26805
|
+
}
|
|
26806
|
+
const message = `"${found.getName()}" cannot be changed as a whole inside a LOOP over it`;
|
|
26807
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
26808
|
+
return;
|
|
26809
|
+
}
|
|
26810
|
+
}
|
|
26811
|
+
static findTable(node, scope) {
|
|
26812
|
+
var _a;
|
|
26813
|
+
if (!(node instanceof nodes_1.ExpressionNode)
|
|
26814
|
+
|| node.getChildren().length !== 1
|
|
26815
|
+
|| !(((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Field)) {
|
|
26816
|
+
return undefined;
|
|
26817
|
+
}
|
|
26818
|
+
const found = scope.findVariable(node.concatTokens());
|
|
26819
|
+
if (found === undefined || !(found.getType() instanceof basic_1.TableType)) {
|
|
26820
|
+
return undefined;
|
|
26821
|
+
}
|
|
26822
|
+
return found;
|
|
26823
|
+
}
|
|
26824
|
+
}
|
|
26825
|
+
exports.LoopTableChange = LoopTableChange;
|
|
26826
|
+
//# sourceMappingURL=_loop_table_change.js.map
|
|
26827
|
+
|
|
26828
|
+
/***/ },
|
|
26829
|
+
|
|
26594
26830
|
/***/ "../core/build/src/abap/5_syntax/_object_oriented.js"
|
|
26595
26831
|
/*!***********************************************************!*\
|
|
26596
26832
|
!*** ../core/build/src/abap/5_syntax/_object_oriented.js ***!
|
|
@@ -29844,6 +30080,99 @@ function checkTextSymbol(source, parameterType, input) {
|
|
|
29844
30080
|
|
|
29845
30081
|
/***/ },
|
|
29846
30082
|
|
|
30083
|
+
/***/ "../core/build/src/abap/5_syntax/expressions/_substring.js"
|
|
30084
|
+
/*!*****************************************************************!*\
|
|
30085
|
+
!*** ../core/build/src/abap/5_syntax/expressions/_substring.js ***!
|
|
30086
|
+
\*****************************************************************/
|
|
30087
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
30088
|
+
|
|
30089
|
+
"use strict";
|
|
30090
|
+
|
|
30091
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30092
|
+
if (k2 === undefined) k2 = k;
|
|
30093
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
30094
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30095
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
30096
|
+
}
|
|
30097
|
+
Object.defineProperty(o, k2, desc);
|
|
30098
|
+
}) : (function(o, m, k, k2) {
|
|
30099
|
+
if (k2 === undefined) k2 = k;
|
|
30100
|
+
o[k2] = m[k];
|
|
30101
|
+
}));
|
|
30102
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
30103
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30104
|
+
}) : function(o, v) {
|
|
30105
|
+
o["default"] = v;
|
|
30106
|
+
});
|
|
30107
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30108
|
+
var ownKeys = function(o) {
|
|
30109
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30110
|
+
var ar = [];
|
|
30111
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30112
|
+
return ar;
|
|
30113
|
+
};
|
|
30114
|
+
return ownKeys(o);
|
|
30115
|
+
};
|
|
30116
|
+
return function (mod) {
|
|
30117
|
+
if (mod && mod.__esModule) return mod;
|
|
30118
|
+
var result = {};
|
|
30119
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30120
|
+
__setModuleDefault(result, mod);
|
|
30121
|
+
return result;
|
|
30122
|
+
};
|
|
30123
|
+
})();
|
|
30124
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30125
|
+
exports.substringType = substringType;
|
|
30126
|
+
exports.isFieldSymbolItself = isFieldSymbolItself;
|
|
30127
|
+
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
30128
|
+
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
30129
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
30130
|
+
// The type of a substring with a static offset or length, used for reading and writing positions.
|
|
30131
|
+
// On a character or byte field of fixed length the substring must lie inside the field, else it is
|
|
30132
|
+
// a syntax error. Other types, a dynamic offset or length and "*" (undefined) are left alone, as is
|
|
30133
|
+
// length 0. The offset is applied first, so the length is compared to what remains after the offset.
|
|
30134
|
+
function substringType(context, offset, length, node, input) {
|
|
30135
|
+
if (!(context instanceof basic_1.CharacterType) && !(context instanceof basic_1.HexType)) {
|
|
30136
|
+
return context;
|
|
30137
|
+
}
|
|
30138
|
+
const fieldLength = context.getLength();
|
|
30139
|
+
if (offset !== undefined && offset > 0) {
|
|
30140
|
+
if (offset >= fieldLength) {
|
|
30141
|
+
const message = `Offset ${offset} is outside the field of length ${fieldLength}`;
|
|
30142
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
30143
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
30144
|
+
}
|
|
30145
|
+
return context instanceof basic_1.CharacterType ? new basic_1.CharacterType(fieldLength - offset) : new basic_1.HexType(fieldLength - offset);
|
|
30146
|
+
}
|
|
30147
|
+
if (length !== undefined && length > 0) {
|
|
30148
|
+
if (length > fieldLength) {
|
|
30149
|
+
const message = `Length ${length} exceeds the remaining length ${fieldLength} of the field`;
|
|
30150
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
30151
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
30152
|
+
}
|
|
30153
|
+
return context instanceof basic_1.CharacterType ? new basic_1.CharacterType(length) : new basic_1.HexType(length);
|
|
30154
|
+
}
|
|
30155
|
+
return context;
|
|
30156
|
+
}
|
|
30157
|
+
// A field symbol typed "c" or "x" is generic, but its type is represented with length 1, so the
|
|
30158
|
+
// offset or length at "index" is not checked when it directly follows the field symbol
|
|
30159
|
+
function isFieldSymbolItself(children, index) {
|
|
30160
|
+
var _a;
|
|
30161
|
+
const first = (_a = children[0]) === null || _a === void 0 ? void 0 : _a.get();
|
|
30162
|
+
if (!(first instanceof Expressions.SourceFieldSymbol) && !(first instanceof Expressions.TargetFieldSymbol)) {
|
|
30163
|
+
return false;
|
|
30164
|
+
}
|
|
30165
|
+
for (let i = 1; i < index; i++) {
|
|
30166
|
+
if (!(children[i].get() instanceof Expressions.FieldOffset)) {
|
|
30167
|
+
return false;
|
|
30168
|
+
}
|
|
30169
|
+
}
|
|
30170
|
+
return true;
|
|
30171
|
+
}
|
|
30172
|
+
//# sourceMappingURL=_substring.js.map
|
|
30173
|
+
|
|
30174
|
+
/***/ },
|
|
30175
|
+
|
|
29847
30176
|
/***/ "../core/build/src/abap/5_syntax/expressions/attribute_chain.js"
|
|
29848
30177
|
/*!**********************************************************************!*\
|
|
29849
30178
|
!*** ../core/build/src/abap/5_syntax/expressions/attribute_chain.js ***!
|
|
@@ -29899,6 +30228,7 @@ const attribute_name_1 = __webpack_require__(/*! ./attribute_name */ "../core/bu
|
|
|
29899
30228
|
const table_expression_1 = __webpack_require__(/*! ./table_expression */ "../core/build/src/abap/5_syntax/expressions/table_expression.js");
|
|
29900
30229
|
const field_offset_1 = __webpack_require__(/*! ./field_offset */ "../core/build/src/abap/5_syntax/expressions/field_offset.js");
|
|
29901
30230
|
const field_length_1 = __webpack_require__(/*! ./field_length */ "../core/build/src/abap/5_syntax/expressions/field_length.js");
|
|
30231
|
+
const _substring_1 = __webpack_require__(/*! ./_substring */ "../core/build/src/abap/5_syntax/expressions/_substring.js");
|
|
29902
30232
|
class AttributeChain {
|
|
29903
30233
|
static runSyntax(inputContext, node, input, type) {
|
|
29904
30234
|
if (inputContext instanceof void_type_1.VoidType) {
|
|
@@ -29975,25 +30305,11 @@ class AttributeChain {
|
|
|
29975
30305
|
}
|
|
29976
30306
|
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldOffset) {
|
|
29977
30307
|
const offset = field_offset_1.FieldOffset.runSyntax(child, input);
|
|
29978
|
-
|
|
29979
|
-
if (contextType instanceof basic_1.CharacterType) {
|
|
29980
|
-
contextType = new basic_1.CharacterType(contextType.getLength() - offset);
|
|
29981
|
-
}
|
|
29982
|
-
else if (contextType instanceof basic_1.HexType) {
|
|
29983
|
-
contextType = new basic_1.HexType(contextType.getLength() - offset);
|
|
29984
|
-
}
|
|
29985
|
-
}
|
|
30308
|
+
contextType = (0, _substring_1.substringType)(contextType, offset, undefined, child, input);
|
|
29986
30309
|
}
|
|
29987
30310
|
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldLength) {
|
|
29988
30311
|
const length = field_length_1.FieldLength.runSyntax(child, input);
|
|
29989
|
-
|
|
29990
|
-
if (contextType instanceof basic_1.CharacterType) {
|
|
29991
|
-
contextType = new basic_1.CharacterType(length);
|
|
29992
|
-
}
|
|
29993
|
-
else if (contextType instanceof basic_1.HexType) {
|
|
29994
|
-
contextType = new basic_1.HexType(length);
|
|
29995
|
-
}
|
|
29996
|
-
}
|
|
30312
|
+
contextType = (0, _substring_1.substringType)(contextType, undefined, length, child, input);
|
|
29997
30313
|
}
|
|
29998
30314
|
}
|
|
29999
30315
|
return contextType;
|
|
@@ -30289,6 +30605,11 @@ class Compare {
|
|
|
30289
30605
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), initialMessage));
|
|
30290
30606
|
return;
|
|
30291
30607
|
}
|
|
30608
|
+
const predicateMessage = this.checkPredicateOperand(sources, input);
|
|
30609
|
+
if (predicateMessage !== undefined) {
|
|
30610
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), predicateMessage));
|
|
30611
|
+
return;
|
|
30612
|
+
}
|
|
30292
30613
|
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
30293
30614
|
const compareOperator = (_a = node.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
30294
30615
|
if (compareOperator === "CS"
|
|
@@ -30329,6 +30650,31 @@ class Compare {
|
|
|
30329
30650
|
if ((chain === null || chain === void 0 ? void 0 : chain.length) === 4 && chain[0] instanceof nodes_1.TokenNode && (first === "XSDBOOL" || first === "BOOLC")) {
|
|
30330
30651
|
return `Built-in function "${chain[0].getFirstToken().getStr()}" cannot be the operand of IS INITIAL`;
|
|
30331
30652
|
}
|
|
30653
|
+
const name = this.builtinCallName(node.findDirectExpression(Expressions.Source), input);
|
|
30654
|
+
const returning = (_d = (_c = _builtin_1.BuiltIn.searchBuiltin(name)) === null || _c === void 0 ? void 0 : _c.getParameters().getReturning()) === null || _d === void 0 ? void 0 : _d.getType();
|
|
30655
|
+
if (returning instanceof basic_1.StringType || returning instanceof basic_1.CharacterType) {
|
|
30656
|
+
return `Built-in function "${name}" cannot be the operand of IS INITIAL`;
|
|
30657
|
+
}
|
|
30658
|
+
return undefined;
|
|
30659
|
+
}
|
|
30660
|
+
// a predicate function, contains( ) or line_exists( ), is a relational expression and not a value,
|
|
30661
|
+
// it can stand alone as a condition or inside boolc( ) or xsdbool( ), but cannot be an operand of a comparison
|
|
30662
|
+
static checkPredicateOperand(sources, input) {
|
|
30663
|
+
if (input.scope.getOpenABAP()) {
|
|
30664
|
+
return undefined;
|
|
30665
|
+
}
|
|
30666
|
+
for (const source of sources) {
|
|
30667
|
+
const name = this.builtinCallName(source, input);
|
|
30668
|
+
if (_builtin_1.BuiltIn.isPredicate(name) === true) {
|
|
30669
|
+
return `Predicate function "${name}" cannot be the operand of a comparison`;
|
|
30670
|
+
}
|
|
30671
|
+
}
|
|
30672
|
+
return undefined;
|
|
30673
|
+
}
|
|
30674
|
+
// the name of the built-in function when the source is exactly one call of it, not hidden by a method of the same name
|
|
30675
|
+
static builtinCallName(source, input) {
|
|
30676
|
+
var _a;
|
|
30677
|
+
const chain = source === null || source === void 0 ? void 0 : source.getChildren();
|
|
30332
30678
|
if ((chain === null || chain === void 0 ? void 0 : chain.length) !== 1 || !(chain[0] instanceof nodes_1.ExpressionNode) || !(chain[0].get() instanceof Expressions.MethodCallChain)) {
|
|
30333
30679
|
return undefined;
|
|
30334
30680
|
}
|
|
@@ -30336,9 +30682,8 @@ class Compare {
|
|
|
30336
30682
|
if (calls.length !== 1 || !(calls[0] instanceof nodes_1.ExpressionNode) || !(calls[0].get() instanceof Expressions.MethodCall)) {
|
|
30337
30683
|
return undefined;
|
|
30338
30684
|
}
|
|
30339
|
-
const name = (
|
|
30340
|
-
|
|
30341
|
-
if (name === undefined || builtin === undefined) {
|
|
30685
|
+
const name = (_a = calls[0].findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
30686
|
+
if (name === undefined || _builtin_1.BuiltIn.searchBuiltin(name) === undefined) {
|
|
30342
30687
|
return undefined;
|
|
30343
30688
|
}
|
|
30344
30689
|
// a method of the same name hides the built-in function
|
|
@@ -30346,11 +30691,7 @@ class Compare {
|
|
|
30346
30691
|
if (enclosing !== undefined && new _object_oriented_1.ObjectOriented(input.scope).searchMethodName(enclosing, name).method !== undefined) {
|
|
30347
30692
|
return undefined;
|
|
30348
30693
|
}
|
|
30349
|
-
|
|
30350
|
-
if (returning instanceof basic_1.StringType || returning instanceof basic_1.CharacterType) {
|
|
30351
|
-
return `Built-in function "${name}" cannot be the operand of IS INITIAL`;
|
|
30352
|
-
}
|
|
30353
|
-
return undefined;
|
|
30694
|
+
return name;
|
|
30354
30695
|
}
|
|
30355
30696
|
}
|
|
30356
30697
|
exports.Compare = Compare;
|
|
@@ -31580,6 +31921,7 @@ const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */
|
|
|
31580
31921
|
const dereference_1 = __webpack_require__(/*! ./dereference */ "../core/build/src/abap/5_syntax/expressions/dereference.js");
|
|
31581
31922
|
const source_field_symbol_1 = __webpack_require__(/*! ./source_field_symbol */ "../core/build/src/abap/5_syntax/expressions/source_field_symbol.js");
|
|
31582
31923
|
const source_field_1 = __webpack_require__(/*! ./source_field */ "../core/build/src/abap/5_syntax/expressions/source_field.js");
|
|
31924
|
+
const _substring_1 = __webpack_require__(/*! ./_substring */ "../core/build/src/abap/5_syntax/expressions/_substring.js");
|
|
31583
31925
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
31584
31926
|
const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
|
|
31585
31927
|
class FieldChain {
|
|
@@ -31692,24 +32034,14 @@ class FieldChain {
|
|
|
31692
32034
|
}
|
|
31693
32035
|
else if (current.get() instanceof Expressions.FieldOffset && current instanceof nodes_1.ExpressionNode) {
|
|
31694
32036
|
const offset = field_offset_1.FieldOffset.runSyntax(current, input);
|
|
31695
|
-
if (
|
|
31696
|
-
|
|
31697
|
-
context = new basic_1.CharacterType(context.getLength() - offset);
|
|
31698
|
-
}
|
|
31699
|
-
else if (context instanceof basic_1.HexType) {
|
|
31700
|
-
context = new basic_1.HexType(context.getLength() - offset);
|
|
31701
|
-
}
|
|
32037
|
+
if (!(0, _substring_1.isFieldSymbolItself)(children, i)) {
|
|
32038
|
+
context = (0, _substring_1.substringType)(context, offset, undefined, current, input);
|
|
31702
32039
|
}
|
|
31703
32040
|
}
|
|
31704
32041
|
else if (current.get() instanceof Expressions.FieldLength && current instanceof nodes_1.ExpressionNode) {
|
|
31705
32042
|
const length = field_length_1.FieldLength.runSyntax(current, input);
|
|
31706
|
-
if (
|
|
31707
|
-
|
|
31708
|
-
context = new basic_1.CharacterType(length);
|
|
31709
|
-
}
|
|
31710
|
-
else if (context instanceof basic_1.HexType) {
|
|
31711
|
-
context = new basic_1.HexType(length);
|
|
31712
|
-
}
|
|
32043
|
+
if (!(0, _substring_1.isFieldSymbolItself)(children, i)) {
|
|
32044
|
+
context = (0, _substring_1.substringType)(context, undefined, length, current, input);
|
|
31713
32045
|
}
|
|
31714
32046
|
}
|
|
31715
32047
|
prev = current.concatTokens();
|
|
@@ -33143,7 +33475,12 @@ class MethodCallChain {
|
|
|
33143
33475
|
}
|
|
33144
33476
|
const param = current.findDirectExpression(Expressions.MethodCallParam);
|
|
33145
33477
|
if (param && method) {
|
|
33146
|
-
method_call_param_1.MethodCallParam.runSyntax(param, input, method);
|
|
33478
|
+
const argumentType = method_call_param_1.MethodCallParam.runSyntax(param, input, method);
|
|
33479
|
+
if (method instanceof _builtin_1.BuiltInMethod
|
|
33480
|
+
&& _builtin_1.BuiltIn.returnsArgumentType(methodName)
|
|
33481
|
+
&& this.isNumeric(argumentType)) {
|
|
33482
|
+
context = argumentType;
|
|
33483
|
+
}
|
|
33147
33484
|
}
|
|
33148
33485
|
else if (param && context instanceof basic_1.VoidType) {
|
|
33149
33486
|
method_call_param_1.MethodCallParam.runSyntax(param, input, context);
|
|
@@ -33160,6 +33497,16 @@ class MethodCallChain {
|
|
|
33160
33497
|
return context;
|
|
33161
33498
|
}
|
|
33162
33499
|
//////////////////////////////////////
|
|
33500
|
+
static isNumeric(type) {
|
|
33501
|
+
return type instanceof basic_1.IntegerType
|
|
33502
|
+
|| type instanceof basic_1.Integer8Type
|
|
33503
|
+
|| type instanceof basic_1.PackedType
|
|
33504
|
+
|| type instanceof basic_1.FloatType
|
|
33505
|
+
|| type instanceof basic_1.FloatingPointType
|
|
33506
|
+
|| type instanceof basic_1.DecFloatType
|
|
33507
|
+
|| type instanceof basic_1.DecFloat16Type
|
|
33508
|
+
|| type instanceof basic_1.DecFloat34Type;
|
|
33509
|
+
}
|
|
33163
33510
|
static findTop(first, input, targetType) {
|
|
33164
33511
|
var _a;
|
|
33165
33512
|
if (first.get() instanceof Expressions.ClassName) {
|
|
@@ -33257,6 +33604,7 @@ const constant_1 = __webpack_require__(/*! ./constant */ "../core/build/src/abap
|
|
|
33257
33604
|
const _check_offset_length_1 = __webpack_require__(/*! ./_check_offset_length */ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js");
|
|
33258
33605
|
const _check_text_symbol_1 = __webpack_require__(/*! ./_check_text_symbol */ "../core/build/src/abap/5_syntax/expressions/_check_text_symbol.js");
|
|
33259
33606
|
class MethodCallParam {
|
|
33607
|
+
/** returns the type of the unnamed argument, if any */
|
|
33260
33608
|
static runSyntax(node, input, method) {
|
|
33261
33609
|
if (!(node.get() instanceof Expressions.MethodCallParam)) {
|
|
33262
33610
|
const message = "MethodCallParam, unexpected input";
|
|
@@ -33336,6 +33684,7 @@ class MethodCallParam {
|
|
|
33336
33684
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
33337
33685
|
return;
|
|
33338
33686
|
}
|
|
33687
|
+
return sourceType;
|
|
33339
33688
|
}
|
|
33340
33689
|
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.ParameterListS) {
|
|
33341
33690
|
new method_parameters_1.MethodParameters().checkExporting(child, input, method);
|
|
@@ -33348,6 +33697,7 @@ class MethodCallParam {
|
|
|
33348
33697
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
33349
33698
|
return;
|
|
33350
33699
|
}
|
|
33700
|
+
return undefined;
|
|
33351
33701
|
}
|
|
33352
33702
|
}
|
|
33353
33703
|
exports.MethodCallParam = MethodCallParam;
|
|
@@ -36538,6 +36888,7 @@ const table_expression_1 = __webpack_require__(/*! ./table_expression */ "../cor
|
|
|
36538
36888
|
const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js");
|
|
36539
36889
|
const field_length_1 = __webpack_require__(/*! ./field_length */ "../core/build/src/abap/5_syntax/expressions/field_length.js");
|
|
36540
36890
|
const cast_1 = __webpack_require__(/*! ./cast */ "../core/build/src/abap/5_syntax/expressions/cast.js");
|
|
36891
|
+
const _substring_1 = __webpack_require__(/*! ./_substring */ "../core/build/src/abap/5_syntax/expressions/_substring.js");
|
|
36541
36892
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
36542
36893
|
const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
|
|
36543
36894
|
class Target {
|
|
@@ -36645,6 +36996,8 @@ class Target {
|
|
|
36645
36996
|
context = attribute_name_1.AttributeName.runSyntax(context, current, input, type);
|
|
36646
36997
|
}
|
|
36647
36998
|
}
|
|
36999
|
+
// the substring is checked, but the type of the whole field is returned
|
|
37000
|
+
let substring = context;
|
|
36648
37001
|
const offset = node.findDirectExpression(Expressions.FieldOffset);
|
|
36649
37002
|
if (offset) {
|
|
36650
37003
|
if (context instanceof basic_1.XStringType || context instanceof basic_1.StringType) {
|
|
@@ -36652,7 +37005,10 @@ class Target {
|
|
|
36652
37005
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
36653
37006
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
36654
37007
|
}
|
|
36655
|
-
field_offset_1.FieldOffset.runSyntax(offset, input);
|
|
37008
|
+
const value = field_offset_1.FieldOffset.runSyntax(offset, input);
|
|
37009
|
+
if (!(0, _substring_1.isFieldSymbolItself)(children, children.indexOf(offset))) {
|
|
37010
|
+
substring = (0, _substring_1.substringType)(substring, value, undefined, offset, input);
|
|
37011
|
+
}
|
|
36656
37012
|
}
|
|
36657
37013
|
const length = node.findDirectExpression(Expressions.FieldLength);
|
|
36658
37014
|
if (length) {
|
|
@@ -36661,7 +37017,13 @@ class Target {
|
|
|
36661
37017
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
36662
37018
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
36663
37019
|
}
|
|
36664
|
-
field_length_1.FieldLength.runSyntax(length, input);
|
|
37020
|
+
const value = field_length_1.FieldLength.runSyntax(length, input);
|
|
37021
|
+
if (!(0, _substring_1.isFieldSymbolItself)(children, children.indexOf(length))) {
|
|
37022
|
+
substring = (0, _substring_1.substringType)(substring, undefined, value, length, input);
|
|
37023
|
+
}
|
|
37024
|
+
}
|
|
37025
|
+
if (substring instanceof basic_1.VoidType && !(context instanceof basic_1.VoidType)) {
|
|
37026
|
+
return substring;
|
|
36665
37027
|
}
|
|
36666
37028
|
return context;
|
|
36667
37029
|
}
|
|
@@ -37749,6 +38111,12 @@ class Append {
|
|
|
37749
38111
|
if (target) {
|
|
37750
38112
|
targetType = target_1.Target.runSyntax(target, input);
|
|
37751
38113
|
}
|
|
38114
|
+
// a hashed table has no index, APPEND adds at the end
|
|
38115
|
+
if (targetType instanceof basic_1.TableType && targetType.getAccessType() === basic_1.TableAccessType.hashed) {
|
|
38116
|
+
const message = "Implicit or explicit index operation on hashed table is not possible";
|
|
38117
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
38118
|
+
return;
|
|
38119
|
+
}
|
|
37752
38120
|
const fsTarget = node.findExpressionAfterToken("ASSIGNING");
|
|
37753
38121
|
if (fsTarget && fsTarget.get() instanceof Expressions.FSTarget) {
|
|
37754
38122
|
if (!(targetType instanceof basic_1.TableType) && !(targetType instanceof basic_1.VoidType) && !(targetType instanceof basic_1.UnknownType)) {
|
|
@@ -45184,6 +45552,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
45184
45552
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
45185
45553
|
exports.ReadTable = void 0;
|
|
45186
45554
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
45555
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
45187
45556
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
45188
45557
|
const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
|
|
45189
45558
|
const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "../core/build/src/abap/5_syntax/expressions/inline_data.js");
|
|
@@ -45192,6 +45561,9 @@ const fstarget_1 = __webpack_require__(/*! ../expressions/fstarget */ "../core/b
|
|
|
45192
45561
|
const component_compare_simple_1 = __webpack_require__(/*! ../expressions/component_compare_simple */ "../core/build/src/abap/5_syntax/expressions/component_compare_simple.js");
|
|
45193
45562
|
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
|
|
45194
45563
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
45564
|
+
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
|
|
45565
|
+
const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
|
|
45566
|
+
const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
|
|
45195
45567
|
class ReadTable {
|
|
45196
45568
|
runSyntax(node, input) {
|
|
45197
45569
|
const concat = node.concatTokens().toUpperCase();
|
|
@@ -45218,6 +45590,11 @@ class ReadTable {
|
|
|
45218
45590
|
const components = node.findDirectExpression(Expressions.ComponentCompareSimple);
|
|
45219
45591
|
if (components !== undefined) {
|
|
45220
45592
|
component_compare_simple_1.ComponentCompareSimple.runSyntax(components, input, rowType);
|
|
45593
|
+
const keyMessage = this.checkKeyOperands(components, input);
|
|
45594
|
+
if (keyMessage !== undefined) {
|
|
45595
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), keyMessage));
|
|
45596
|
+
return;
|
|
45597
|
+
}
|
|
45221
45598
|
}
|
|
45222
45599
|
const indexSource = node.findExpressionAfterToken("INDEX");
|
|
45223
45600
|
if (indexSource) {
|
|
@@ -45313,6 +45690,36 @@ class ReadTable {
|
|
|
45313
45690
|
}
|
|
45314
45691
|
}
|
|
45315
45692
|
}
|
|
45693
|
+
// before 7.40 a WITH [TABLE] KEY operand is not an expression position, a built-in function from 7.02 on
|
|
45694
|
+
// is read as a functional method call there, "method TO_UPPER is unknown" on a system, while
|
|
45695
|
+
// functional methods and the older built-in functions like lines( ) are accepted
|
|
45696
|
+
checkKeyOperands(node, input) {
|
|
45697
|
+
var _a, _b;
|
|
45698
|
+
if (input.scope.getOpenABAP() || (0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v740sp02)) {
|
|
45699
|
+
return undefined;
|
|
45700
|
+
}
|
|
45701
|
+
for (const operand of node.findDirectExpressionsMulti([Expressions.Source, Expressions.SimpleSource4])) {
|
|
45702
|
+
const chain = operand.getChildren();
|
|
45703
|
+
if (chain.length !== 1 || !(chain[0] instanceof nodes_1.ExpressionNode) || !(chain[0].get() instanceof Expressions.MethodCallChain)) {
|
|
45704
|
+
continue;
|
|
45705
|
+
}
|
|
45706
|
+
const calls = chain[0].getChildren();
|
|
45707
|
+
if (calls.length !== 1 || !(calls[0] instanceof nodes_1.ExpressionNode) || !(calls[0].get() instanceof Expressions.MethodCall)) {
|
|
45708
|
+
continue;
|
|
45709
|
+
}
|
|
45710
|
+
const name = (_a = calls[0].findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
45711
|
+
if (name === undefined || ((_b = _builtin_1.BuiltIn.methods[name.toUpperCase()]) === null || _b === void 0 ? void 0 : _b.release) === undefined) {
|
|
45712
|
+
continue;
|
|
45713
|
+
}
|
|
45714
|
+
// a method of the same name hides the built-in function
|
|
45715
|
+
const enclosing = input.scope.findClassDefinition(input.scope.getEnclosingClassName());
|
|
45716
|
+
if (enclosing !== undefined && new _object_oriented_1.ObjectOriented(input.scope).searchMethodName(enclosing, name).method !== undefined) {
|
|
45717
|
+
continue;
|
|
45718
|
+
}
|
|
45719
|
+
return `Built-in function "${name}" cannot be a READ TABLE key operand before 7.40`;
|
|
45720
|
+
}
|
|
45721
|
+
return undefined;
|
|
45722
|
+
}
|
|
45316
45723
|
}
|
|
45317
45724
|
exports.ReadTable = ReadTable;
|
|
45318
45725
|
//# sourceMappingURL=read_table.js.map
|
|
@@ -48200,6 +48607,121 @@ exports.ClassData = ClassData;
|
|
|
48200
48607
|
|
|
48201
48608
|
/***/ },
|
|
48202
48609
|
|
|
48610
|
+
/***/ "../core/build/src/abap/5_syntax/structures/cleanup.js"
|
|
48611
|
+
/*!*************************************************************!*\
|
|
48612
|
+
!*** ../core/build/src/abap/5_syntax/structures/cleanup.js ***!
|
|
48613
|
+
\*************************************************************/
|
|
48614
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
48615
|
+
|
|
48616
|
+
"use strict";
|
|
48617
|
+
|
|
48618
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
48619
|
+
if (k2 === undefined) k2 = k;
|
|
48620
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
48621
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
48622
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
48623
|
+
}
|
|
48624
|
+
Object.defineProperty(o, k2, desc);
|
|
48625
|
+
}) : (function(o, m, k, k2) {
|
|
48626
|
+
if (k2 === undefined) k2 = k;
|
|
48627
|
+
o[k2] = m[k];
|
|
48628
|
+
}));
|
|
48629
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
48630
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
48631
|
+
}) : function(o, v) {
|
|
48632
|
+
o["default"] = v;
|
|
48633
|
+
});
|
|
48634
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
48635
|
+
var ownKeys = function(o) {
|
|
48636
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
48637
|
+
var ar = [];
|
|
48638
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
48639
|
+
return ar;
|
|
48640
|
+
};
|
|
48641
|
+
return ownKeys(o);
|
|
48642
|
+
};
|
|
48643
|
+
return function (mod) {
|
|
48644
|
+
if (mod && mod.__esModule) return mod;
|
|
48645
|
+
var result = {};
|
|
48646
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
48647
|
+
__setModuleDefault(result, mod);
|
|
48648
|
+
return result;
|
|
48649
|
+
};
|
|
48650
|
+
})();
|
|
48651
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
48652
|
+
exports.Cleanup = void 0;
|
|
48653
|
+
const Statements = __importStar(__webpack_require__(/*! ../../2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
48654
|
+
const Structures = __importStar(__webpack_require__(/*! ../../3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
|
|
48655
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
48656
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
48657
|
+
const LOOPS = [
|
|
48658
|
+
Structures.Loop,
|
|
48659
|
+
Structures.LoopAtScreen,
|
|
48660
|
+
Structures.LoopExtract,
|
|
48661
|
+
Structures.Do,
|
|
48662
|
+
Structures.While,
|
|
48663
|
+
Structures.Select,
|
|
48664
|
+
Structures.With,
|
|
48665
|
+
Structures.Provide,
|
|
48666
|
+
];
|
|
48667
|
+
// a CLEANUP block cannot contain statements that statically leave it: RETURN, and EXIT, CONTINUE or CHECK
|
|
48668
|
+
// that do not belong to a loop inside the block, these end a loop outside the TRY or the processing block
|
|
48669
|
+
class Cleanup {
|
|
48670
|
+
static runSyntax(node, input) {
|
|
48671
|
+
if (input.scope.getOpenABAP()) {
|
|
48672
|
+
return;
|
|
48673
|
+
}
|
|
48674
|
+
const body = node.findDirectStructure(Structures.Body);
|
|
48675
|
+
if (body !== undefined) {
|
|
48676
|
+
this.walk(body, false, input);
|
|
48677
|
+
}
|
|
48678
|
+
}
|
|
48679
|
+
static walk(node, inLoop, input) {
|
|
48680
|
+
for (const child of node.getChildren()) {
|
|
48681
|
+
if (child instanceof nodes_1.StructureNode) {
|
|
48682
|
+
const stru = child.get();
|
|
48683
|
+
// a nested CLEANUP block is checked on its own, macro definitions and test injections do not run here
|
|
48684
|
+
if (stru instanceof Structures.Cleanup
|
|
48685
|
+
|| stru instanceof Structures.Define
|
|
48686
|
+
|| stru instanceof Structures.TestInjection) {
|
|
48687
|
+
continue;
|
|
48688
|
+
}
|
|
48689
|
+
this.walk(child, inLoop || LOOPS.some(l => stru instanceof l), input);
|
|
48690
|
+
}
|
|
48691
|
+
else if (child instanceof nodes_1.StatementNode) {
|
|
48692
|
+
const name = this.leavingStatement(child, inLoop);
|
|
48693
|
+
if (name !== undefined) {
|
|
48694
|
+
const message = `${name} cannot leave a CLEANUP block`;
|
|
48695
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
|
|
48696
|
+
}
|
|
48697
|
+
}
|
|
48698
|
+
}
|
|
48699
|
+
}
|
|
48700
|
+
static leavingStatement(node, inLoop) {
|
|
48701
|
+
const s = node.get();
|
|
48702
|
+
if (s instanceof Statements.Return) {
|
|
48703
|
+
return "RETURN";
|
|
48704
|
+
}
|
|
48705
|
+
else if (inLoop === true) {
|
|
48706
|
+
return undefined;
|
|
48707
|
+
}
|
|
48708
|
+
else if (s instanceof Statements.Exit && node.findDirectTokenByText("FROM") === undefined) {
|
|
48709
|
+
return "EXIT";
|
|
48710
|
+
}
|
|
48711
|
+
else if (s instanceof Statements.Continue) {
|
|
48712
|
+
return "CONTINUE";
|
|
48713
|
+
}
|
|
48714
|
+
else if (s instanceof Statements.Check) {
|
|
48715
|
+
return "CHECK";
|
|
48716
|
+
}
|
|
48717
|
+
return undefined;
|
|
48718
|
+
}
|
|
48719
|
+
}
|
|
48720
|
+
exports.Cleanup = Cleanup;
|
|
48721
|
+
//# sourceMappingURL=cleanup.js.map
|
|
48722
|
+
|
|
48723
|
+
/***/ },
|
|
48724
|
+
|
|
48203
48725
|
/***/ "../core/build/src/abap/5_syntax/structures/constants.js"
|
|
48204
48726
|
/*!***************************************************************!*\
|
|
48205
48727
|
!*** ../core/build/src/abap/5_syntax/structures/constants.js ***!
|
|
@@ -49003,6 +49525,7 @@ const type_mesh_1 = __webpack_require__(/*! ./structures/type_mesh */ "../core/b
|
|
|
49003
49525
|
const types_1 = __webpack_require__(/*! ./structures/types */ "../core/build/src/abap/5_syntax/structures/types.js");
|
|
49004
49526
|
const statics_1 = __webpack_require__(/*! ./structures/statics */ "../core/build/src/abap/5_syntax/structures/statics.js");
|
|
49005
49527
|
const constants_1 = __webpack_require__(/*! ./structures/constants */ "../core/build/src/abap/5_syntax/structures/constants.js");
|
|
49528
|
+
const cleanup_1 = __webpack_require__(/*! ./structures/cleanup */ "../core/build/src/abap/5_syntax/structures/cleanup.js");
|
|
49006
49529
|
const class_definition_1 = __webpack_require__(/*! ../types/class_definition */ "../core/build/src/abap/types/class_definition.js");
|
|
49007
49530
|
const interface_definition_1 = __webpack_require__(/*! ../types/interface_definition */ "../core/build/src/abap/types/interface_definition.js");
|
|
49008
49531
|
const delete_memory_1 = __webpack_require__(/*! ./statements/delete_memory */ "../core/build/src/abap/5_syntax/statements/delete_memory.js");
|
|
@@ -49144,6 +49667,7 @@ const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/buil
|
|
|
49144
49667
|
const assert_error_1 = __webpack_require__(/*! ./assert_error */ "../core/build/src/abap/5_syntax/assert_error.js");
|
|
49145
49668
|
const field_group_1 = __webpack_require__(/*! ./statements/field_group */ "../core/build/src/abap/5_syntax/statements/field_group.js");
|
|
49146
49669
|
const stuff_1 = __webpack_require__(/*! ../../stuff */ "../core/build/src/stuff.js");
|
|
49670
|
+
const _loop_table_change_1 = __webpack_require__(/*! ./_loop_table_change */ "../core/build/src/abap/5_syntax/_loop_table_change.js");
|
|
49147
49671
|
// -----------------------------------
|
|
49148
49672
|
const map = {};
|
|
49149
49673
|
function addToMap(handler) {
|
|
@@ -49305,6 +49829,7 @@ class SyntaxLogic {
|
|
|
49305
49829
|
};
|
|
49306
49830
|
this.issues = [];
|
|
49307
49831
|
this.deferred = [];
|
|
49832
|
+
this.loopTables = new _loop_table_change_1.LoopTableChange();
|
|
49308
49833
|
this.reg.getDDICReferences().clear(this.object);
|
|
49309
49834
|
this.reg.getMSAGReferences().clear(this.object);
|
|
49310
49835
|
if (this.object instanceof objects_1.Program && this.object.isInclude()) {
|
|
@@ -49370,6 +49895,9 @@ class SyntaxLogic {
|
|
|
49370
49895
|
this.issues.push(issue);
|
|
49371
49896
|
}
|
|
49372
49897
|
traverse(node) {
|
|
49898
|
+
const loop = node instanceof nodes_1.StructureNode
|
|
49899
|
+
&& node.get() instanceof Structures.Loop
|
|
49900
|
+
&& this.loopTables.push(node, this.scope);
|
|
49373
49901
|
for (const child of node.getChildren()) {
|
|
49374
49902
|
const isStructure = child instanceof nodes_1.StructureNode;
|
|
49375
49903
|
const isStatement = child instanceof nodes_1.StatementNode;
|
|
@@ -49402,6 +49930,9 @@ class SyntaxLogic {
|
|
|
49402
49930
|
this.traverse(child);
|
|
49403
49931
|
}
|
|
49404
49932
|
}
|
|
49933
|
+
if (loop === true) {
|
|
49934
|
+
this.loopTables.pop();
|
|
49935
|
+
}
|
|
49405
49936
|
}
|
|
49406
49937
|
/**
|
|
49407
49938
|
* if this returns true, then the traversal should continue with next child
|
|
@@ -49458,6 +49989,9 @@ class SyntaxLogic {
|
|
|
49458
49989
|
// todo: skipped for now
|
|
49459
49990
|
return true;
|
|
49460
49991
|
}
|
|
49992
|
+
else if (stru instanceof Structures.Cleanup) {
|
|
49993
|
+
cleanup_1.Cleanup.runSyntax(node, input);
|
|
49994
|
+
}
|
|
49461
49995
|
return false;
|
|
49462
49996
|
}
|
|
49463
49997
|
updateScopeStatement(node) {
|
|
@@ -49487,6 +50021,7 @@ class SyntaxLogic {
|
|
|
49487
50021
|
this.scope.addIdentifier(new data_2.Data().runSyntax(node, input));
|
|
49488
50022
|
return;
|
|
49489
50023
|
}
|
|
50024
|
+
this.loopTables.check(node, input);
|
|
49490
50025
|
const name = s.constructor.name;
|
|
49491
50026
|
if (map[name]) {
|
|
49492
50027
|
map[name].runSyntax(node, input);
|
|
@@ -57248,7 +57783,7 @@ class DDIC {
|
|
|
57248
57783
|
lookupDomain(name, dataElement, description) {
|
|
57249
57784
|
const found = this.reg.getObject("DOMA", name);
|
|
57250
57785
|
if (found) {
|
|
57251
|
-
return { type: found.
|
|
57786
|
+
return { type: found.parseDomainType(this.reg, dataElement, description), object: found };
|
|
57252
57787
|
}
|
|
57253
57788
|
else if (this.reg.inErrorNamespace(name)) {
|
|
57254
57789
|
return { type: new Types.UnknownType(name + ", lookupDomain"), object: undefined };
|
|
@@ -64220,7 +64755,10 @@ class Domain extends _abstract_object_1.AbstractObject {
|
|
|
64220
64755
|
this.parsedXML = undefined;
|
|
64221
64756
|
super.setDirty();
|
|
64222
64757
|
}
|
|
64223
|
-
parseType(reg
|
|
64758
|
+
parseType(reg) {
|
|
64759
|
+
return this.parseDomainType(reg);
|
|
64760
|
+
}
|
|
64761
|
+
parseDomainType(reg, dataElement, description) {
|
|
64224
64762
|
// dont cache the DOMA parsed type, they are cached on DTEL level
|
|
64225
64763
|
// also note that the type carries the name of the DTEL
|
|
64226
64764
|
if (this.parsedXML === undefined) {
|
|
@@ -70841,7 +71379,7 @@ class Registry {
|
|
|
70841
71379
|
}
|
|
70842
71380
|
static abaplintVersion() {
|
|
70843
71381
|
// magic, see build script "version.js"
|
|
70844
|
-
return "2.120.
|
|
71382
|
+
return "2.120.76";
|
|
70845
71383
|
}
|
|
70846
71384
|
getDDICReferences() {
|
|
70847
71385
|
return this.ddicReferences;
|
|
@@ -71503,10 +72041,10 @@ exports.Abapdoc = Abapdoc;
|
|
|
71503
72041
|
|
|
71504
72042
|
/***/ },
|
|
71505
72043
|
|
|
71506
|
-
/***/ "../core/build/src/rules/
|
|
71507
|
-
|
|
71508
|
-
!*** ../core/build/src/rules/
|
|
71509
|
-
|
|
72044
|
+
/***/ "../core/build/src/rules/abapdoc_html_tag.js"
|
|
72045
|
+
/*!***************************************************!*\
|
|
72046
|
+
!*** ../core/build/src/rules/abapdoc_html_tag.js ***!
|
|
72047
|
+
\***************************************************/
|
|
71510
72048
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
71511
72049
|
|
|
71512
72050
|
"use strict";
|
|
@@ -71545,49 +72083,45 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
71545
72083
|
};
|
|
71546
72084
|
})();
|
|
71547
72085
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71548
|
-
exports.
|
|
72086
|
+
exports.AbapdocHtmlTag = exports.AbapdocHtmlTagConf = void 0;
|
|
72087
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
71549
72088
|
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
71550
72089
|
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
71551
72090
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
71552
|
-
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
71553
|
-
const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
|
|
71554
72091
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
71555
|
-
|
|
72092
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
72093
|
+
const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
|
|
72094
|
+
class AbapdocHtmlTagConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
71556
72095
|
}
|
|
71557
|
-
exports.
|
|
71558
|
-
|
|
72096
|
+
exports.AbapdocHtmlTagConf = AbapdocHtmlTagConf;
|
|
72097
|
+
const ALLOWED = new Set(["p", "em", "strong", "ul", "ol", "li", "br", "h1", "h2", "h3"]);
|
|
72098
|
+
class AbapdocHtmlTag extends _abap_rule_1.ABAPRule {
|
|
71559
72099
|
constructor() {
|
|
71560
72100
|
super(...arguments);
|
|
71561
|
-
this.conf = new
|
|
72101
|
+
this.conf = new AbapdocHtmlTagConf();
|
|
71562
72102
|
}
|
|
71563
72103
|
getMetadata() {
|
|
71564
72104
|
return {
|
|
71565
|
-
key: "
|
|
71566
|
-
title: "
|
|
71567
|
-
shortDescription: `
|
|
71568
|
-
|
|
71569
|
-
|
|
71570
|
-
PUBLIC SECTION.
|
|
71571
|
-
PROTECTED SECTION.
|
|
71572
|
-
PRIVATE SECTION.
|
|
71573
|
-
METHODS test FOR TESTING RAISING cx_static_check.
|
|
71574
|
-
ENDCLASS.
|
|
72105
|
+
key: "abapdoc_html_tag",
|
|
72106
|
+
title: "Unsupported HTML tag in ABAP Doc",
|
|
72107
|
+
shortDescription: `Reports tag-like tokens in ABAP Doc which are not ABAP Doc HTML tags.`,
|
|
72108
|
+
extendedInformation: `ABAP Doc is parsed as HTML, a field symbol or a placeholder written as <name> is an
|
|
72109
|
+
unsupported and unclosed tag, the system warns and the rendered documentation drops the word.
|
|
71575
72110
|
|
|
71576
|
-
|
|
71577
|
-
METHOD test.
|
|
71578
|
-
ENDMETHOD.
|
|
71579
|
-
ENDCLASS.`,
|
|
71580
|
-
goodExample: `CLASS ltcl_test2 DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
71581
|
-
PUBLIC SECTION.
|
|
71582
|
-
PROTECTED SECTION.
|
|
71583
|
-
PRIVATE SECTION.
|
|
71584
|
-
METHODS test FOR TESTING RAISING cx_static_check.
|
|
71585
|
-
ENDCLASS.
|
|
72111
|
+
Supported tags are p, em, strong, ul, ol, li, br, h1, h2 and h3, also as closing tags and with attributes.
|
|
71586
72112
|
|
|
71587
|
-
|
|
71588
|
-
|
|
71589
|
-
|
|
71590
|
-
|
|
72113
|
+
Write <name> to show the angle brackets. A "<" which is not followed by a letter, like "a < b", is not reported.
|
|
72114
|
+
|
|
72115
|
+
Only checks ABAP Doc inside class definitions and interfaces.`,
|
|
72116
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
72117
|
+
badExample: `INTERFACE zif_foo PUBLIC.
|
|
72118
|
+
"! Returns the <name> of the selected row
|
|
72119
|
+
METHODS name RETURNING VALUE(result) TYPE string.
|
|
72120
|
+
ENDINTERFACE.`,
|
|
72121
|
+
goodExample: `INTERFACE zif_foo PUBLIC.
|
|
72122
|
+
"! Returns the <name> of the selected row
|
|
72123
|
+
METHODS name RETURNING VALUE(result) TYPE string.
|
|
72124
|
+
ENDINTERFACE.`,
|
|
71591
72125
|
};
|
|
71592
72126
|
}
|
|
71593
72127
|
getConfig() {
|
|
@@ -71598,120 +72132,543 @@ ENDCLASS.`,
|
|
|
71598
72132
|
}
|
|
71599
72133
|
runParsed(file) {
|
|
71600
72134
|
const issues = [];
|
|
71601
|
-
|
|
71602
|
-
|
|
71603
|
-
|
|
71604
|
-
|
|
71605
|
-
|
|
71606
|
-
const cdef = classStructure.findFirstStatement(Statements.ClassDefinition);
|
|
71607
|
-
if (cdef === undefined) {
|
|
72135
|
+
let definition = false;
|
|
72136
|
+
for (const statement of file.getStatements()) {
|
|
72137
|
+
const type = statement.get();
|
|
72138
|
+
if (type instanceof Statements.ClassDefinition || type instanceof Statements.Interface) {
|
|
72139
|
+
definition = true;
|
|
71608
72140
|
continue;
|
|
71609
72141
|
}
|
|
71610
|
-
|
|
71611
|
-
|
|
72142
|
+
else if (type instanceof Statements.EndClass || type instanceof Statements.EndInterface) {
|
|
72143
|
+
definition = false;
|
|
71612
72144
|
continue;
|
|
71613
72145
|
}
|
|
71614
|
-
|
|
71615
|
-
const hasRiskLevel = cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" RISK LEVEL ");
|
|
71616
|
-
if (hasDuration === true && hasRiskLevel === true) {
|
|
72146
|
+
else if (definition === false || !(type instanceof _statement_1.Comment)) {
|
|
71617
72147
|
continue;
|
|
71618
72148
|
}
|
|
71619
|
-
|
|
71620
|
-
|
|
71621
|
-
|
|
71622
|
-
if (concat.includes(" FOR TESTING")) {
|
|
71623
|
-
hasTestMethod = true;
|
|
71624
|
-
}
|
|
71625
|
-
}
|
|
71626
|
-
if (hasTestMethod === false) {
|
|
72149
|
+
const token = statement.getFirstToken();
|
|
72150
|
+
const str = token.getStr();
|
|
72151
|
+
if (str.startsWith(`"!`) === false) {
|
|
71627
72152
|
continue;
|
|
71628
72153
|
}
|
|
71629
|
-
|
|
71630
|
-
|
|
71631
|
-
|
|
71632
|
-
|
|
71633
|
-
|
|
72154
|
+
const regex = /<\/?([a-zA-Z][\w-]*)(\s[^<>]*)?\/?>/g;
|
|
72155
|
+
let match;
|
|
72156
|
+
while ((match = regex.exec(str)) !== null) {
|
|
72157
|
+
const name = match[1];
|
|
72158
|
+
if (ALLOWED.has(name.toLowerCase())) {
|
|
72159
|
+
continue;
|
|
72160
|
+
}
|
|
72161
|
+
const row = token.getStart().getRow();
|
|
72162
|
+
const col = token.getStart().getCol() + match.index;
|
|
72163
|
+
const start = new position_1.Position(row, col);
|
|
72164
|
+
const end = new position_1.Position(row, col + match[0].length);
|
|
72165
|
+
const message = `HTML tag <${name}> is not supported in ABAP Doc, write <${name}>`;
|
|
72166
|
+
issues.push(issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity));
|
|
71634
72167
|
}
|
|
71635
72168
|
}
|
|
71636
72169
|
return issues;
|
|
71637
72170
|
}
|
|
71638
72171
|
}
|
|
71639
|
-
exports.
|
|
71640
|
-
//# sourceMappingURL=
|
|
71641
|
-
|
|
71642
|
-
/***/ },
|
|
71643
|
-
|
|
71644
|
-
/***/ "../core/build/src/rules/aff_and_xml.js"
|
|
71645
|
-
/*!**********************************************!*\
|
|
71646
|
-
!*** ../core/build/src/rules/aff_and_xml.js ***!
|
|
71647
|
-
\**********************************************/
|
|
71648
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
71649
|
-
|
|
71650
|
-
"use strict";
|
|
71651
|
-
|
|
71652
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71653
|
-
exports.AFFAndXML = exports.AFFAndXMLConf = void 0;
|
|
71654
|
-
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
71655
|
-
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
71656
|
-
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
71657
|
-
class AFFAndXMLConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
71658
|
-
}
|
|
71659
|
-
exports.AFFAndXMLConf = AFFAndXMLConf;
|
|
71660
|
-
class AFFAndXML {
|
|
71661
|
-
constructor() {
|
|
71662
|
-
this.conf = new AFFAndXMLConf();
|
|
71663
|
-
}
|
|
71664
|
-
getMetadata() {
|
|
71665
|
-
return {
|
|
71666
|
-
key: "aff_and_xml",
|
|
71667
|
-
title: "AFF and XML",
|
|
71668
|
-
shortDescription: `Checks for objects that have both AFF (.json) and XML (.xml) files`,
|
|
71669
|
-
extendedInformation: `If an object has both an ABAP file format JSON file and an XML file, the XML file should be removed`,
|
|
71670
|
-
tags: [_irule_1.RuleTag.Syntax],
|
|
71671
|
-
};
|
|
71672
|
-
}
|
|
71673
|
-
getConfig() {
|
|
71674
|
-
return this.conf;
|
|
71675
|
-
}
|
|
71676
|
-
setConfig(conf) {
|
|
71677
|
-
this.conf = conf;
|
|
71678
|
-
}
|
|
71679
|
-
initialize(_reg) {
|
|
71680
|
-
return this;
|
|
71681
|
-
}
|
|
71682
|
-
run(obj) {
|
|
71683
|
-
const files = obj.getFiles();
|
|
71684
|
-
let hasJSON = false;
|
|
71685
|
-
let hasXML = false;
|
|
71686
|
-
const type = obj.getType().toLowerCase();
|
|
71687
|
-
for (const file of files) {
|
|
71688
|
-
const filename = file.getFilename().toLowerCase();
|
|
71689
|
-
if (filename.endsWith("." + type + ".json")) {
|
|
71690
|
-
hasJSON = true;
|
|
71691
|
-
}
|
|
71692
|
-
else if (filename.endsWith("." + type + ".xml")) {
|
|
71693
|
-
hasXML = true;
|
|
71694
|
-
}
|
|
71695
|
-
}
|
|
71696
|
-
if (hasJSON && hasXML) {
|
|
71697
|
-
const xmlFile = obj.getXMLFile();
|
|
71698
|
-
if (xmlFile) {
|
|
71699
|
-
const message = "Object has both AFF JSON and XML files, remove the XML";
|
|
71700
|
-
return [issue_1.Issue.atRow(xmlFile, 1, message, this.getMetadata().key, this.conf.severity)];
|
|
71701
|
-
}
|
|
71702
|
-
}
|
|
71703
|
-
return [];
|
|
71704
|
-
}
|
|
71705
|
-
}
|
|
71706
|
-
exports.AFFAndXML = AFFAndXML;
|
|
71707
|
-
//# sourceMappingURL=aff_and_xml.js.map
|
|
72172
|
+
exports.AbapdocHtmlTag = AbapdocHtmlTag;
|
|
72173
|
+
//# sourceMappingURL=abapdoc_html_tag.js.map
|
|
71708
72174
|
|
|
71709
72175
|
/***/ },
|
|
71710
72176
|
|
|
71711
|
-
/***/ "../core/build/src/rules/
|
|
71712
|
-
|
|
71713
|
-
!*** ../core/build/src/rules/
|
|
71714
|
-
|
|
72177
|
+
/***/ "../core/build/src/rules/abapdoc_leading_at.js"
|
|
72178
|
+
/*!*****************************************************!*\
|
|
72179
|
+
!*** ../core/build/src/rules/abapdoc_leading_at.js ***!
|
|
72180
|
+
\*****************************************************/
|
|
72181
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
72182
|
+
|
|
72183
|
+
"use strict";
|
|
72184
|
+
|
|
72185
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
72186
|
+
if (k2 === undefined) k2 = k;
|
|
72187
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
72188
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
72189
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
72190
|
+
}
|
|
72191
|
+
Object.defineProperty(o, k2, desc);
|
|
72192
|
+
}) : (function(o, m, k, k2) {
|
|
72193
|
+
if (k2 === undefined) k2 = k;
|
|
72194
|
+
o[k2] = m[k];
|
|
72195
|
+
}));
|
|
72196
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
72197
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
72198
|
+
}) : function(o, v) {
|
|
72199
|
+
o["default"] = v;
|
|
72200
|
+
});
|
|
72201
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
72202
|
+
var ownKeys = function(o) {
|
|
72203
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
72204
|
+
var ar = [];
|
|
72205
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
72206
|
+
return ar;
|
|
72207
|
+
};
|
|
72208
|
+
return ownKeys(o);
|
|
72209
|
+
};
|
|
72210
|
+
return function (mod) {
|
|
72211
|
+
if (mod && mod.__esModule) return mod;
|
|
72212
|
+
var result = {};
|
|
72213
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
72214
|
+
__setModuleDefault(result, mod);
|
|
72215
|
+
return result;
|
|
72216
|
+
};
|
|
72217
|
+
})();
|
|
72218
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
72219
|
+
exports.AbapdocLeadingAt = exports.AbapdocLeadingAtConf = void 0;
|
|
72220
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
72221
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
72222
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
72223
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
72224
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
72225
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
72226
|
+
class AbapdocLeadingAtConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
72227
|
+
}
|
|
72228
|
+
exports.AbapdocLeadingAtConf = AbapdocLeadingAtConf;
|
|
72229
|
+
class AbapdocLeadingAt extends _abap_rule_1.ABAPRule {
|
|
72230
|
+
constructor() {
|
|
72231
|
+
super(...arguments);
|
|
72232
|
+
this.conf = new AbapdocLeadingAtConf();
|
|
72233
|
+
}
|
|
72234
|
+
getMetadata() {
|
|
72235
|
+
return {
|
|
72236
|
+
key: "abapdoc_leading_at",
|
|
72237
|
+
title: "ABAP Doc line starting with @",
|
|
72238
|
+
shortDescription: `Reports ABAP Doc lines starting with "@" which is not followed by a command.`,
|
|
72239
|
+
extendedInformation: `In ABAP Doc, "@" at the start of a line introduces a command, the commands are
|
|
72240
|
+
@parameter, @raising and @exception. Any other text after a leading "@", like a CDS annotation,
|
|
72241
|
+
gives the syntax warning 'A command was expected after ABAP Doc symbol "@"'.
|
|
72242
|
+
|
|
72243
|
+
An "@" in the middle of a line is plain text and not reported.
|
|
72244
|
+
|
|
72245
|
+
Only checks ABAP Doc inside class definitions and interfaces.`,
|
|
72246
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
72247
|
+
badExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
72248
|
+
PUBLIC SECTION.
|
|
72249
|
+
"! the first of
|
|
72250
|
+
"! @UI.presentationVariant sortOrder
|
|
72251
|
+
DATA mv_sort_field TYPE string.
|
|
72252
|
+
ENDCLASS.`,
|
|
72253
|
+
goodExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
72254
|
+
PUBLIC SECTION.
|
|
72255
|
+
"! the first of @UI.presentationVariant
|
|
72256
|
+
"! sortOrder
|
|
72257
|
+
DATA mv_sort_field TYPE string.
|
|
72258
|
+
ENDCLASS.`,
|
|
72259
|
+
};
|
|
72260
|
+
}
|
|
72261
|
+
getConfig() {
|
|
72262
|
+
return this.conf;
|
|
72263
|
+
}
|
|
72264
|
+
setConfig(conf) {
|
|
72265
|
+
this.conf = conf;
|
|
72266
|
+
}
|
|
72267
|
+
runParsed(file) {
|
|
72268
|
+
const issues = [];
|
|
72269
|
+
let definition = false;
|
|
72270
|
+
for (const statement of file.getStatements()) {
|
|
72271
|
+
const type = statement.get();
|
|
72272
|
+
if (type instanceof Statements.ClassDefinition || type instanceof Statements.Interface) {
|
|
72273
|
+
definition = true;
|
|
72274
|
+
continue;
|
|
72275
|
+
}
|
|
72276
|
+
else if (type instanceof Statements.EndClass || type instanceof Statements.EndInterface) {
|
|
72277
|
+
definition = false;
|
|
72278
|
+
continue;
|
|
72279
|
+
}
|
|
72280
|
+
else if (definition === false || !(type instanceof _statement_1.Comment)) {
|
|
72281
|
+
continue;
|
|
72282
|
+
}
|
|
72283
|
+
const token = statement.getFirstToken();
|
|
72284
|
+
const str = token.getStr();
|
|
72285
|
+
if (str.startsWith(`"!`) === false) {
|
|
72286
|
+
continue;
|
|
72287
|
+
}
|
|
72288
|
+
const text = str.substring(2).trimStart();
|
|
72289
|
+
if (text.startsWith("@") === false
|
|
72290
|
+
|| text.match(/^@(parameter|raising|exception)(\s|$)/i) !== null) {
|
|
72291
|
+
continue;
|
|
72292
|
+
}
|
|
72293
|
+
const message = `A command was expected after ABAP Doc symbol "@", move the "@" away from the start of the line`;
|
|
72294
|
+
issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
|
|
72295
|
+
}
|
|
72296
|
+
return issues;
|
|
72297
|
+
}
|
|
72298
|
+
}
|
|
72299
|
+
exports.AbapdocLeadingAt = AbapdocLeadingAt;
|
|
72300
|
+
//# sourceMappingURL=abapdoc_leading_at.js.map
|
|
72301
|
+
|
|
72302
|
+
/***/ },
|
|
72303
|
+
|
|
72304
|
+
/***/ "../core/build/src/rules/abapdoc_parameter_names.js"
|
|
72305
|
+
/*!**********************************************************!*\
|
|
72306
|
+
!*** ../core/build/src/rules/abapdoc_parameter_names.js ***!
|
|
72307
|
+
\**********************************************************/
|
|
72308
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
72309
|
+
|
|
72310
|
+
"use strict";
|
|
72311
|
+
|
|
72312
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
72313
|
+
if (k2 === undefined) k2 = k;
|
|
72314
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
72315
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
72316
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
72317
|
+
}
|
|
72318
|
+
Object.defineProperty(o, k2, desc);
|
|
72319
|
+
}) : (function(o, m, k, k2) {
|
|
72320
|
+
if (k2 === undefined) k2 = k;
|
|
72321
|
+
o[k2] = m[k];
|
|
72322
|
+
}));
|
|
72323
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
72324
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
72325
|
+
}) : function(o, v) {
|
|
72326
|
+
o["default"] = v;
|
|
72327
|
+
});
|
|
72328
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
72329
|
+
var ownKeys = function(o) {
|
|
72330
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
72331
|
+
var ar = [];
|
|
72332
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
72333
|
+
return ar;
|
|
72334
|
+
};
|
|
72335
|
+
return ownKeys(o);
|
|
72336
|
+
};
|
|
72337
|
+
return function (mod) {
|
|
72338
|
+
if (mod && mod.__esModule) return mod;
|
|
72339
|
+
var result = {};
|
|
72340
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
72341
|
+
__setModuleDefault(result, mod);
|
|
72342
|
+
return result;
|
|
72343
|
+
};
|
|
72344
|
+
})();
|
|
72345
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
72346
|
+
exports.AbapdocParameterNames = exports.AbapdocParameterNamesConf = void 0;
|
|
72347
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
72348
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
72349
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
72350
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
72351
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
72352
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
72353
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
72354
|
+
class AbapdocParameterNamesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
72355
|
+
}
|
|
72356
|
+
exports.AbapdocParameterNamesConf = AbapdocParameterNamesConf;
|
|
72357
|
+
class AbapdocParameterNames extends _abap_rule_1.ABAPRule {
|
|
72358
|
+
constructor() {
|
|
72359
|
+
super(...arguments);
|
|
72360
|
+
this.conf = new AbapdocParameterNamesConf();
|
|
72361
|
+
}
|
|
72362
|
+
getMetadata() {
|
|
72363
|
+
return {
|
|
72364
|
+
key: "abapdoc_parameter_names",
|
|
72365
|
+
title: "ABAP Doc parameter names",
|
|
72366
|
+
shortDescription: `Checks that the parameters documented in ABAP Doc exist in the method definition.`,
|
|
72367
|
+
extendedInformation: `Reports "! @parameter lines in the ABAP Doc block in front of a METHODS or CLASS-METHODS
|
|
72368
|
+
definition when the parameter is not a parameter of the method, typically after a parameter was renamed or removed.
|
|
72369
|
+
Also reports a parameter documented twice.
|
|
72370
|
+
|
|
72371
|
+
Missing @parameter lines are not reported, documenting parameters is optional. @raising and @exception lines are not checked.
|
|
72372
|
+
|
|
72373
|
+
Only the block directly in front of the method is checked, a blank line or a plain comment ends the block,
|
|
72374
|
+
see rule wrong_abapdoc_position for misplaced ABAP Doc.`,
|
|
72375
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
72376
|
+
badExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
72377
|
+
PUBLIC SECTION.
|
|
72378
|
+
"! @parameter iv_bar | Bar
|
|
72379
|
+
METHODS foo IMPORTING iv_foo TYPE i.
|
|
72380
|
+
ENDCLASS.`,
|
|
72381
|
+
goodExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
72382
|
+
PUBLIC SECTION.
|
|
72383
|
+
"! @parameter iv_foo | Foo
|
|
72384
|
+
METHODS foo IMPORTING iv_foo TYPE i.
|
|
72385
|
+
ENDCLASS.`,
|
|
72386
|
+
};
|
|
72387
|
+
}
|
|
72388
|
+
getConfig() {
|
|
72389
|
+
return this.conf;
|
|
72390
|
+
}
|
|
72391
|
+
setConfig(conf) {
|
|
72392
|
+
this.conf = conf;
|
|
72393
|
+
}
|
|
72394
|
+
runParsed(file) {
|
|
72395
|
+
var _a;
|
|
72396
|
+
const issues = [];
|
|
72397
|
+
const statements = file.getStatements();
|
|
72398
|
+
for (let i = 0; i < statements.length; i++) {
|
|
72399
|
+
const def = statements[i];
|
|
72400
|
+
if (!(def.get() instanceof Statements.MethodDef)) {
|
|
72401
|
+
continue;
|
|
72402
|
+
}
|
|
72403
|
+
const name = def.findDirectExpression(Expressions.MethodName);
|
|
72404
|
+
if (name === undefined) {
|
|
72405
|
+
continue;
|
|
72406
|
+
}
|
|
72407
|
+
const abapdoc = [];
|
|
72408
|
+
let nextRow = undefined;
|
|
72409
|
+
for (let j = i - 1; j >= 0 && statements[j].get() instanceof _statement_1.Comment; j--) {
|
|
72410
|
+
const comment = statements[j];
|
|
72411
|
+
const start = comment.getStart();
|
|
72412
|
+
if (start.isAfter(name.getFirstToken().getStart())) {
|
|
72413
|
+
continue; // comment inside the statement, after the method name
|
|
72414
|
+
}
|
|
72415
|
+
nextRow = nextRow !== null && nextRow !== void 0 ? nextRow : (_a = def.getTokens().find(t => t.getStart().isAfter(start))) === null || _a === void 0 ? void 0 : _a.getStart().getRow();
|
|
72416
|
+
if (this.isAbapdoc(comment, def) === false || start.getRow() + 1 !== nextRow) {
|
|
72417
|
+
break; // a blank line or a plain comment ends the block
|
|
72418
|
+
}
|
|
72419
|
+
abapdoc.unshift(comment);
|
|
72420
|
+
nextRow = start.getRow();
|
|
72421
|
+
}
|
|
72422
|
+
if (abapdoc.length === 0) {
|
|
72423
|
+
continue;
|
|
72424
|
+
}
|
|
72425
|
+
const parameters = def.findAllExpressions(Expressions.MethodParamName)
|
|
72426
|
+
.map(p => p.getFirstToken().getStr().replace(/^!/, "").toUpperCase());
|
|
72427
|
+
const documented = new Set();
|
|
72428
|
+
for (const comment of abapdoc) {
|
|
72429
|
+
const match = comment.getFirstToken().getStr().match(/^"!\s*@parameter\s+!?([^\s|]+)/i);
|
|
72430
|
+
if (match === null) {
|
|
72431
|
+
continue;
|
|
72432
|
+
}
|
|
72433
|
+
const parameter = match[1].toUpperCase();
|
|
72434
|
+
let message = undefined;
|
|
72435
|
+
if (parameters.includes(parameter) === false) {
|
|
72436
|
+
message = `ABAP Doc parameter "${match[1]}" is not a parameter of method ${name.concatTokens()}`;
|
|
72437
|
+
}
|
|
72438
|
+
else if (documented.has(parameter) === true) {
|
|
72439
|
+
message = `ABAP Doc parameter "${match[1]}" documented more than once`;
|
|
72440
|
+
}
|
|
72441
|
+
documented.add(parameter);
|
|
72442
|
+
if (message !== undefined) {
|
|
72443
|
+
issues.push(issue_1.Issue.atStatement(file, comment, message, this.getMetadata().key, this.conf.severity));
|
|
72444
|
+
}
|
|
72445
|
+
}
|
|
72446
|
+
}
|
|
72447
|
+
return issues;
|
|
72448
|
+
}
|
|
72449
|
+
/** ABAP Doc in front of the method name, after the colon of a chain */
|
|
72450
|
+
isAbapdoc(comment, def) {
|
|
72451
|
+
if (comment.getFirstToken().getStr().startsWith(`"!`) === false) {
|
|
72452
|
+
return false;
|
|
72453
|
+
}
|
|
72454
|
+
const colon = def.getColon();
|
|
72455
|
+
return colon === undefined || comment.getStart().isAfter(colon.getStart());
|
|
72456
|
+
}
|
|
72457
|
+
}
|
|
72458
|
+
exports.AbapdocParameterNames = AbapdocParameterNames;
|
|
72459
|
+
//# sourceMappingURL=abapdoc_parameter_names.js.map
|
|
72460
|
+
|
|
72461
|
+
/***/ },
|
|
72462
|
+
|
|
72463
|
+
/***/ "../core/build/src/rules/add_test_attributes.js"
|
|
72464
|
+
/*!******************************************************!*\
|
|
72465
|
+
!*** ../core/build/src/rules/add_test_attributes.js ***!
|
|
72466
|
+
\******************************************************/
|
|
72467
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
72468
|
+
|
|
72469
|
+
"use strict";
|
|
72470
|
+
|
|
72471
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
72472
|
+
if (k2 === undefined) k2 = k;
|
|
72473
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
72474
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
72475
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
72476
|
+
}
|
|
72477
|
+
Object.defineProperty(o, k2, desc);
|
|
72478
|
+
}) : (function(o, m, k, k2) {
|
|
72479
|
+
if (k2 === undefined) k2 = k;
|
|
72480
|
+
o[k2] = m[k];
|
|
72481
|
+
}));
|
|
72482
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
72483
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
72484
|
+
}) : function(o, v) {
|
|
72485
|
+
o["default"] = v;
|
|
72486
|
+
});
|
|
72487
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
72488
|
+
var ownKeys = function(o) {
|
|
72489
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
72490
|
+
var ar = [];
|
|
72491
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
72492
|
+
return ar;
|
|
72493
|
+
};
|
|
72494
|
+
return ownKeys(o);
|
|
72495
|
+
};
|
|
72496
|
+
return function (mod) {
|
|
72497
|
+
if (mod && mod.__esModule) return mod;
|
|
72498
|
+
var result = {};
|
|
72499
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
72500
|
+
__setModuleDefault(result, mod);
|
|
72501
|
+
return result;
|
|
72502
|
+
};
|
|
72503
|
+
})();
|
|
72504
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
72505
|
+
exports.AddTestAttributes = exports.AddTestAttributesConf = void 0;
|
|
72506
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
72507
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
72508
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
72509
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
72510
|
+
const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
|
|
72511
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
72512
|
+
class AddTestAttributesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
72513
|
+
}
|
|
72514
|
+
exports.AddTestAttributesConf = AddTestAttributesConf;
|
|
72515
|
+
class AddTestAttributes extends _abap_rule_1.ABAPRule {
|
|
72516
|
+
constructor() {
|
|
72517
|
+
super(...arguments);
|
|
72518
|
+
this.conf = new AddTestAttributesConf();
|
|
72519
|
+
}
|
|
72520
|
+
getMetadata() {
|
|
72521
|
+
return {
|
|
72522
|
+
key: "add_test_attributes",
|
|
72523
|
+
title: "Add test attributes for tests classes with test methods",
|
|
72524
|
+
shortDescription: `Add test attributes DURATION and RISK LEVEL for tests classes with test methods`,
|
|
72525
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
72526
|
+
badExample: `CLASS ltcl_test1 DEFINITION FINAL FOR TESTING.
|
|
72527
|
+
PUBLIC SECTION.
|
|
72528
|
+
PROTECTED SECTION.
|
|
72529
|
+
PRIVATE SECTION.
|
|
72530
|
+
METHODS test FOR TESTING RAISING cx_static_check.
|
|
72531
|
+
ENDCLASS.
|
|
72532
|
+
|
|
72533
|
+
CLASS ltcl_test1 IMPLEMENTATION.
|
|
72534
|
+
METHOD test.
|
|
72535
|
+
ENDMETHOD.
|
|
72536
|
+
ENDCLASS.`,
|
|
72537
|
+
goodExample: `CLASS ltcl_test2 DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
72538
|
+
PUBLIC SECTION.
|
|
72539
|
+
PROTECTED SECTION.
|
|
72540
|
+
PRIVATE SECTION.
|
|
72541
|
+
METHODS test FOR TESTING RAISING cx_static_check.
|
|
72542
|
+
ENDCLASS.
|
|
72543
|
+
|
|
72544
|
+
CLASS ltcl_test2 IMPLEMENTATION.
|
|
72545
|
+
METHOD test.
|
|
72546
|
+
ENDMETHOD.
|
|
72547
|
+
ENDCLASS.`,
|
|
72548
|
+
};
|
|
72549
|
+
}
|
|
72550
|
+
getConfig() {
|
|
72551
|
+
return this.conf;
|
|
72552
|
+
}
|
|
72553
|
+
setConfig(conf) {
|
|
72554
|
+
this.conf = conf;
|
|
72555
|
+
}
|
|
72556
|
+
runParsed(file) {
|
|
72557
|
+
const issues = [];
|
|
72558
|
+
const stru = file.getStructure();
|
|
72559
|
+
if (stru === undefined) {
|
|
72560
|
+
return [];
|
|
72561
|
+
}
|
|
72562
|
+
for (const classStructure of stru.findAllStructures(Structures.ClassDefinition)) {
|
|
72563
|
+
const cdef = classStructure.findFirstStatement(Statements.ClassDefinition);
|
|
72564
|
+
if (cdef === undefined) {
|
|
72565
|
+
continue;
|
|
72566
|
+
}
|
|
72567
|
+
const cdefConcat = cdef === null || cdef === void 0 ? void 0 : cdef.concatTokens().toUpperCase();
|
|
72568
|
+
if ((cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" FOR TESTING")) === false) {
|
|
72569
|
+
continue;
|
|
72570
|
+
}
|
|
72571
|
+
const hasDuration = cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" DURATION ");
|
|
72572
|
+
const hasRiskLevel = cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" RISK LEVEL ");
|
|
72573
|
+
if (hasDuration === true && hasRiskLevel === true) {
|
|
72574
|
+
continue;
|
|
72575
|
+
}
|
|
72576
|
+
let hasTestMethod = false;
|
|
72577
|
+
for (const mdef of classStructure.findAllStatements(Statements.MethodDef)) {
|
|
72578
|
+
const concat = mdef.concatTokens().toUpperCase();
|
|
72579
|
+
if (concat.includes(" FOR TESTING")) {
|
|
72580
|
+
hasTestMethod = true;
|
|
72581
|
+
}
|
|
72582
|
+
}
|
|
72583
|
+
if (hasTestMethod === false) {
|
|
72584
|
+
continue;
|
|
72585
|
+
}
|
|
72586
|
+
if (hasDuration === false) {
|
|
72587
|
+
issues.push(issue_1.Issue.atStatement(file, cdef, "Add DURATION", this.getMetadata().key, this.getConfig().severity));
|
|
72588
|
+
}
|
|
72589
|
+
if (hasRiskLevel === false) {
|
|
72590
|
+
issues.push(issue_1.Issue.atStatement(file, cdef, "Add RISK LEVEL", this.getMetadata().key, this.getConfig().severity));
|
|
72591
|
+
}
|
|
72592
|
+
}
|
|
72593
|
+
return issues;
|
|
72594
|
+
}
|
|
72595
|
+
}
|
|
72596
|
+
exports.AddTestAttributes = AddTestAttributes;
|
|
72597
|
+
//# sourceMappingURL=add_test_attributes.js.map
|
|
72598
|
+
|
|
72599
|
+
/***/ },
|
|
72600
|
+
|
|
72601
|
+
/***/ "../core/build/src/rules/aff_and_xml.js"
|
|
72602
|
+
/*!**********************************************!*\
|
|
72603
|
+
!*** ../core/build/src/rules/aff_and_xml.js ***!
|
|
72604
|
+
\**********************************************/
|
|
72605
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
72606
|
+
|
|
72607
|
+
"use strict";
|
|
72608
|
+
|
|
72609
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
72610
|
+
exports.AFFAndXML = exports.AFFAndXMLConf = void 0;
|
|
72611
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
72612
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
72613
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
72614
|
+
class AFFAndXMLConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
72615
|
+
}
|
|
72616
|
+
exports.AFFAndXMLConf = AFFAndXMLConf;
|
|
72617
|
+
class AFFAndXML {
|
|
72618
|
+
constructor() {
|
|
72619
|
+
this.conf = new AFFAndXMLConf();
|
|
72620
|
+
}
|
|
72621
|
+
getMetadata() {
|
|
72622
|
+
return {
|
|
72623
|
+
key: "aff_and_xml",
|
|
72624
|
+
title: "AFF and XML",
|
|
72625
|
+
shortDescription: `Checks for objects that have both AFF (.json) and XML (.xml) files`,
|
|
72626
|
+
extendedInformation: `If an object has both an ABAP file format JSON file and an XML file, the XML file should be removed`,
|
|
72627
|
+
tags: [_irule_1.RuleTag.Syntax],
|
|
72628
|
+
};
|
|
72629
|
+
}
|
|
72630
|
+
getConfig() {
|
|
72631
|
+
return this.conf;
|
|
72632
|
+
}
|
|
72633
|
+
setConfig(conf) {
|
|
72634
|
+
this.conf = conf;
|
|
72635
|
+
}
|
|
72636
|
+
initialize(_reg) {
|
|
72637
|
+
return this;
|
|
72638
|
+
}
|
|
72639
|
+
run(obj) {
|
|
72640
|
+
const files = obj.getFiles();
|
|
72641
|
+
let hasJSON = false;
|
|
72642
|
+
let hasXML = false;
|
|
72643
|
+
const type = obj.getType().toLowerCase();
|
|
72644
|
+
for (const file of files) {
|
|
72645
|
+
const filename = file.getFilename().toLowerCase();
|
|
72646
|
+
if (filename.endsWith("." + type + ".json")) {
|
|
72647
|
+
hasJSON = true;
|
|
72648
|
+
}
|
|
72649
|
+
else if (filename.endsWith("." + type + ".xml")) {
|
|
72650
|
+
hasXML = true;
|
|
72651
|
+
}
|
|
72652
|
+
}
|
|
72653
|
+
if (hasJSON && hasXML) {
|
|
72654
|
+
const xmlFile = obj.getXMLFile();
|
|
72655
|
+
if (xmlFile) {
|
|
72656
|
+
const message = "Object has both AFF JSON and XML files, remove the XML";
|
|
72657
|
+
return [issue_1.Issue.atRow(xmlFile, 1, message, this.getMetadata().key, this.conf.severity)];
|
|
72658
|
+
}
|
|
72659
|
+
}
|
|
72660
|
+
return [];
|
|
72661
|
+
}
|
|
72662
|
+
}
|
|
72663
|
+
exports.AFFAndXML = AFFAndXML;
|
|
72664
|
+
//# sourceMappingURL=aff_and_xml.js.map
|
|
72665
|
+
|
|
72666
|
+
/***/ },
|
|
72667
|
+
|
|
72668
|
+
/***/ "../core/build/src/rules/align_parameters.js"
|
|
72669
|
+
/*!***************************************************!*\
|
|
72670
|
+
!*** ../core/build/src/rules/align_parameters.js ***!
|
|
72671
|
+
\***************************************************/
|
|
71715
72672
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
71716
72673
|
|
|
71717
72674
|
"use strict";
|
|
@@ -73803,10 +74760,10 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
73803
74760
|
let searchable;
|
|
73804
74761
|
for (const annotation of tree.findAllExpressionsRecursive(expressions_1.CDSAnnotation)) {
|
|
73805
74762
|
const normalized = annotation.concatTokens().replace(/\s/g, "").toUpperCase().replace(/^@</, "@");
|
|
73806
|
-
if (this.hasSearchAnnotation(normalized,
|
|
74763
|
+
if (this.hasSearchAnnotation(normalized, /[.{,]DEFAULTSEARCHELEMENT:TRUE/)) {
|
|
73807
74764
|
return;
|
|
73808
74765
|
}
|
|
73809
|
-
else if (searchable === undefined && this.hasSearchAnnotation(normalized,
|
|
74766
|
+
else if (searchable === undefined && this.hasSearchAnnotation(normalized, /[.{,]SEARCHABLE:TRUE/)) {
|
|
73810
74767
|
searchable = annotation;
|
|
73811
74768
|
}
|
|
73812
74769
|
}
|
|
@@ -73816,11 +74773,11 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
73816
74773
|
issues.push(issue_1.Issue.atToken(file, searchable.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
73817
74774
|
}
|
|
73818
74775
|
}
|
|
73819
|
-
hasSearchAnnotation(normalized,
|
|
74776
|
+
hasSearchAnnotation(normalized, annotation) {
|
|
73820
74777
|
if (normalized.startsWith("@SEARCH") === false) {
|
|
73821
74778
|
return false;
|
|
73822
74779
|
}
|
|
73823
|
-
return
|
|
74780
|
+
return annotation.test(normalized);
|
|
73824
74781
|
}
|
|
73825
74782
|
checkReservedNames(tree, issues, file) {
|
|
73826
74783
|
var _a, _b;
|
|
@@ -74660,6 +75617,7 @@ class ChangeIfToCase extends _abap_rule_1.ABAPRule {
|
|
|
74660
75617
|
constructor() {
|
|
74661
75618
|
super(...arguments);
|
|
74662
75619
|
this.conf = new ChangeIfToCaseConf();
|
|
75620
|
+
this.skipNames = [];
|
|
74663
75621
|
}
|
|
74664
75622
|
getMetadata() {
|
|
74665
75623
|
return {
|
|
@@ -74686,6 +75644,7 @@ ENDCASE.`,
|
|
|
74686
75644
|
}
|
|
74687
75645
|
setConfig(conf) {
|
|
74688
75646
|
this.conf = conf;
|
|
75647
|
+
this.skipNames = (this.conf.skipNames || []).map(skip => new RegExp(skip, "i"));
|
|
74689
75648
|
}
|
|
74690
75649
|
runParsed(file) {
|
|
74691
75650
|
var _a;
|
|
@@ -74763,8 +75722,7 @@ ENDCASE.`,
|
|
|
74763
75722
|
else {
|
|
74764
75723
|
return false;
|
|
74765
75724
|
}
|
|
74766
|
-
for (const
|
|
74767
|
-
const reg = new RegExp(skip, "i");
|
|
75725
|
+
for (const reg of this.skipNames) {
|
|
74768
75726
|
if (chain.match(reg)) {
|
|
74769
75727
|
return false;
|
|
74770
75728
|
}
|
|
@@ -74782,6 +75740,251 @@ exports.ChangeIfToCase = ChangeIfToCase;
|
|
|
74782
75740
|
|
|
74783
75741
|
/***/ },
|
|
74784
75742
|
|
|
75743
|
+
/***/ "../core/build/src/rules/changing_sorted_line.js"
|
|
75744
|
+
/*!*******************************************************!*\
|
|
75745
|
+
!*** ../core/build/src/rules/changing_sorted_line.js ***!
|
|
75746
|
+
\*******************************************************/
|
|
75747
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
75748
|
+
|
|
75749
|
+
"use strict";
|
|
75750
|
+
|
|
75751
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
75752
|
+
if (k2 === undefined) k2 = k;
|
|
75753
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
75754
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
75755
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
75756
|
+
}
|
|
75757
|
+
Object.defineProperty(o, k2, desc);
|
|
75758
|
+
}) : (function(o, m, k, k2) {
|
|
75759
|
+
if (k2 === undefined) k2 = k;
|
|
75760
|
+
o[k2] = m[k];
|
|
75761
|
+
}));
|
|
75762
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
75763
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
75764
|
+
}) : function(o, v) {
|
|
75765
|
+
o["default"] = v;
|
|
75766
|
+
});
|
|
75767
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
75768
|
+
var ownKeys = function(o) {
|
|
75769
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
75770
|
+
var ar = [];
|
|
75771
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
75772
|
+
return ar;
|
|
75773
|
+
};
|
|
75774
|
+
return ownKeys(o);
|
|
75775
|
+
};
|
|
75776
|
+
return function (mod) {
|
|
75777
|
+
if (mod && mod.__esModule) return mod;
|
|
75778
|
+
var result = {};
|
|
75779
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
75780
|
+
__setModuleDefault(result, mod);
|
|
75781
|
+
return result;
|
|
75782
|
+
};
|
|
75783
|
+
})();
|
|
75784
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75785
|
+
exports.ChangingSortedLine = exports.ChangingSortedLineConf = void 0;
|
|
75786
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
75787
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
75788
|
+
const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
|
|
75789
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
75790
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
75791
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
75792
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
75793
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
75794
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
75795
|
+
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
|
|
75796
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
75797
|
+
const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
|
|
75798
|
+
class ChangingSortedLineConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
75799
|
+
}
|
|
75800
|
+
exports.ChangingSortedLineConf = ChangingSortedLineConf;
|
|
75801
|
+
class ChangingSortedLine {
|
|
75802
|
+
constructor() {
|
|
75803
|
+
this.conf = new ChangingSortedLineConf();
|
|
75804
|
+
}
|
|
75805
|
+
getMetadata() {
|
|
75806
|
+
return {
|
|
75807
|
+
key: "changing_sorted_line",
|
|
75808
|
+
title: "Line of a sorted or hashed table passed to CHANGING",
|
|
75809
|
+
shortDescription: `A field symbol on a whole line of a sorted or hashed table, passed to a CHANGING parameter of a method`,
|
|
75810
|
+
extendedInformation: `The key fields of a sorted or hashed table line are write-protected, so the line as a whole is
|
|
75811
|
+
write-protected. Binding it to a CHANGING parameter activates, but the call fails at runtime with
|
|
75812
|
+
CX_SY_DYN_CALL_ILLEGAL_TYPE, "the actual parameter for ... is write-protected", even when the method does not
|
|
75813
|
+
change the key.
|
|
75814
|
+
|
|
75815
|
+
Only field symbols assigned in the same method, form or function module are checked, via READ TABLE ... ASSIGNING,
|
|
75816
|
+
LOOP AT ... ASSIGNING, INSERT ... INTO TABLE ... ASSIGNING and ASSIGN itab[ ... ] TO.
|
|
75817
|
+
|
|
75818
|
+
Fix: read the line into a work area, pass the work area and MODIFY TABLE ... FROM it afterwards,
|
|
75819
|
+
or pass only the non-key fields the method needs.`,
|
|
75820
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
75821
|
+
badExample: `READ TABLE lt_sum WITH TABLE KEY app = lv_app ASSIGNING FIELD-SYMBOL(<sum>).
|
|
75822
|
+
add( CHANGING cs_sum = <sum> ).`,
|
|
75823
|
+
goodExample: `READ TABLE lt_sum WITH TABLE KEY app = lv_app INTO DATA(ls_sum).
|
|
75824
|
+
add( CHANGING cs_sum = ls_sum ).
|
|
75825
|
+
MODIFY TABLE lt_sum FROM ls_sum.`,
|
|
75826
|
+
};
|
|
75827
|
+
}
|
|
75828
|
+
getConfig() {
|
|
75829
|
+
return this.conf;
|
|
75830
|
+
}
|
|
75831
|
+
initialize(reg) {
|
|
75832
|
+
this.reg = reg;
|
|
75833
|
+
return this;
|
|
75834
|
+
}
|
|
75835
|
+
setConfig(conf) {
|
|
75836
|
+
this.conf = conf;
|
|
75837
|
+
}
|
|
75838
|
+
run(obj) {
|
|
75839
|
+
if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === "INTF") {
|
|
75840
|
+
return [];
|
|
75841
|
+
}
|
|
75842
|
+
const issues = [];
|
|
75843
|
+
let spaghetti = undefined;
|
|
75844
|
+
for (const file of obj.getABAPFiles()) {
|
|
75845
|
+
const stru = file.getStructure();
|
|
75846
|
+
if (stru === undefined || stru.findFirstExpression(Expressions.MethodParameters) === undefined) {
|
|
75847
|
+
continue;
|
|
75848
|
+
}
|
|
75849
|
+
if (spaghetti === undefined) {
|
|
75850
|
+
spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
|
|
75851
|
+
}
|
|
75852
|
+
const blocks = [...stru.findAllStructures(Structures.Method),
|
|
75853
|
+
...stru.findAllStructures(Structures.Form),
|
|
75854
|
+
...stru.findAllStructures(Structures.FunctionModule)];
|
|
75855
|
+
for (const block of blocks) {
|
|
75856
|
+
// field symbol name -> name of the sorted or hashed table it points into
|
|
75857
|
+
const lines = new Map();
|
|
75858
|
+
for (const statement of block.findAllStatementNodes()) {
|
|
75859
|
+
for (const p of statement.findAllExpressions(Expressions.MethodParameters)) {
|
|
75860
|
+
this.checkChanging(p, lines, spaghetti, file, issues);
|
|
75861
|
+
}
|
|
75862
|
+
this.updateAssigned(statement, lines, spaghetti, file);
|
|
75863
|
+
}
|
|
75864
|
+
}
|
|
75865
|
+
}
|
|
75866
|
+
return issues;
|
|
75867
|
+
}
|
|
75868
|
+
////////////////
|
|
75869
|
+
checkChanging(params, lines, spaghetti, file, issues) {
|
|
75870
|
+
var _a, _b;
|
|
75871
|
+
let changing = false;
|
|
75872
|
+
for (const child of params.getChildren()) {
|
|
75873
|
+
const str = child.concatTokens().toUpperCase();
|
|
75874
|
+
if (child instanceof nodes_1.ExpressionNode && changing === true && child.get() instanceof Expressions.ParameterListT) {
|
|
75875
|
+
for (const p of child.findDirectExpressions(Expressions.ParameterT)) {
|
|
75876
|
+
const target = p.findDirectExpression(Expressions.Target);
|
|
75877
|
+
const fs = (target === null || target === void 0 ? void 0 : target.getChildren().length) === 1 ? target.findDirectExpression(Expressions.TargetFieldSymbol) : undefined;
|
|
75878
|
+
if (fs === undefined) {
|
|
75879
|
+
continue;
|
|
75880
|
+
}
|
|
75881
|
+
const table = lines.get(fs.concatTokens().toUpperCase());
|
|
75882
|
+
const type = (_a = this.findReference(fs.getFirstToken().getStart(), spaghetti, file)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
75883
|
+
if (table === undefined || type === undefined || type.isGeneric()) {
|
|
75884
|
+
continue;
|
|
75885
|
+
}
|
|
75886
|
+
const name = (_b = p.findDirectExpression(Expressions.ParameterName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
75887
|
+
const message = `Line of sorted or hashed table ${table} passed to CHANGING ${name} is write-protected, ` +
|
|
75888
|
+
`the call fails at runtime. Use a work area and MODIFY TABLE ... FROM, or pass only non-key fields`;
|
|
75889
|
+
issues.push(issue_1.Issue.atToken(file, fs.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
75890
|
+
}
|
|
75891
|
+
}
|
|
75892
|
+
changing = str === "CHANGING";
|
|
75893
|
+
}
|
|
75894
|
+
}
|
|
75895
|
+
/** Tracks which field symbols the last assignment pointed to a whole line of a sorted or hashed table */
|
|
75896
|
+
updateAssigned(statement, lines, spaghetti, file) {
|
|
75897
|
+
var _a, _b, _c;
|
|
75898
|
+
var _d;
|
|
75899
|
+
const get = statement.get();
|
|
75900
|
+
const fs = get instanceof Statements.Unassign
|
|
75901
|
+
? statement.findDirectExpression(Expressions.TargetFieldSymbol)
|
|
75902
|
+
: (_a = statement.findFirstExpression(Expressions.FSTarget)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.TargetFieldSymbol);
|
|
75903
|
+
if (fs === undefined) {
|
|
75904
|
+
return;
|
|
75905
|
+
}
|
|
75906
|
+
const name = fs.concatTokens().toUpperCase();
|
|
75907
|
+
let table = undefined;
|
|
75908
|
+
let isTableExpression = false;
|
|
75909
|
+
if (get instanceof Statements.ReadTable) {
|
|
75910
|
+
table = (_d = statement.findDirectExpression(Expressions.SimpleSource2)) !== null && _d !== void 0 ? _d : statement.findDirectExpression(Expressions.Source);
|
|
75911
|
+
}
|
|
75912
|
+
else if (get instanceof Statements.Loop) {
|
|
75913
|
+
table = (_b = statement.findDirectExpression(Expressions.LoopSource)) === null || _b === void 0 ? void 0 : _b.getFirstChild();
|
|
75914
|
+
}
|
|
75915
|
+
else if (get instanceof Statements.InsertInternal && statement.findDirectTokenByText("TABLE") !== undefined) {
|
|
75916
|
+
table = statement.findDirectExpression(Expressions.Target);
|
|
75917
|
+
}
|
|
75918
|
+
else if (get instanceof Statements.Assign) {
|
|
75919
|
+
table = (_c = statement.findDirectExpression(Expressions.AssignSource)) === null || _c === void 0 ? void 0 : _c.getFirstChild();
|
|
75920
|
+
isTableExpression = true;
|
|
75921
|
+
}
|
|
75922
|
+
const tableType = table instanceof nodes_1.ExpressionNode ? this.findTableType(table, isTableExpression, spaghetti, file) : undefined;
|
|
75923
|
+
if (table instanceof nodes_1.ExpressionNode && tableType instanceof basic_1.TableType
|
|
75924
|
+
&& (tableType.getAccessType() === basic_1.TableAccessType.sorted || tableType.getAccessType() === basic_1.TableAccessType.hashed)) {
|
|
75925
|
+
lines.set(name, table.concatTokens().replace(/\[.*$/, "").trim());
|
|
75926
|
+
}
|
|
75927
|
+
else {
|
|
75928
|
+
lines.delete(name);
|
|
75929
|
+
}
|
|
75930
|
+
}
|
|
75931
|
+
/** The type of a table given by a plain field chain of names, components and attributes, else undefined.
|
|
75932
|
+
* With tableExpression, the chain must end with a table expression, and the type of the chain before it is returned */
|
|
75933
|
+
findTableType(node, tableExpression, spaghetti, file) {
|
|
75934
|
+
var _a, _b;
|
|
75935
|
+
if (!(node.get() instanceof Expressions.Target)) {
|
|
75936
|
+
const chain = node.getChildren().length === 1 ? node.findDirectExpression(Expressions.FieldChain) : undefined;
|
|
75937
|
+
if (chain === undefined) {
|
|
75938
|
+
return undefined;
|
|
75939
|
+
}
|
|
75940
|
+
node = chain;
|
|
75941
|
+
}
|
|
75942
|
+
const children = [...node.getChildren()];
|
|
75943
|
+
if (tableExpression === true) {
|
|
75944
|
+
if (!(((_a = children.pop()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.TableExpression)) {
|
|
75945
|
+
return undefined;
|
|
75946
|
+
}
|
|
75947
|
+
}
|
|
75948
|
+
let type = undefined;
|
|
75949
|
+
for (const child of children) {
|
|
75950
|
+
const get = child.get();
|
|
75951
|
+
if (get instanceof Expressions.SourceField
|
|
75952
|
+
|| get instanceof Expressions.SourceFieldSymbol
|
|
75953
|
+
|| get instanceof Expressions.TargetField
|
|
75954
|
+
|| get instanceof Expressions.TargetFieldSymbol
|
|
75955
|
+
|| get instanceof Expressions.AttributeName) {
|
|
75956
|
+
type = (_b = this.findReference(child.getFirstToken().getStart(), spaghetti, file)) === null || _b === void 0 ? void 0 : _b.getType();
|
|
75957
|
+
}
|
|
75958
|
+
else if (get instanceof Expressions.ComponentName) {
|
|
75959
|
+
type = type instanceof basic_1.StructureType ? type.getComponentByName(child.concatTokens()) : undefined;
|
|
75960
|
+
}
|
|
75961
|
+
else if (get instanceof Expressions.ClassName || get instanceof tokens_1.StaticArrow) {
|
|
75962
|
+
continue;
|
|
75963
|
+
}
|
|
75964
|
+
else if (!(get instanceof tokens_1.Dash) && !(get instanceof tokens_1.InstanceArrow)) {
|
|
75965
|
+
return undefined;
|
|
75966
|
+
}
|
|
75967
|
+
if (type === undefined) {
|
|
75968
|
+
return undefined;
|
|
75969
|
+
}
|
|
75970
|
+
}
|
|
75971
|
+
return type;
|
|
75972
|
+
}
|
|
75973
|
+
findReference(start, spaghetti, file) {
|
|
75974
|
+
const scope = spaghetti.lookupPosition(start, file.getFilename());
|
|
75975
|
+
for (const r of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
|
|
75976
|
+
if (r.position.getStart().equals(start) && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {
|
|
75977
|
+
return r.resolved;
|
|
75978
|
+
}
|
|
75979
|
+
}
|
|
75980
|
+
return undefined;
|
|
75981
|
+
}
|
|
75982
|
+
}
|
|
75983
|
+
exports.ChangingSortedLine = ChangingSortedLine;
|
|
75984
|
+
//# sourceMappingURL=changing_sorted_line.js.map
|
|
75985
|
+
|
|
75986
|
+
/***/ },
|
|
75987
|
+
|
|
74785
75988
|
/***/ "../core/build/src/rules/check_abstract.js"
|
|
74786
75989
|
/*!*************************************************!*\
|
|
74787
75990
|
!*** ../core/build/src/rules/check_abstract.js ***!
|
|
@@ -75731,6 +76934,7 @@ class ClassAttributeNames extends _abap_rule_1.ABAPRule {
|
|
|
75731
76934
|
constructor() {
|
|
75732
76935
|
super(...arguments);
|
|
75733
76936
|
this.conf = new ClassAttributeNamesConf();
|
|
76937
|
+
this.regex = this.compile();
|
|
75734
76938
|
}
|
|
75735
76939
|
getMetadata() {
|
|
75736
76940
|
return {
|
|
@@ -75758,6 +76962,15 @@ ENDCLASS.`,
|
|
|
75758
76962
|
}
|
|
75759
76963
|
setConfig(conf) {
|
|
75760
76964
|
this.conf = conf;
|
|
76965
|
+
this.regex = this.compile();
|
|
76966
|
+
}
|
|
76967
|
+
compile() {
|
|
76968
|
+
return {
|
|
76969
|
+
statics: new RegExp(this.conf.statics, "i"),
|
|
76970
|
+
instance: new RegExp(this.conf.instance, "i"),
|
|
76971
|
+
constants: new RegExp(this.conf.constants, "i"),
|
|
76972
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
76973
|
+
};
|
|
75761
76974
|
}
|
|
75762
76975
|
runParsed(file, obj) {
|
|
75763
76976
|
if (this.conf.patternKind === undefined) {
|
|
@@ -75790,13 +77003,13 @@ ENDCLASS.`,
|
|
|
75790
77003
|
for (const a of attr) {
|
|
75791
77004
|
switch (a.level) {
|
|
75792
77005
|
case _abap_file_information_1.AttributeLevel.Instance:
|
|
75793
|
-
ret = ret.concat(this.checkName(a.identifier, this.conf.instance));
|
|
77006
|
+
ret = ret.concat(this.checkName(a.identifier, this.conf.instance, this.regex.instance));
|
|
75794
77007
|
break;
|
|
75795
77008
|
case _abap_file_information_1.AttributeLevel.Static:
|
|
75796
|
-
ret = ret.concat(this.checkName(a.identifier, this.conf.statics));
|
|
77009
|
+
ret = ret.concat(this.checkName(a.identifier, this.conf.statics, this.regex.statics));
|
|
75797
77010
|
break;
|
|
75798
77011
|
case _abap_file_information_1.AttributeLevel.Constant:
|
|
75799
|
-
ret = ret.concat(this.checkName(a.identifier, this.conf.constants));
|
|
77012
|
+
ret = ret.concat(this.checkName(a.identifier, this.conf.constants, this.regex.constants));
|
|
75800
77013
|
break;
|
|
75801
77014
|
default:
|
|
75802
77015
|
break;
|
|
@@ -75804,11 +77017,10 @@ ENDCLASS.`,
|
|
|
75804
77017
|
}
|
|
75805
77018
|
return ret;
|
|
75806
77019
|
}
|
|
75807
|
-
checkName(attr, expected) {
|
|
77020
|
+
checkName(attr, expected, regex) {
|
|
75808
77021
|
const ret = [];
|
|
75809
|
-
const regex = new RegExp(expected, "i");
|
|
75810
77022
|
const name = attr.getName();
|
|
75811
|
-
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {
|
|
77023
|
+
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf, this.regex.ignorePatterns)) {
|
|
75812
77024
|
const issue = issue_1.Issue.atIdentifier(attr, this.getDescription(name, expected), this.getMetadata().key, this.conf.severity);
|
|
75813
77025
|
ret.push(issue);
|
|
75814
77026
|
}
|
|
@@ -77638,6 +78850,179 @@ exports.DefinitionsTop = DefinitionsTop;
|
|
|
77638
78850
|
|
|
77639
78851
|
/***/ },
|
|
77640
78852
|
|
|
78853
|
+
/***/ "../core/build/src/rules/delete_index_in_loop.js"
|
|
78854
|
+
/*!*******************************************************!*\
|
|
78855
|
+
!*** ../core/build/src/rules/delete_index_in_loop.js ***!
|
|
78856
|
+
\*******************************************************/
|
|
78857
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
78858
|
+
|
|
78859
|
+
"use strict";
|
|
78860
|
+
|
|
78861
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
78862
|
+
if (k2 === undefined) k2 = k;
|
|
78863
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
78864
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
78865
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
78866
|
+
}
|
|
78867
|
+
Object.defineProperty(o, k2, desc);
|
|
78868
|
+
}) : (function(o, m, k, k2) {
|
|
78869
|
+
if (k2 === undefined) k2 = k;
|
|
78870
|
+
o[k2] = m[k];
|
|
78871
|
+
}));
|
|
78872
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
78873
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
78874
|
+
}) : function(o, v) {
|
|
78875
|
+
o["default"] = v;
|
|
78876
|
+
});
|
|
78877
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
78878
|
+
var ownKeys = function(o) {
|
|
78879
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
78880
|
+
var ar = [];
|
|
78881
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
78882
|
+
return ar;
|
|
78883
|
+
};
|
|
78884
|
+
return ownKeys(o);
|
|
78885
|
+
};
|
|
78886
|
+
return function (mod) {
|
|
78887
|
+
if (mod && mod.__esModule) return mod;
|
|
78888
|
+
var result = {};
|
|
78889
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
78890
|
+
__setModuleDefault(result, mod);
|
|
78891
|
+
return result;
|
|
78892
|
+
};
|
|
78893
|
+
})();
|
|
78894
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78895
|
+
exports.DeleteIndexInLoop = exports.DeleteIndexInLoopConf = void 0;
|
|
78896
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
78897
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
78898
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
78899
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
78900
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
78901
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
78902
|
+
const token_node_1 = __webpack_require__(/*! ../abap/nodes/token_node */ "../core/build/src/abap/nodes/token_node.js");
|
|
78903
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
78904
|
+
class DeleteIndexInLoopConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
78905
|
+
}
|
|
78906
|
+
exports.DeleteIndexInLoopConf = DeleteIndexInLoopConf;
|
|
78907
|
+
class DeleteIndexInLoop extends _abap_rule_1.ABAPRule {
|
|
78908
|
+
constructor() {
|
|
78909
|
+
super(...arguments);
|
|
78910
|
+
this.conf = new DeleteIndexInLoopConf();
|
|
78911
|
+
}
|
|
78912
|
+
getMetadata() {
|
|
78913
|
+
return {
|
|
78914
|
+
key: "delete_index_in_loop",
|
|
78915
|
+
title: "DELETE INDEX sy-tabix inside a LOOP over the same table",
|
|
78916
|
+
shortDescription: `Reports DELETE itab INDEX sy-tabix inside a LOOP AT the same table`,
|
|
78917
|
+
extendedInformation: `sy-tabix is the index of the loop's current row only until another statement writes it.
|
|
78918
|
+
READ TABLE, APPEND, INSERT, COLLECT, a nested LOOP and any method called in the loop body
|
|
78919
|
+
all set sy-tabix. After that the DELETE removes a different row, and if sy-tabix is 0 it
|
|
78920
|
+
raises the runtime error TABLE_INVALID_INDEX.
|
|
78921
|
+
|
|
78922
|
+
Use DELETE itab WHERE ..., or collect the rows to keep in a second table.
|
|
78923
|
+
|
|
78924
|
+
Not reported: DELETE itab INDEX sy-tabix directly after READ TABLE itab, where sy-tabix
|
|
78925
|
+
is the index the READ just set.`,
|
|
78926
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
78927
|
+
badExample: `LOOP AT tab INTO row.
|
|
78928
|
+
IF row-flag = abap_true.
|
|
78929
|
+
DELETE tab INDEX sy-tabix.
|
|
78930
|
+
ENDIF.
|
|
78931
|
+
ENDLOOP.`,
|
|
78932
|
+
goodExample: `DELETE tab WHERE flag = abap_true.`,
|
|
78933
|
+
};
|
|
78934
|
+
}
|
|
78935
|
+
getConfig() {
|
|
78936
|
+
return this.conf;
|
|
78937
|
+
}
|
|
78938
|
+
setConfig(conf) {
|
|
78939
|
+
this.conf = conf;
|
|
78940
|
+
}
|
|
78941
|
+
runParsed(file) {
|
|
78942
|
+
const issues = [];
|
|
78943
|
+
const statements = file.getStatements();
|
|
78944
|
+
for (let i = 0; i < statements.length; i++) {
|
|
78945
|
+
const statement = statements[i];
|
|
78946
|
+
if (!(statement.get() instanceof Statements.DeleteInternal) || this.byTabix(statement) === false) {
|
|
78947
|
+
continue;
|
|
78948
|
+
}
|
|
78949
|
+
// DELETE TABLE and DELETE ADJACENT DUPLICATES have a keyword before the target
|
|
78950
|
+
const target = statement.findDirectExpression(Expressions.Target);
|
|
78951
|
+
if (target === undefined || statement.getChildren()[1] !== target) {
|
|
78952
|
+
continue;
|
|
78953
|
+
}
|
|
78954
|
+
const table = target.concatTokens().toUpperCase();
|
|
78955
|
+
if (this.previousReadsTable(i, statements, table) === true
|
|
78956
|
+
|| this.enclosingLoopTables(i, statements).includes(table) === false) {
|
|
78957
|
+
continue;
|
|
78958
|
+
}
|
|
78959
|
+
const message = `DELETE ${target.concatTokens()} INDEX sy-tabix inside LOOP AT the same table,`
|
|
78960
|
+
+ ` sy-tabix might not be the loop's current row`;
|
|
78961
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
|
|
78962
|
+
}
|
|
78963
|
+
return issues;
|
|
78964
|
+
}
|
|
78965
|
+
////////////////
|
|
78966
|
+
byTabix(statement) {
|
|
78967
|
+
const children = statement.getChildren();
|
|
78968
|
+
for (let i = 0; i < children.length - 1; i++) {
|
|
78969
|
+
const child = children[i];
|
|
78970
|
+
if (child instanceof token_node_1.TokenNode && child.getFirstToken().getStr().toUpperCase() === "INDEX") {
|
|
78971
|
+
return children[i + 1].concatTokens().toUpperCase() === "SY-TABIX";
|
|
78972
|
+
}
|
|
78973
|
+
}
|
|
78974
|
+
return false;
|
|
78975
|
+
}
|
|
78976
|
+
previousReadsTable(index, statements, table) {
|
|
78977
|
+
var _a;
|
|
78978
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
78979
|
+
const statement = statements[i];
|
|
78980
|
+
if (statement.get() instanceof _statement_1.Comment) {
|
|
78981
|
+
continue;
|
|
78982
|
+
}
|
|
78983
|
+
if (!(statement.get() instanceof Statements.ReadTable)) {
|
|
78984
|
+
return false;
|
|
78985
|
+
}
|
|
78986
|
+
const read = (_a = statement.findDirectExpression(Expressions.SimpleSource2)) !== null && _a !== void 0 ? _a : statement.findDirectExpression(Expressions.Source);
|
|
78987
|
+
return (read === null || read === void 0 ? void 0 : read.concatTokens().toUpperCase()) === table;
|
|
78988
|
+
}
|
|
78989
|
+
return false;
|
|
78990
|
+
}
|
|
78991
|
+
enclosingLoopTables(index, statements) {
|
|
78992
|
+
const tables = [];
|
|
78993
|
+
let depth = 0;
|
|
78994
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
78995
|
+
const statement = statements[i];
|
|
78996
|
+
const s = statement.get();
|
|
78997
|
+
if (s instanceof Statements.EndLoop) {
|
|
78998
|
+
depth++;
|
|
78999
|
+
}
|
|
79000
|
+
else if (s instanceof Statements.Loop) {
|
|
79001
|
+
if (depth === 0) {
|
|
79002
|
+
const source = statement.findDirectExpression(Expressions.LoopSource);
|
|
79003
|
+
if (source !== undefined) {
|
|
79004
|
+
tables.push(source.concatTokens().toUpperCase());
|
|
79005
|
+
}
|
|
79006
|
+
}
|
|
79007
|
+
else {
|
|
79008
|
+
depth--;
|
|
79009
|
+
}
|
|
79010
|
+
}
|
|
79011
|
+
else if (s instanceof Statements.MethodImplementation
|
|
79012
|
+
|| s instanceof Statements.Form
|
|
79013
|
+
|| s instanceof Statements.FunctionModule
|
|
79014
|
+
|| s instanceof Statements.Module) {
|
|
79015
|
+
break;
|
|
79016
|
+
}
|
|
79017
|
+
}
|
|
79018
|
+
return tables;
|
|
79019
|
+
}
|
|
79020
|
+
}
|
|
79021
|
+
exports.DeleteIndexInLoop = DeleteIndexInLoop;
|
|
79022
|
+
//# sourceMappingURL=delete_index_in_loop.js.map
|
|
79023
|
+
|
|
79024
|
+
/***/ },
|
|
79025
|
+
|
|
77641
79026
|
/***/ "../core/build/src/rules/description_empty.js"
|
|
77642
79027
|
/*!****************************************************!*\
|
|
77643
79028
|
!*** ../core/build/src/rules/description_empty.js ***!
|
|
@@ -82485,6 +83870,94 @@ exports.Exporting = Exporting;
|
|
|
82485
83870
|
|
|
82486
83871
|
/***/ },
|
|
82487
83872
|
|
|
83873
|
+
/***/ "../core/build/src/rules/final_newline.js"
|
|
83874
|
+
/*!************************************************!*\
|
|
83875
|
+
!*** ../core/build/src/rules/final_newline.js ***!
|
|
83876
|
+
\************************************************/
|
|
83877
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
83878
|
+
|
|
83879
|
+
"use strict";
|
|
83880
|
+
|
|
83881
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
83882
|
+
exports.FinalNewline = exports.FinalNewlineConf = void 0;
|
|
83883
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
83884
|
+
const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
|
|
83885
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
83886
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
83887
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
83888
|
+
const objects_1 = __webpack_require__(/*! ../objects */ "../core/build/src/objects/index.js");
|
|
83889
|
+
class FinalNewlineConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
83890
|
+
}
|
|
83891
|
+
exports.FinalNewlineConf = FinalNewlineConf;
|
|
83892
|
+
class FinalNewline {
|
|
83893
|
+
constructor() {
|
|
83894
|
+
this.conf = new FinalNewlineConf();
|
|
83895
|
+
}
|
|
83896
|
+
getMetadata() {
|
|
83897
|
+
return {
|
|
83898
|
+
key: "final_newline",
|
|
83899
|
+
title: "Final newline",
|
|
83900
|
+
shortDescription: `Checks that ABAP and XML files end with exactly one newline`,
|
|
83901
|
+
extendedInformation: `abapGit serializes every file with exactly one newline at the end. A file without it,
|
|
83902
|
+
or with empty lines at the end, is changed again on the next pull and shows up in every diff.
|
|
83903
|
+
|
|
83904
|
+
Empty files and files containing only line breaks are not checked. A carriage return before the
|
|
83905
|
+
newline is ignored, see rule line_break_style. SMIM and W3MI files and XSLT sources are not checked.`,
|
|
83906
|
+
tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
83907
|
+
badExample: `WRITE 'hello'.`,
|
|
83908
|
+
goodExample: `WRITE 'hello'.\n`,
|
|
83909
|
+
};
|
|
83910
|
+
}
|
|
83911
|
+
getConfig() {
|
|
83912
|
+
return this.conf;
|
|
83913
|
+
}
|
|
83914
|
+
setConfig(conf) {
|
|
83915
|
+
this.conf = conf;
|
|
83916
|
+
}
|
|
83917
|
+
initialize(_reg) {
|
|
83918
|
+
return this;
|
|
83919
|
+
}
|
|
83920
|
+
run(obj) {
|
|
83921
|
+
const issues = [];
|
|
83922
|
+
if (obj instanceof objects_1.MIMEObject || obj instanceof objects_1.WebMIME) {
|
|
83923
|
+
return issues;
|
|
83924
|
+
}
|
|
83925
|
+
for (const file of obj.getFiles()) {
|
|
83926
|
+
const filename = file.getFilename();
|
|
83927
|
+
if ((filename.endsWith(".abap") || filename.endsWith(".xml")) && !filename.endsWith(".xslt.source.xml")) {
|
|
83928
|
+
const issue = this.checkFile(file);
|
|
83929
|
+
if (issue) {
|
|
83930
|
+
issues.push(issue);
|
|
83931
|
+
}
|
|
83932
|
+
}
|
|
83933
|
+
}
|
|
83934
|
+
return issues;
|
|
83935
|
+
}
|
|
83936
|
+
checkFile(file) {
|
|
83937
|
+
const rows = file.getRawRows();
|
|
83938
|
+
const last = rows[rows.length - 1];
|
|
83939
|
+
if (last !== "") {
|
|
83940
|
+
const end = new position_1.Position(rows.length, last.length + 1);
|
|
83941
|
+
const fix = edit_helper_1.EditHelper.insertAt(file, end, "\n");
|
|
83942
|
+
return issue_1.Issue.atPosition(file, end, "Add newline at end of file", this.getMetadata().key, this.conf.severity, fix);
|
|
83943
|
+
}
|
|
83944
|
+
let row = rows.length - 2;
|
|
83945
|
+
while (row >= 0 && (rows[row] === "" || rows[row] === "\r")) {
|
|
83946
|
+
row--;
|
|
83947
|
+
}
|
|
83948
|
+
if (row < 0 || row === rows.length - 2) {
|
|
83949
|
+
return undefined;
|
|
83950
|
+
}
|
|
83951
|
+
const start = new position_1.Position(row + 2, 1);
|
|
83952
|
+
const fix = edit_helper_1.EditHelper.deleteRange(file, start, new position_1.Position(rows.length, 1));
|
|
83953
|
+
return issue_1.Issue.atPosition(file, start, "Remove empty lines at end of file", this.getMetadata().key, this.conf.severity, fix);
|
|
83954
|
+
}
|
|
83955
|
+
}
|
|
83956
|
+
exports.FinalNewline = FinalNewline;
|
|
83957
|
+
//# sourceMappingURL=final_newline.js.map
|
|
83958
|
+
|
|
83959
|
+
/***/ },
|
|
83960
|
+
|
|
82488
83961
|
/***/ "../core/build/src/rules/fm_global_parameters_obsolete.js"
|
|
82489
83962
|
/*!****************************************************************!*\
|
|
82490
83963
|
!*** ../core/build/src/rules/fm_global_parameters_obsolete.js ***!
|
|
@@ -82609,6 +84082,7 @@ class ForbiddenIdentifier extends _abap_rule_1.ABAPRule {
|
|
|
82609
84082
|
constructor() {
|
|
82610
84083
|
super(...arguments);
|
|
82611
84084
|
this.conf = new ForbiddenIdentifierConf();
|
|
84085
|
+
this.checks = [];
|
|
82612
84086
|
}
|
|
82613
84087
|
getMetadata() {
|
|
82614
84088
|
return {
|
|
@@ -82628,9 +84102,10 @@ https://github.com/abaplint/transpiler/blob/bda94b8b56e2b7f2f87be2168f12361aa530
|
|
|
82628
84102
|
if (this.conf.check === undefined) {
|
|
82629
84103
|
this.conf.check = [];
|
|
82630
84104
|
}
|
|
84105
|
+
this.checks = this.conf.check.map(c => new RegExp(c, "i"));
|
|
82631
84106
|
}
|
|
82632
84107
|
runParsed(file) {
|
|
82633
|
-
if (this.
|
|
84108
|
+
if (this.checks.length === 0) {
|
|
82634
84109
|
return [];
|
|
82635
84110
|
}
|
|
82636
84111
|
let ret = [];
|
|
@@ -82657,8 +84132,7 @@ https://github.com/abaplint/transpiler/blob/bda94b8b56e2b7f2f87be2168f12361aa530
|
|
|
82657
84132
|
check(token, file) {
|
|
82658
84133
|
const str = token.getStr();
|
|
82659
84134
|
const ret = [];
|
|
82660
|
-
for (const
|
|
82661
|
-
const reg = new RegExp(c, "i");
|
|
84135
|
+
for (const reg of this.checks) {
|
|
82662
84136
|
if (reg.exec(str)) {
|
|
82663
84137
|
const message = "Identifer \"" + str + "\" not allowed";
|
|
82664
84138
|
ret.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
|
|
@@ -82884,6 +84358,7 @@ exports.ForbiddenVoidTypeConf = ForbiddenVoidTypeConf;
|
|
|
82884
84358
|
class ForbiddenVoidType {
|
|
82885
84359
|
constructor() {
|
|
82886
84360
|
this.conf = new ForbiddenVoidTypeConf();
|
|
84361
|
+
this.checks = [];
|
|
82887
84362
|
}
|
|
82888
84363
|
getMetadata() {
|
|
82889
84364
|
return {
|
|
@@ -82903,13 +84378,14 @@ DATS, TIMS, DATUM, FLAG, INT4, NUMC3, NUMC4, SAP_BOOL, TEXT25, TEXT80, X255, XFE
|
|
|
82903
84378
|
if (this.conf.check === undefined) {
|
|
82904
84379
|
this.conf.check = [];
|
|
82905
84380
|
}
|
|
84381
|
+
this.checks = this.conf.check.map(c => new RegExp(c, "i"));
|
|
82906
84382
|
}
|
|
82907
84383
|
initialize(reg) {
|
|
82908
84384
|
this.reg = reg;
|
|
82909
84385
|
return this;
|
|
82910
84386
|
}
|
|
82911
84387
|
run(obj) {
|
|
82912
|
-
if (!(obj instanceof _abap_object_1.ABAPObject) || this.
|
|
84388
|
+
if (!(obj instanceof _abap_object_1.ABAPObject) || this.checks.length === 0) {
|
|
82913
84389
|
return [];
|
|
82914
84390
|
}
|
|
82915
84391
|
return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());
|
|
@@ -82952,14 +84428,7 @@ DATS, TIMS, DATUM, FLAG, INT4, NUMC3, NUMC4, SAP_BOOL, TEXT25, TEXT80, X255, XFE
|
|
|
82952
84428
|
if (name === undefined) {
|
|
82953
84429
|
return false;
|
|
82954
84430
|
}
|
|
82955
|
-
|
|
82956
|
-
const reg = new RegExp(c, "i");
|
|
82957
|
-
const match = reg.test(name);
|
|
82958
|
-
if (match === true) {
|
|
82959
|
-
return true;
|
|
82960
|
-
}
|
|
82961
|
-
}
|
|
82962
|
-
return false;
|
|
84431
|
+
return this.checks.some(reg => reg.test(name));
|
|
82963
84432
|
}
|
|
82964
84433
|
}
|
|
82965
84434
|
exports.ForbiddenVoidType = ForbiddenVoidType;
|
|
@@ -85570,6 +87039,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
85570
87039
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
85571
87040
|
__exportStar(__webpack_require__(/*! ./7bit_ascii */ "../core/build/src/rules/7bit_ascii.js"), exports);
|
|
85572
87041
|
__exportStar(__webpack_require__(/*! ./abapdoc */ "../core/build/src/rules/abapdoc.js"), exports);
|
|
87042
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_html_tag */ "../core/build/src/rules/abapdoc_html_tag.js"), exports);
|
|
87043
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_leading_at */ "../core/build/src/rules/abapdoc_leading_at.js"), exports);
|
|
87044
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_parameter_names */ "../core/build/src/rules/abapdoc_parameter_names.js"), exports);
|
|
85573
87045
|
__exportStar(__webpack_require__(/*! ./add_test_attributes */ "../core/build/src/rules/add_test_attributes.js"), exports);
|
|
85574
87046
|
__exportStar(__webpack_require__(/*! ./aff_and_xml */ "../core/build/src/rules/aff_and_xml.js"), exports);
|
|
85575
87047
|
__exportStar(__webpack_require__(/*! ./align_parameters */ "../core/build/src/rules/align_parameters.js"), exports);
|
|
@@ -85592,6 +87064,7 @@ __exportStar(__webpack_require__(/*! ./cds_naming */ "../core/build/src/rules/cd
|
|
|
85592
87064
|
__exportStar(__webpack_require__(/*! ./cds_parser_error */ "../core/build/src/rules/cds_parser_error.js"), exports);
|
|
85593
87065
|
__exportStar(__webpack_require__(/*! ./chain_mainly_declarations */ "../core/build/src/rules/chain_mainly_declarations.js"), exports);
|
|
85594
87066
|
__exportStar(__webpack_require__(/*! ./change_if_to_case */ "../core/build/src/rules/change_if_to_case.js"), exports);
|
|
87067
|
+
__exportStar(__webpack_require__(/*! ./changing_sorted_line */ "../core/build/src/rules/changing_sorted_line.js"), exports);
|
|
85595
87068
|
__exportStar(__webpack_require__(/*! ./check_abstract */ "../core/build/src/rules/check_abstract.js"), exports);
|
|
85596
87069
|
__exportStar(__webpack_require__(/*! ./check_comments */ "../core/build/src/rules/check_comments.js"), exports);
|
|
85597
87070
|
__exportStar(__webpack_require__(/*! ./check_ddic */ "../core/build/src/rules/check_ddic.js"), exports);
|
|
@@ -85614,6 +87087,7 @@ __exportStar(__webpack_require__(/*! ./cyclomatic_complexity */ "../core/build/s
|
|
|
85614
87087
|
__exportStar(__webpack_require__(/*! ./dangerous_statement */ "../core/build/src/rules/dangerous_statement.js"), exports);
|
|
85615
87088
|
__exportStar(__webpack_require__(/*! ./db_operation_in_loop */ "../core/build/src/rules/db_operation_in_loop.js"), exports);
|
|
85616
87089
|
__exportStar(__webpack_require__(/*! ./definitions_top */ "../core/build/src/rules/definitions_top.js"), exports);
|
|
87090
|
+
__exportStar(__webpack_require__(/*! ./delete_index_in_loop */ "../core/build/src/rules/delete_index_in_loop.js"), exports);
|
|
85617
87091
|
__exportStar(__webpack_require__(/*! ./description_empty */ "../core/build/src/rules/description_empty.js"), exports);
|
|
85618
87092
|
__exportStar(__webpack_require__(/*! ./double_space */ "../core/build/src/rules/double_space.js"), exports);
|
|
85619
87093
|
__exportStar(__webpack_require__(/*! ./downport */ "../core/build/src/rules/downport.js"), exports);
|
|
@@ -85627,6 +87101,7 @@ __exportStar(__webpack_require__(/*! ./else_after_all_returns */ "../core/build/
|
|
|
85627
87101
|
__exportStar(__webpack_require__(/*! ./exit_or_check */ "../core/build/src/rules/exit_or_check.js"), exports);
|
|
85628
87102
|
__exportStar(__webpack_require__(/*! ./expand_macros */ "../core/build/src/rules/expand_macros.js"), exports);
|
|
85629
87103
|
__exportStar(__webpack_require__(/*! ./exporting */ "../core/build/src/rules/exporting.js"), exports);
|
|
87104
|
+
__exportStar(__webpack_require__(/*! ./final_newline */ "../core/build/src/rules/final_newline.js"), exports);
|
|
85630
87105
|
__exportStar(__webpack_require__(/*! ./fm_global_parameters_obsolete */ "../core/build/src/rules/fm_global_parameters_obsolete.js"), exports);
|
|
85631
87106
|
__exportStar(__webpack_require__(/*! ./forbidden_identifier */ "../core/build/src/rules/forbidden_identifier.js"), exports);
|
|
85632
87107
|
__exportStar(__webpack_require__(/*! ./forbidden_pseudo_and_pragma */ "../core/build/src/rules/forbidden_pseudo_and_pragma.js"), exports);
|
|
@@ -85650,6 +87125,7 @@ __exportStar(__webpack_require__(/*! ./in_statement_indentation */ "../core/buil
|
|
|
85650
87125
|
__exportStar(__webpack_require__(/*! ./indentation */ "../core/build/src/rules/indentation.js"), exports);
|
|
85651
87126
|
__exportStar(__webpack_require__(/*! ./index_completely_contained */ "../core/build/src/rules/index_completely_contained.js"), exports);
|
|
85652
87127
|
__exportStar(__webpack_require__(/*! ./inline_data_old_versions */ "../core/build/src/rules/inline_data_old_versions.js"), exports);
|
|
87128
|
+
__exportStar(__webpack_require__(/*! ./inline_packed_computation */ "../core/build/src/rules/inline_packed_computation.js"), exports);
|
|
85653
87129
|
__exportStar(__webpack_require__(/*! ./intf_referencing_clas */ "../core/build/src/rules/intf_referencing_clas.js"), exports);
|
|
85654
87130
|
__exportStar(__webpack_require__(/*! ./invalid_table_index */ "../core/build/src/rules/invalid_table_index.js"), exports);
|
|
85655
87131
|
__exportStar(__webpack_require__(/*! ./keep_single_parameter_on_one_line */ "../core/build/src/rules/keep_single_parameter_on_one_line.js"), exports);
|
|
@@ -85701,6 +87177,7 @@ __exportStar(__webpack_require__(/*! ./parser_missing_space */ "../core/build/sr
|
|
|
85701
87177
|
__exportStar(__webpack_require__(/*! ./pragma_style */ "../core/build/src/rules/pragma_style.js"), exports);
|
|
85702
87178
|
__exportStar(__webpack_require__(/*! ./prefer_corresponding */ "../core/build/src/rules/prefer_corresponding.js"), exports);
|
|
85703
87179
|
__exportStar(__webpack_require__(/*! ./prefer_inline */ "../core/build/src/rules/prefer_inline.js"), exports);
|
|
87180
|
+
__exportStar(__webpack_require__(/*! ./prefer_inline_cast */ "../core/build/src/rules/prefer_inline_cast.js"), exports);
|
|
85704
87181
|
__exportStar(__webpack_require__(/*! ./prefer_insert_into_table */ "../core/build/src/rules/prefer_insert_into_table.js"), exports);
|
|
85705
87182
|
__exportStar(__webpack_require__(/*! ./prefer_is_not */ "../core/build/src/rules/prefer_is_not.js"), exports);
|
|
85706
87183
|
__exportStar(__webpack_require__(/*! ./prefer_pragmas */ "../core/build/src/rules/prefer_pragmas.js"), exports);
|
|
@@ -85713,6 +87190,7 @@ __exportStar(__webpack_require__(/*! ./prefer_xsdbool */ "../core/build/src/rule
|
|
|
85713
87190
|
__exportStar(__webpack_require__(/*! ./preferred_compare_operator */ "../core/build/src/rules/preferred_compare_operator.js"), exports);
|
|
85714
87191
|
__exportStar(__webpack_require__(/*! ./preferred_parameter_ignored */ "../core/build/src/rules/preferred_parameter_ignored.js"), exports);
|
|
85715
87192
|
__exportStar(__webpack_require__(/*! ./prefix_is_current_class */ "../core/build/src/rules/prefix_is_current_class.js"), exports);
|
|
87193
|
+
__exportStar(__webpack_require__(/*! ./range_row_values */ "../core/build/src/rules/range_row_values.js"), exports);
|
|
85716
87194
|
__exportStar(__webpack_require__(/*! ./reduce_procedural_code */ "../core/build/src/rules/reduce_procedural_code.js"), exports);
|
|
85717
87195
|
__exportStar(__webpack_require__(/*! ./reduce_string_templates */ "../core/build/src/rules/reduce_string_templates.js"), exports);
|
|
85718
87196
|
__exportStar(__webpack_require__(/*! ./redundant_conversion */ "../core/build/src/rules/redundant_conversion.js"), exports);
|
|
@@ -85729,6 +87207,7 @@ __exportStar(__webpack_require__(/*! ./short_case */ "../core/build/src/rules/sh
|
|
|
85729
87207
|
__exportStar(__webpack_require__(/*! ./sicf_consistency */ "../core/build/src/rules/sicf_consistency.js"), exports);
|
|
85730
87208
|
__exportStar(__webpack_require__(/*! ./slow_parameter_passing */ "../core/build/src/rules/slow_parameter_passing.js"), exports);
|
|
85731
87209
|
__exportStar(__webpack_require__(/*! ./smim_consistency */ "../core/build/src/rules/smim_consistency.js"), exports);
|
|
87210
|
+
__exportStar(__webpack_require__(/*! ./sort_empty_key */ "../core/build/src/rules/sort_empty_key.js"), exports);
|
|
85732
87211
|
__exportStar(__webpack_require__(/*! ./space_before_colon */ "../core/build/src/rules/space_before_colon.js"), exports);
|
|
85733
87212
|
__exportStar(__webpack_require__(/*! ./space_before_dot */ "../core/build/src/rules/space_before_dot.js"), exports);
|
|
85734
87213
|
__exportStar(__webpack_require__(/*! ./sql_escape_host_variables */ "../core/build/src/rules/sql_escape_host_variables.js"), exports);
|
|
@@ -85736,6 +87215,7 @@ __exportStar(__webpack_require__(/*! ./sql_value_conversion */ "../core/build/sr
|
|
|
85736
87215
|
__exportStar(__webpack_require__(/*! ./start_at_tab */ "../core/build/src/rules/start_at_tab.js"), exports);
|
|
85737
87216
|
__exportStar(__webpack_require__(/*! ./static_call_via_instance */ "../core/build/src/rules/static_call_via_instance.js"), exports);
|
|
85738
87217
|
__exportStar(__webpack_require__(/*! ./strict_sql */ "../core/build/src/rules/strict_sql.js"), exports);
|
|
87218
|
+
__exportStar(__webpack_require__(/*! ./subrc_after_assign */ "../core/build/src/rules/subrc_after_assign.js"), exports);
|
|
85739
87219
|
__exportStar(__webpack_require__(/*! ./superclass_final */ "../core/build/src/rules/superclass_final.js"), exports);
|
|
85740
87220
|
__exportStar(__webpack_require__(/*! ./superfluous_value */ "../core/build/src/rules/superfluous_value.js"), exports);
|
|
85741
87221
|
__exportStar(__webpack_require__(/*! ./sy_modification */ "../core/build/src/rules/sy_modification.js"), exports);
|
|
@@ -85958,6 +87438,236 @@ exports.InlineDataOldVersions = InlineDataOldVersions;
|
|
|
85958
87438
|
|
|
85959
87439
|
/***/ },
|
|
85960
87440
|
|
|
87441
|
+
/***/ "../core/build/src/rules/inline_packed_computation.js"
|
|
87442
|
+
/*!************************************************************!*\
|
|
87443
|
+
!*** ../core/build/src/rules/inline_packed_computation.js ***!
|
|
87444
|
+
\************************************************************/
|
|
87445
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
87446
|
+
|
|
87447
|
+
"use strict";
|
|
87448
|
+
|
|
87449
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
87450
|
+
if (k2 === undefined) k2 = k;
|
|
87451
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
87452
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
87453
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
87454
|
+
}
|
|
87455
|
+
Object.defineProperty(o, k2, desc);
|
|
87456
|
+
}) : (function(o, m, k, k2) {
|
|
87457
|
+
if (k2 === undefined) k2 = k;
|
|
87458
|
+
o[k2] = m[k];
|
|
87459
|
+
}));
|
|
87460
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
87461
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
87462
|
+
}) : function(o, v) {
|
|
87463
|
+
o["default"] = v;
|
|
87464
|
+
});
|
|
87465
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
87466
|
+
var ownKeys = function(o) {
|
|
87467
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
87468
|
+
var ar = [];
|
|
87469
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
87470
|
+
return ar;
|
|
87471
|
+
};
|
|
87472
|
+
return ownKeys(o);
|
|
87473
|
+
};
|
|
87474
|
+
return function (mod) {
|
|
87475
|
+
if (mod && mod.__esModule) return mod;
|
|
87476
|
+
var result = {};
|
|
87477
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
87478
|
+
__setModuleDefault(result, mod);
|
|
87479
|
+
return result;
|
|
87480
|
+
};
|
|
87481
|
+
})();
|
|
87482
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
87483
|
+
exports.InlinePackedComputation = exports.InlinePackedComputationConf = void 0;
|
|
87484
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
87485
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
87486
|
+
const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
87487
|
+
const constant_1 = __webpack_require__(/*! ../abap/5_syntax/expressions/constant */ "../core/build/src/abap/5_syntax/expressions/constant.js");
|
|
87488
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
87489
|
+
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
|
|
87490
|
+
const types_1 = __webpack_require__(/*! ../abap/types */ "../core/build/src/abap/types/index.js");
|
|
87491
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
87492
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
87493
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
87494
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
87495
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
87496
|
+
class InlinePackedComputationConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
87497
|
+
}
|
|
87498
|
+
exports.InlinePackedComputationConf = InlinePackedComputationConf;
|
|
87499
|
+
class InlinePackedComputation {
|
|
87500
|
+
constructor() {
|
|
87501
|
+
this.conf = new InlinePackedComputationConf();
|
|
87502
|
+
}
|
|
87503
|
+
getMetadata() {
|
|
87504
|
+
return {
|
|
87505
|
+
key: "inline_packed_computation",
|
|
87506
|
+
title: "Inline declaration from a packed computation",
|
|
87507
|
+
shortDescription: `Finds inline declarations whose value is an arithmetic expression with calculation type p`,
|
|
87508
|
+
extendedInformation: `The result of a computation with calculation type p has no length and number of decimals
|
|
87509
|
+
that a declaration could take over, so DATA( ) or FINAL( ) gets the type p LENGTH 8 DECIMALS 0 and the
|
|
87510
|
+
syntax check warns "For the result of a computation with type P, the type P(8,0) is used here implicitly".
|
|
87511
|
+
Decimals of the operands are lost, and so are digits beyond the length.
|
|
87512
|
+
|
|
87513
|
+
Reported when at least one operand is packed and all other operands are of type i, int8 or p. Operands
|
|
87514
|
+
of other types, generic or unknown types, and the operator ** are not reported.
|
|
87515
|
+
|
|
87516
|
+
Declare the variable with the operands' type, or name the type with CONV.`,
|
|
87517
|
+
tags: [],
|
|
87518
|
+
badExample: `DATA a TYPE p LENGTH 8 DECIMALS 2.
|
|
87519
|
+
DATA b TYPE p LENGTH 8 DECIMALS 2.
|
|
87520
|
+
DATA(diff) = a - b.`,
|
|
87521
|
+
goodExample: `DATA a TYPE p LENGTH 8 DECIMALS 2.
|
|
87522
|
+
DATA b TYPE p LENGTH 8 DECIMALS 2.
|
|
87523
|
+
DATA diff LIKE a.
|
|
87524
|
+
diff = a - b.`,
|
|
87525
|
+
};
|
|
87526
|
+
}
|
|
87527
|
+
getConfig() {
|
|
87528
|
+
return this.conf;
|
|
87529
|
+
}
|
|
87530
|
+
setConfig(conf) {
|
|
87531
|
+
this.conf = conf;
|
|
87532
|
+
}
|
|
87533
|
+
initialize(reg) {
|
|
87534
|
+
this.reg = reg;
|
|
87535
|
+
return this;
|
|
87536
|
+
}
|
|
87537
|
+
run(obj) {
|
|
87538
|
+
var _a, _b;
|
|
87539
|
+
if (!(obj instanceof _abap_object_1.ABAPObject)) {
|
|
87540
|
+
return [];
|
|
87541
|
+
}
|
|
87542
|
+
const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
87543
|
+
if (syntax.issues.length > 0) {
|
|
87544
|
+
return [];
|
|
87545
|
+
}
|
|
87546
|
+
const issues = [];
|
|
87547
|
+
for (const file of obj.getABAPFiles()) {
|
|
87548
|
+
for (const statement of file.getStatements()) {
|
|
87549
|
+
if (!(statement.get() instanceof Statements.Move)) {
|
|
87550
|
+
continue;
|
|
87551
|
+
}
|
|
87552
|
+
const inline = (_a = statement.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.InlineData);
|
|
87553
|
+
const name = (_b = inline === null || inline === void 0 ? void 0 : inline.findDirectExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
87554
|
+
const source = statement.findDirectExpression(Expressions.Source);
|
|
87555
|
+
if (name === undefined
|
|
87556
|
+
|| source === undefined
|
|
87557
|
+
|| source.findDirectExpression(Expressions.ArithOperator) === undefined) {
|
|
87558
|
+
continue;
|
|
87559
|
+
}
|
|
87560
|
+
const scope = syntax.spaghetti.lookupPosition(name.getStart(), file.getFilename());
|
|
87561
|
+
if (scope === undefined) {
|
|
87562
|
+
continue;
|
|
87563
|
+
}
|
|
87564
|
+
const operands = this.operandTypes(source, scope);
|
|
87565
|
+
if (operands === undefined || operands.some(t => t instanceof basic_1.PackedType) === false) {
|
|
87566
|
+
continue;
|
|
87567
|
+
}
|
|
87568
|
+
const message = `"${name.getStr()}" gets type p LENGTH 8 DECIMALS 0 from this packed computation, ` +
|
|
87569
|
+
`declare it with the operands' type or use CONV`;
|
|
87570
|
+
issues.push(issue_1.Issue.atToken(file, name, message, this.getMetadata().key, this.conf.severity));
|
|
87571
|
+
}
|
|
87572
|
+
}
|
|
87573
|
+
return issues;
|
|
87574
|
+
}
|
|
87575
|
+
/** The types of the operands of an arithmetic expression, undefined when an operand is not of type
|
|
87576
|
+
* i, int8 or p, or is not known */
|
|
87577
|
+
operandTypes(source, scope) {
|
|
87578
|
+
const ret = [];
|
|
87579
|
+
for (const child of source.getChildren()) {
|
|
87580
|
+
let found = undefined;
|
|
87581
|
+
if (child instanceof nodes_1.TokenNode) {
|
|
87582
|
+
// parentheses and a sign, anything else is a constructor expression or a string operator
|
|
87583
|
+
if (["(", ")", "+", "-"].includes(child.getFirstToken().getStr()) === false) {
|
|
87584
|
+
return undefined;
|
|
87585
|
+
}
|
|
87586
|
+
continue;
|
|
87587
|
+
}
|
|
87588
|
+
else if (child.get() instanceof Expressions.ArithOperator) {
|
|
87589
|
+
if (["+", "-", "*", "/", "DIV", "MOD"].includes(child.concatTokens().toUpperCase()) === false) {
|
|
87590
|
+
return undefined;
|
|
87591
|
+
}
|
|
87592
|
+
continue;
|
|
87593
|
+
}
|
|
87594
|
+
else if (child.get() instanceof Expressions.Source) {
|
|
87595
|
+
const nested = this.operandTypes(child, scope);
|
|
87596
|
+
if (nested === undefined) {
|
|
87597
|
+
return undefined;
|
|
87598
|
+
}
|
|
87599
|
+
ret.push(...nested);
|
|
87600
|
+
continue;
|
|
87601
|
+
}
|
|
87602
|
+
else if (child.get() instanceof Expressions.FieldChain) {
|
|
87603
|
+
found = this.fieldChainType(child, scope);
|
|
87604
|
+
}
|
|
87605
|
+
else if (child.get() instanceof Expressions.MethodCallChain) {
|
|
87606
|
+
found = this.methodCallType(child, scope);
|
|
87607
|
+
}
|
|
87608
|
+
else if (child.get() instanceof Expressions.Constant) {
|
|
87609
|
+
found = constant_1.Constant.runSyntax(child);
|
|
87610
|
+
}
|
|
87611
|
+
if (found === undefined
|
|
87612
|
+
|| found.isGeneric()
|
|
87613
|
+
|| !(found instanceof basic_1.PackedType || found instanceof basic_1.IntegerType || found instanceof basic_1.Integer8Type)) {
|
|
87614
|
+
return undefined;
|
|
87615
|
+
}
|
|
87616
|
+
ret.push(found);
|
|
87617
|
+
}
|
|
87618
|
+
return ret;
|
|
87619
|
+
}
|
|
87620
|
+
methodCallType(chain, scope) {
|
|
87621
|
+
var _a, _b, _c;
|
|
87622
|
+
const last = chain.getLastChild();
|
|
87623
|
+
if (!(last instanceof nodes_1.ExpressionNode) || !(last.get() instanceof Expressions.MethodCall)) {
|
|
87624
|
+
return undefined;
|
|
87625
|
+
}
|
|
87626
|
+
const name = (_a = last.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
87627
|
+
if (name === undefined) {
|
|
87628
|
+
return undefined;
|
|
87629
|
+
}
|
|
87630
|
+
const method = (_b = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.MethodReference
|
|
87631
|
+
&& reference.position.getStart().equals(name.getStart()))) === null || _b === void 0 ? void 0 : _b.resolved;
|
|
87632
|
+
if (!(method instanceof types_1.MethodDefinition)) {
|
|
87633
|
+
return undefined;
|
|
87634
|
+
}
|
|
87635
|
+
return (_c = method.getParameters().getReturning()) === null || _c === void 0 ? void 0 : _c.getType();
|
|
87636
|
+
}
|
|
87637
|
+
fieldChainType(fieldChain, scope) {
|
|
87638
|
+
var _a;
|
|
87639
|
+
const operand = (_a = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.DataReadReference
|
|
87640
|
+
&& reference.position.getStart().equals(fieldChain.getFirstToken().getStart()))) === null || _a === void 0 ? void 0 : _a.resolved;
|
|
87641
|
+
if (!(operand instanceof _typed_identifier_1.TypedIdentifier)) {
|
|
87642
|
+
return undefined;
|
|
87643
|
+
}
|
|
87644
|
+
let type = operand.getType();
|
|
87645
|
+
for (const child of fieldChain.getChildren()) {
|
|
87646
|
+
if (!(child instanceof nodes_1.ExpressionNode)
|
|
87647
|
+
|| child.get() instanceof Expressions.SourceField) {
|
|
87648
|
+
continue;
|
|
87649
|
+
}
|
|
87650
|
+
else if (child.get() instanceof Expressions.ComponentName) {
|
|
87651
|
+
if (type instanceof basic_1.TableType) {
|
|
87652
|
+
type = type.getRowType();
|
|
87653
|
+
}
|
|
87654
|
+
if (!(type instanceof basic_1.StructureType)) {
|
|
87655
|
+
return undefined;
|
|
87656
|
+
}
|
|
87657
|
+
type = type.getComponentByName(child.concatTokens());
|
|
87658
|
+
}
|
|
87659
|
+
else {
|
|
87660
|
+
return undefined;
|
|
87661
|
+
}
|
|
87662
|
+
}
|
|
87663
|
+
return type;
|
|
87664
|
+
}
|
|
87665
|
+
}
|
|
87666
|
+
exports.InlinePackedComputation = InlinePackedComputation;
|
|
87667
|
+
//# sourceMappingURL=inline_packed_computation.js.map
|
|
87668
|
+
|
|
87669
|
+
/***/ },
|
|
87670
|
+
|
|
85961
87671
|
/***/ "../core/build/src/rules/intf_referencing_clas.js"
|
|
85962
87672
|
/*!********************************************************!*\
|
|
85963
87673
|
!*** ../core/build/src/rules/intf_referencing_clas.js ***!
|
|
@@ -85987,6 +87697,7 @@ exports.IntfReferencingClasConf = IntfReferencingClasConf;
|
|
|
85987
87697
|
class IntfReferencingClas {
|
|
85988
87698
|
constructor() {
|
|
85989
87699
|
this.conf = new IntfReferencingClasConf();
|
|
87700
|
+
this.allow = [];
|
|
85990
87701
|
}
|
|
85991
87702
|
getMetadata() {
|
|
85992
87703
|
return {
|
|
@@ -86007,6 +87718,7 @@ class IntfReferencingClas {
|
|
|
86007
87718
|
}
|
|
86008
87719
|
setConfig(conf) {
|
|
86009
87720
|
this.conf = conf;
|
|
87721
|
+
this.allow = (this.conf.allow || []).map(reg => new RegExp(reg, "i"));
|
|
86010
87722
|
}
|
|
86011
87723
|
initialize(reg) {
|
|
86012
87724
|
this.reg = reg;
|
|
@@ -86032,7 +87744,7 @@ class IntfReferencingClas {
|
|
|
86032
87744
|
if (found && ddic.isException(found.getClassDefinition(), found)) {
|
|
86033
87745
|
continue;
|
|
86034
87746
|
}
|
|
86035
|
-
else if (this.
|
|
87747
|
+
else if (this.allow.some(reg => reg.test(r.extra.ooName))) {
|
|
86036
87748
|
continue;
|
|
86037
87749
|
}
|
|
86038
87750
|
ret.push(issue_1.Issue.atIdentifier(r.position, message + r.extra.ooName, this.getMetadata().key, this.conf.severity));
|
|
@@ -87017,7 +88729,7 @@ https://docs.abapopenchecks.org/checks/16/`,
|
|
|
87017
88729
|
}
|
|
87018
88730
|
}
|
|
87019
88731
|
const rows = file.getRawRows();
|
|
87020
|
-
const reg =
|
|
88732
|
+
const reg = /^\)?\. *(".*)?$/;
|
|
87021
88733
|
for (let i = 0; i < rows.length; i++) {
|
|
87022
88734
|
if (reg.exec(rows[i].trim())) {
|
|
87023
88735
|
const column = rows[i].indexOf(")") >= 0 ? rows[i].indexOf(")") + 1 : rows[i].indexOf(".") + 1;
|
|
@@ -87082,6 +88794,7 @@ class LocalClassNaming extends _abap_rule_1.ABAPRule {
|
|
|
87082
88794
|
constructor() {
|
|
87083
88795
|
super(...arguments);
|
|
87084
88796
|
this.conf = new LocalClassNamingConf();
|
|
88797
|
+
this.regex = this.compile();
|
|
87085
88798
|
}
|
|
87086
88799
|
getMetadata() {
|
|
87087
88800
|
return {
|
|
@@ -87105,6 +88818,15 @@ ENDCLASS.`,
|
|
|
87105
88818
|
}
|
|
87106
88819
|
setConfig(conf) {
|
|
87107
88820
|
this.conf = conf;
|
|
88821
|
+
this.regex = this.compile();
|
|
88822
|
+
}
|
|
88823
|
+
compile() {
|
|
88824
|
+
return {
|
|
88825
|
+
local: new RegExp(this.conf.local, "i"),
|
|
88826
|
+
exception: new RegExp(this.conf.exception, "i"),
|
|
88827
|
+
test: new RegExp(this.conf.test, "i"),
|
|
88828
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
88829
|
+
};
|
|
87108
88830
|
}
|
|
87109
88831
|
runParsed(file, obj) {
|
|
87110
88832
|
const issues = [];
|
|
@@ -87118,20 +88840,23 @@ ENDCLASS.`,
|
|
|
87118
88840
|
}
|
|
87119
88841
|
const className = classDef.name;
|
|
87120
88842
|
let expected;
|
|
88843
|
+
let regex;
|
|
87121
88844
|
if (classDef.isForTesting) {
|
|
87122
88845
|
expected = this.conf.test;
|
|
88846
|
+
regex = this.regex.test;
|
|
87123
88847
|
}
|
|
87124
88848
|
else if (ddic.isException(classDef, obj)) {
|
|
87125
88849
|
expected = this.conf.exception;
|
|
88850
|
+
regex = this.regex.exception;
|
|
87126
88851
|
}
|
|
87127
88852
|
else {
|
|
87128
88853
|
expected = this.conf.local;
|
|
88854
|
+
regex = this.regex.local;
|
|
87129
88855
|
}
|
|
87130
88856
|
if (expected === undefined || expected.length === 0) {
|
|
87131
88857
|
continue;
|
|
87132
88858
|
}
|
|
87133
|
-
|
|
87134
|
-
if (name_validator_1.NameValidator.violatesRule(className, regex, this.conf)) {
|
|
88859
|
+
if (name_validator_1.NameValidator.violatesRule(className, regex, this.conf, this.regex.ignorePatterns)) {
|
|
87135
88860
|
issues.push(issue_1.Issue.atIdentifier(classDef.identifier, this.getDescription(expected, className), this.getMetadata().key, this.conf.severity));
|
|
87136
88861
|
}
|
|
87137
88862
|
}
|
|
@@ -87293,6 +89018,7 @@ class LocalVariableNames extends _abap_rule_1.ABAPRule {
|
|
|
87293
89018
|
constructor() {
|
|
87294
89019
|
super(...arguments);
|
|
87295
89020
|
this.conf = new LocalVariableNamesConf();
|
|
89021
|
+
this.regex = this.compile();
|
|
87296
89022
|
}
|
|
87297
89023
|
getMetadata() {
|
|
87298
89024
|
return {
|
|
@@ -87320,6 +89046,15 @@ ENDFORM.`,
|
|
|
87320
89046
|
}
|
|
87321
89047
|
setConfig(conf) {
|
|
87322
89048
|
this.conf = conf;
|
|
89049
|
+
this.regex = this.compile();
|
|
89050
|
+
}
|
|
89051
|
+
compile() {
|
|
89052
|
+
return {
|
|
89053
|
+
expectedData: new RegExp(this.conf.expectedData, "i"),
|
|
89054
|
+
expectedConstant: new RegExp(this.conf.expectedConstant, "i"),
|
|
89055
|
+
expectedFS: new RegExp(this.conf.expectedFS, "i"),
|
|
89056
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
89057
|
+
};
|
|
87323
89058
|
}
|
|
87324
89059
|
runParsed(file) {
|
|
87325
89060
|
const ret = [];
|
|
@@ -87353,7 +89088,7 @@ ENDFORM.`,
|
|
|
87353
89088
|
const found = dat.findFirstExpression(Expressions.DefinitionName);
|
|
87354
89089
|
if (found) {
|
|
87355
89090
|
const token = found.getFirstToken();
|
|
87356
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedData));
|
|
89091
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedData, this.regex.expectedData));
|
|
87357
89092
|
}
|
|
87358
89093
|
}
|
|
87359
89094
|
// inline data
|
|
@@ -87361,7 +89096,7 @@ ENDFORM.`,
|
|
|
87361
89096
|
const found = dat.findFirstExpression(Expressions.TargetField);
|
|
87362
89097
|
if (found) {
|
|
87363
89098
|
const token = found.getFirstToken();
|
|
87364
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedData));
|
|
89099
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedData, this.regex.expectedData));
|
|
87365
89100
|
}
|
|
87366
89101
|
}
|
|
87367
89102
|
// data structures, data begin of, first level
|
|
@@ -87372,14 +89107,14 @@ ENDFORM.`,
|
|
|
87372
89107
|
const found = stat === null || stat === void 0 ? void 0 : stat.findFirstExpression(Expressions.DefinitionName);
|
|
87373
89108
|
if (found) {
|
|
87374
89109
|
const token = found.getFirstToken();
|
|
87375
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedData));
|
|
89110
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedData, this.regex.expectedData));
|
|
87376
89111
|
}
|
|
87377
89112
|
}
|
|
87378
89113
|
for (const fieldsymbol of structure.findAllStatements(Statements.FieldSymbol)) {
|
|
87379
89114
|
const found = fieldsymbol.findFirstExpression(Expressions.FieldSymbol);
|
|
87380
89115
|
if (found) {
|
|
87381
89116
|
const token = found.getFirstToken();
|
|
87382
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));
|
|
89117
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedFS, this.regex.expectedFS));
|
|
87383
89118
|
}
|
|
87384
89119
|
}
|
|
87385
89120
|
// inline field symbols
|
|
@@ -87387,7 +89122,7 @@ ENDFORM.`,
|
|
|
87387
89122
|
const found = fieldsymbol.findFirstExpression(Expressions.TargetFieldSymbol);
|
|
87388
89123
|
if (found) {
|
|
87389
89124
|
const token = found.getFirstToken();
|
|
87390
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));
|
|
89125
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedFS, this.regex.expectedFS));
|
|
87391
89126
|
}
|
|
87392
89127
|
}
|
|
87393
89128
|
const constants = structure.findAllStatements(Statements.Constant);
|
|
@@ -87399,16 +89134,15 @@ ENDFORM.`,
|
|
|
87399
89134
|
const found = constant.findFirstExpression(Expressions.DefinitionName);
|
|
87400
89135
|
if (found) {
|
|
87401
89136
|
const token = found.getFirstToken();
|
|
87402
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedConstant));
|
|
89137
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedConstant, this.regex.expectedConstant));
|
|
87403
89138
|
}
|
|
87404
89139
|
}
|
|
87405
89140
|
return ret;
|
|
87406
89141
|
}
|
|
87407
|
-
checkName(token, file, expected) {
|
|
89142
|
+
checkName(token, file, expected, regex) {
|
|
87408
89143
|
const ret = [];
|
|
87409
|
-
const regex = new RegExp(expected, "i");
|
|
87410
89144
|
const name = token.getStr();
|
|
87411
|
-
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {
|
|
89145
|
+
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf, this.regex.ignorePatterns)) {
|
|
87412
89146
|
const message = this.getDescription(expected, name);
|
|
87413
89147
|
const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);
|
|
87414
89148
|
ret.push(issue);
|
|
@@ -87483,6 +89217,7 @@ class MacroNaming extends _abap_rule_1.ABAPRule {
|
|
|
87483
89217
|
constructor() {
|
|
87484
89218
|
super(...arguments);
|
|
87485
89219
|
this.conf = new MacroNamingConf();
|
|
89220
|
+
this.regex = new RegExp(this.conf.pattern, "i");
|
|
87486
89221
|
}
|
|
87487
89222
|
getMetadata() {
|
|
87488
89223
|
return {
|
|
@@ -87502,10 +89237,10 @@ END-OF-DEFINITION.`,
|
|
|
87502
89237
|
}
|
|
87503
89238
|
setConfig(conf) {
|
|
87504
89239
|
this.conf = conf;
|
|
89240
|
+
this.regex = new RegExp(this.conf.pattern, "i");
|
|
87505
89241
|
}
|
|
87506
89242
|
runParsed(file, obj) {
|
|
87507
89243
|
const issues = [];
|
|
87508
|
-
const testRegex = new RegExp(this.conf.pattern, "i");
|
|
87509
89244
|
if (obj instanceof objects_1.TypePool) {
|
|
87510
89245
|
return [];
|
|
87511
89246
|
}
|
|
@@ -87518,7 +89253,7 @@ END-OF-DEFINITION.`,
|
|
|
87518
89253
|
continue;
|
|
87519
89254
|
}
|
|
87520
89255
|
const token = expr.getFirstToken();
|
|
87521
|
-
if (
|
|
89256
|
+
if (this.regex.exec(token.getStr())) {
|
|
87522
89257
|
continue;
|
|
87523
89258
|
}
|
|
87524
89259
|
else {
|
|
@@ -88657,6 +90392,7 @@ exports.MethodParameterNamesConf = MethodParameterNamesConf;
|
|
|
88657
90392
|
class MethodParameterNames {
|
|
88658
90393
|
constructor() {
|
|
88659
90394
|
this.conf = new MethodParameterNamesConf();
|
|
90395
|
+
this.regex = this.compile();
|
|
88660
90396
|
}
|
|
88661
90397
|
getMetadata() {
|
|
88662
90398
|
return {
|
|
@@ -88682,6 +90418,16 @@ class MethodParameterNames {
|
|
|
88682
90418
|
}
|
|
88683
90419
|
setConfig(conf) {
|
|
88684
90420
|
this.conf = conf;
|
|
90421
|
+
this.regex = this.compile();
|
|
90422
|
+
}
|
|
90423
|
+
compile() {
|
|
90424
|
+
return {
|
|
90425
|
+
importing: new RegExp(this.conf.importing, "i"),
|
|
90426
|
+
returning: new RegExp(this.conf.returning, "i"),
|
|
90427
|
+
changing: new RegExp(this.conf.changing, "i"),
|
|
90428
|
+
exporting: new RegExp(this.conf.exporting, "i"),
|
|
90429
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
90430
|
+
};
|
|
88685
90431
|
}
|
|
88686
90432
|
initialize(reg) {
|
|
88687
90433
|
this.reg = reg;
|
|
@@ -88721,16 +90467,16 @@ class MethodParameterNames {
|
|
|
88721
90467
|
for (const p of method.parameters) {
|
|
88722
90468
|
switch (p.direction) {
|
|
88723
90469
|
case _abap_file_information_1.MethodParameterDirection.Importing:
|
|
88724
|
-
ret = ret.concat(this.checkParameter(p, this.conf.importing));
|
|
90470
|
+
ret = ret.concat(this.checkParameter(p, this.conf.importing, this.regex.importing));
|
|
88725
90471
|
break;
|
|
88726
90472
|
case _abap_file_information_1.MethodParameterDirection.Exporting:
|
|
88727
|
-
ret = ret.concat(this.checkParameter(p, this.conf.exporting));
|
|
90473
|
+
ret = ret.concat(this.checkParameter(p, this.conf.exporting, this.regex.exporting));
|
|
88728
90474
|
break;
|
|
88729
90475
|
case _abap_file_information_1.MethodParameterDirection.Changing:
|
|
88730
|
-
ret = ret.concat(this.checkParameter(p, this.conf.changing));
|
|
90476
|
+
ret = ret.concat(this.checkParameter(p, this.conf.changing, this.regex.changing));
|
|
88731
90477
|
break;
|
|
88732
90478
|
case _abap_file_information_1.MethodParameterDirection.Returning:
|
|
88733
|
-
ret = ret.concat(this.checkParameter(p, this.conf.returning));
|
|
90479
|
+
ret = ret.concat(this.checkParameter(p, this.conf.returning, this.regex.returning));
|
|
88734
90480
|
break;
|
|
88735
90481
|
default:
|
|
88736
90482
|
break;
|
|
@@ -88738,11 +90484,10 @@ class MethodParameterNames {
|
|
|
88738
90484
|
}
|
|
88739
90485
|
return ret;
|
|
88740
90486
|
}
|
|
88741
|
-
checkParameter(param, expected) {
|
|
90487
|
+
checkParameter(param, expected, regex) {
|
|
88742
90488
|
const ret = [];
|
|
88743
|
-
const regex = new RegExp(expected, "i");
|
|
88744
90489
|
const name = param.name;
|
|
88745
|
-
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {
|
|
90490
|
+
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf, this.regex.ignorePatterns)) {
|
|
88746
90491
|
const message = this.getDescription(expected, name);
|
|
88747
90492
|
const issue = issue_1.Issue.atIdentifier(param.identifier, message, this.getMetadata().key, this.conf.severity);
|
|
88748
90493
|
ret.push(issue);
|
|
@@ -88927,6 +90672,7 @@ exports.ModifyOnlyOwnDBTablesConf = ModifyOnlyOwnDBTablesConf;
|
|
|
88927
90672
|
class ModifyOnlyOwnDBTables {
|
|
88928
90673
|
constructor() {
|
|
88929
90674
|
this.conf = new ModifyOnlyOwnDBTablesConf();
|
|
90675
|
+
this.ownTables = new RegExp(this.conf.ownTables, "i");
|
|
88930
90676
|
}
|
|
88931
90677
|
getMetadata() {
|
|
88932
90678
|
return {
|
|
@@ -88944,6 +90690,7 @@ class ModifyOnlyOwnDBTables {
|
|
|
88944
90690
|
}
|
|
88945
90691
|
setConfig(conf) {
|
|
88946
90692
|
this.conf = conf;
|
|
90693
|
+
this.ownTables = new RegExp(this.conf.ownTables, "i");
|
|
88947
90694
|
}
|
|
88948
90695
|
initialize(reg) {
|
|
88949
90696
|
this.reg = reg;
|
|
@@ -88961,7 +90708,6 @@ class ModifyOnlyOwnDBTables {
|
|
|
88961
90708
|
if (struc === undefined) {
|
|
88962
90709
|
return [];
|
|
88963
90710
|
}
|
|
88964
|
-
const regExp = new RegExp(this.getConfig().ownTables, "i");
|
|
88965
90711
|
for (const s of file.getStatements()) {
|
|
88966
90712
|
const g = s.get();
|
|
88967
90713
|
if (g instanceof Statements.DeleteDatabase
|
|
@@ -88979,7 +90725,7 @@ class ModifyOnlyOwnDBTables {
|
|
|
88979
90725
|
continue;
|
|
88980
90726
|
}
|
|
88981
90727
|
const concat = databaseTable.concatTokens().toUpperCase();
|
|
88982
|
-
if (
|
|
90728
|
+
if (this.ownTables.test(concat) === false) {
|
|
88983
90729
|
// must contain a ReferenceType.TableVoidReference or a ReferenceType.TableReference if its a dependency
|
|
88984
90730
|
if (spaghetti === undefined) {
|
|
88985
90731
|
spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
|
|
@@ -90681,6 +92427,7 @@ class NoPrefixes extends _abap_rule_1.ABAPRule {
|
|
|
90681
92427
|
constructor() {
|
|
90682
92428
|
super(...arguments);
|
|
90683
92429
|
this.conf = new NoPrefixesConf();
|
|
92430
|
+
this.regex = this.compile();
|
|
90684
92431
|
}
|
|
90685
92432
|
getMetadata() {
|
|
90686
92433
|
return {
|
|
@@ -90704,6 +92451,18 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
|
|
|
90704
92451
|
}
|
|
90705
92452
|
setConfig(conf) {
|
|
90706
92453
|
this.conf = conf;
|
|
92454
|
+
this.regex = this.compile();
|
|
92455
|
+
}
|
|
92456
|
+
compile() {
|
|
92457
|
+
const compile = (pattern) => pattern !== undefined && pattern !== "" ? new RegExp(pattern, "i") : undefined;
|
|
92458
|
+
return {
|
|
92459
|
+
data: compile(this.conf.data),
|
|
92460
|
+
statics: compile(this.conf.statics),
|
|
92461
|
+
fieldSymbols: compile(this.conf.fieldSymbols),
|
|
92462
|
+
constants: compile(this.conf.constants),
|
|
92463
|
+
types: compile(this.conf.types),
|
|
92464
|
+
methodParameters: compile(this.conf.methodParameters),
|
|
92465
|
+
};
|
|
90707
92466
|
}
|
|
90708
92467
|
runParsed(file) {
|
|
90709
92468
|
const ret = [];
|
|
@@ -90717,38 +92476,38 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
|
|
|
90717
92476
|
if (max === undefined || max < 1) {
|
|
90718
92477
|
max = 10;
|
|
90719
92478
|
}
|
|
90720
|
-
if (
|
|
90721
|
-
ret.push(...this.checkData(structure,
|
|
92479
|
+
if (this.regex.data !== undefined) {
|
|
92480
|
+
ret.push(...this.checkData(structure, this.regex.data, file));
|
|
90722
92481
|
}
|
|
90723
92482
|
if (ret.length >= max) {
|
|
90724
92483
|
return ret;
|
|
90725
92484
|
}
|
|
90726
|
-
if (
|
|
90727
|
-
ret.push(...this.checkStatics(structure,
|
|
92485
|
+
if (this.regex.statics !== undefined) {
|
|
92486
|
+
ret.push(...this.checkStatics(structure, this.regex.statics, file));
|
|
90728
92487
|
}
|
|
90729
92488
|
if (ret.length >= max) {
|
|
90730
92489
|
return ret;
|
|
90731
92490
|
}
|
|
90732
|
-
if (
|
|
90733
|
-
ret.push(...this.checkFieldSymbols(structure,
|
|
92491
|
+
if (this.regex.fieldSymbols !== undefined) {
|
|
92492
|
+
ret.push(...this.checkFieldSymbols(structure, this.regex.fieldSymbols, file));
|
|
90734
92493
|
}
|
|
90735
92494
|
if (ret.length >= max) {
|
|
90736
92495
|
return ret;
|
|
90737
92496
|
}
|
|
90738
|
-
if (
|
|
90739
|
-
ret.push(...this.checkConstants(structure,
|
|
92497
|
+
if (this.regex.constants !== undefined) {
|
|
92498
|
+
ret.push(...this.checkConstants(structure, this.regex.constants, file));
|
|
90740
92499
|
}
|
|
90741
92500
|
if (ret.length >= max) {
|
|
90742
92501
|
return ret;
|
|
90743
92502
|
}
|
|
90744
|
-
if (
|
|
90745
|
-
ret.push(...this.checkTypes(structure,
|
|
92503
|
+
if (this.regex.types !== undefined) {
|
|
92504
|
+
ret.push(...this.checkTypes(structure, this.regex.types, file));
|
|
90746
92505
|
}
|
|
90747
92506
|
if (ret.length >= max) {
|
|
90748
92507
|
return ret;
|
|
90749
92508
|
}
|
|
90750
|
-
if (
|
|
90751
|
-
ret.push(...this.checkMethodParameters(structure,
|
|
92509
|
+
if (this.regex.methodParameters !== undefined) {
|
|
92510
|
+
ret.push(...this.checkMethodParameters(structure, this.regex.methodParameters, file));
|
|
90752
92511
|
}
|
|
90753
92512
|
return ret;
|
|
90754
92513
|
}
|
|
@@ -91303,6 +93062,7 @@ exports.ObjectNamingConf = ObjectNamingConf;
|
|
|
91303
93062
|
class ObjectNaming {
|
|
91304
93063
|
constructor() {
|
|
91305
93064
|
this.conf = new ObjectNamingConf();
|
|
93065
|
+
this.regex = this.compile();
|
|
91306
93066
|
}
|
|
91307
93067
|
getMetadata() {
|
|
91308
93068
|
return {
|
|
@@ -91325,6 +93085,20 @@ class ObjectNaming {
|
|
|
91325
93085
|
}
|
|
91326
93086
|
setConfig(conf) {
|
|
91327
93087
|
this.conf = conf;
|
|
93088
|
+
this.regex = this.compile();
|
|
93089
|
+
}
|
|
93090
|
+
compile() {
|
|
93091
|
+
const config = this.getConfig();
|
|
93092
|
+
const patterns = new Map();
|
|
93093
|
+
for (const [key, value] of Object.entries(config)) {
|
|
93094
|
+
if (typeof value === "string" && key !== "patternKind" && key !== "severity") {
|
|
93095
|
+
patterns.set(key, new RegExp(value, "i"));
|
|
93096
|
+
}
|
|
93097
|
+
}
|
|
93098
|
+
return {
|
|
93099
|
+
patterns,
|
|
93100
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(config),
|
|
93101
|
+
};
|
|
91328
93102
|
}
|
|
91329
93103
|
initialize(_reg) {
|
|
91330
93104
|
return this;
|
|
@@ -91338,11 +93112,11 @@ class ObjectNaming {
|
|
|
91338
93112
|
const config = this.getConfig();
|
|
91339
93113
|
// @ts-ignore
|
|
91340
93114
|
const pattern = config[abapType];
|
|
91341
|
-
|
|
93115
|
+
const regex = this.regex.patterns.get(abapType);
|
|
93116
|
+
if (pattern === undefined || regex === undefined) {
|
|
91342
93117
|
return [];
|
|
91343
93118
|
}
|
|
91344
|
-
|
|
91345
|
-
if (name_validator_1.NameValidator.violatesRule(obj.getName(), regex, this.conf)) {
|
|
93119
|
+
if (name_validator_1.NameValidator.violatesRule(obj.getName(), regex, this.conf, this.regex.ignorePatterns)) {
|
|
91346
93120
|
message = this.getDescription(pattern, obj.getName());
|
|
91347
93121
|
}
|
|
91348
93122
|
if (message) {
|
|
@@ -93788,6 +95562,292 @@ exports.PreferInline = PreferInline;
|
|
|
93788
95562
|
|
|
93789
95563
|
/***/ },
|
|
93790
95564
|
|
|
95565
|
+
/***/ "../core/build/src/rules/prefer_inline_cast.js"
|
|
95566
|
+
/*!*****************************************************!*\
|
|
95567
|
+
!*** ../core/build/src/rules/prefer_inline_cast.js ***!
|
|
95568
|
+
\*****************************************************/
|
|
95569
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
95570
|
+
|
|
95571
|
+
"use strict";
|
|
95572
|
+
|
|
95573
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
95574
|
+
if (k2 === undefined) k2 = k;
|
|
95575
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
95576
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
95577
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
95578
|
+
}
|
|
95579
|
+
Object.defineProperty(o, k2, desc);
|
|
95580
|
+
}) : (function(o, m, k, k2) {
|
|
95581
|
+
if (k2 === undefined) k2 = k;
|
|
95582
|
+
o[k2] = m[k];
|
|
95583
|
+
}));
|
|
95584
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
95585
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
95586
|
+
}) : function(o, v) {
|
|
95587
|
+
o["default"] = v;
|
|
95588
|
+
});
|
|
95589
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
95590
|
+
var ownKeys = function(o) {
|
|
95591
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
95592
|
+
var ar = [];
|
|
95593
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
95594
|
+
return ar;
|
|
95595
|
+
};
|
|
95596
|
+
return ownKeys(o);
|
|
95597
|
+
};
|
|
95598
|
+
return function (mod) {
|
|
95599
|
+
if (mod && mod.__esModule) return mod;
|
|
95600
|
+
var result = {};
|
|
95601
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
95602
|
+
__setModuleDefault(result, mod);
|
|
95603
|
+
return result;
|
|
95604
|
+
};
|
|
95605
|
+
})();
|
|
95606
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
95607
|
+
exports.PreferInlineCast = exports.PreferInlineCastConf = void 0;
|
|
95608
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
95609
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
95610
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
95611
|
+
const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
95612
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
95613
|
+
const _identifier_1 = __webpack_require__(/*! ../abap/4_file_information/_identifier */ "../core/build/src/abap/4_file_information/_identifier.js");
|
|
95614
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
95615
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
95616
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
95617
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
95618
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
95619
|
+
const version_1 = __webpack_require__(/*! ../version */ "../core/build/src/version.js");
|
|
95620
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
95621
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
95622
|
+
class PreferInlineCastConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
95623
|
+
}
|
|
95624
|
+
exports.PreferInlineCastConf = PreferInlineCastConf;
|
|
95625
|
+
class PreferInlineCast {
|
|
95626
|
+
constructor() {
|
|
95627
|
+
this.conf = new PreferInlineCastConf();
|
|
95628
|
+
}
|
|
95629
|
+
getMetadata() {
|
|
95630
|
+
return {
|
|
95631
|
+
key: "prefer_inline_cast",
|
|
95632
|
+
title: "Prefer Inline CAST",
|
|
95633
|
+
shortDescription: `Inline a CAST helper read only once in the next statement`,
|
|
95634
|
+
extendedInformation: `Requires 7.40 SP02 or above, or ABAP Cloud, and no syntax errors.
|
|
95635
|
+
|
|
95636
|
+
Reports DATA(t) = CAST type( source ) when the helper has exactly one read and no other access,
|
|
95637
|
+
except its declaration write, in the entire syntax scope (including earlier reads in loop bodies and exception handlers).
|
|
95638
|
+
The immediately following statement must be a plain assignment, an attribute read, a receiver method call,
|
|
95639
|
+
or a named IMPORTING argument of a functional method call (caller syntax p = t).
|
|
95640
|
+
|
|
95641
|
+
Only class/interface CAST targets, simple assignment targets and static access are supported.
|
|
95642
|
+
For argument uses, the CAST operand must be a plain field chain without calls, the receiver and all
|
|
95643
|
+
other arguments must be plain variables or literals, and the method signature must be known.
|
|
95644
|
+
Explicit EXPORTING, IMPORTING and CHANGING sections are not supported.
|
|
95645
|
+
Objects containing macros or dynamic access are skipped. Field symbols, reference-taking,
|
|
95646
|
+
pragmas and chained statements are not supported.
|
|
95647
|
+
|
|
95648
|
+
Predicates such as IS INITIAL / IS BOUND and removal of statically redundant CASTs are left for a future version.`,
|
|
95649
|
+
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
95650
|
+
badExample: `DATA(helper) = CAST lcl_node( object ).
|
|
95651
|
+
result = helper->get_tokens( ).`,
|
|
95652
|
+
goodExample: `result = CAST lcl_node( object )->get_tokens( ).`,
|
|
95653
|
+
};
|
|
95654
|
+
}
|
|
95655
|
+
getConfig() {
|
|
95656
|
+
return this.conf;
|
|
95657
|
+
}
|
|
95658
|
+
setConfig(conf) {
|
|
95659
|
+
this.conf = conf;
|
|
95660
|
+
}
|
|
95661
|
+
initialize(reg) {
|
|
95662
|
+
this.reg = reg;
|
|
95663
|
+
return this;
|
|
95664
|
+
}
|
|
95665
|
+
run(obj) {
|
|
95666
|
+
var _a;
|
|
95667
|
+
if (!(obj instanceof _abap_object_1.ABAPObject)
|
|
95668
|
+
|| (!(0, version_1.releaseAtLeast)(this.reg.getConfig().getRelease(), version_1.Release.v740sp02)
|
|
95669
|
+
&& this.reg.getConfig().getLanguageVersion() !== version_1.LanguageVersion.Cloud)) {
|
|
95670
|
+
return [];
|
|
95671
|
+
}
|
|
95672
|
+
// Neither macro expansion nor a dynamically named variable has reliable references.
|
|
95673
|
+
let hasCast = false;
|
|
95674
|
+
for (const file of obj.getABAPFiles()) {
|
|
95675
|
+
for (const statement of file.getStatements()) {
|
|
95676
|
+
hasCast || (hasCast = statement.findFirstExpression(Expressions.Cast) !== undefined);
|
|
95677
|
+
const type = statement.get();
|
|
95678
|
+
if (type instanceof _statement_1.Unknown || type instanceof Statements.Define
|
|
95679
|
+
|| type instanceof _statement_1.MacroCall || type instanceof _statement_1.MacroContent || type instanceof _statement_1.MacroRecursion
|
|
95680
|
+
|| statement.findFirstExpression(Expressions.Dynamic) !== undefined) {
|
|
95681
|
+
return [];
|
|
95682
|
+
}
|
|
95683
|
+
}
|
|
95684
|
+
}
|
|
95685
|
+
if (!hasCast) {
|
|
95686
|
+
return [];
|
|
95687
|
+
}
|
|
95688
|
+
const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
95689
|
+
if (syntax.issues.length > 0) {
|
|
95690
|
+
return [];
|
|
95691
|
+
}
|
|
95692
|
+
const references = new Map();
|
|
95693
|
+
const knownMethods = new Set();
|
|
95694
|
+
for (const reference of this.references(syntax.spaghetti.getTop())) {
|
|
95695
|
+
if (reference.resolved === undefined) {
|
|
95696
|
+
continue;
|
|
95697
|
+
}
|
|
95698
|
+
const key = this.identifierKey(reference.resolved);
|
|
95699
|
+
const uses = references.get(key) || [];
|
|
95700
|
+
uses.push(reference);
|
|
95701
|
+
references.set(key, uses);
|
|
95702
|
+
if (reference.referenceType === _reference_1.ReferenceType.MethodReference) {
|
|
95703
|
+
knownMethods.add(this.identifierKey(reference.position));
|
|
95704
|
+
}
|
|
95705
|
+
}
|
|
95706
|
+
const issues = [];
|
|
95707
|
+
for (const file of obj.getABAPFiles()) {
|
|
95708
|
+
const statements = file.getStatements();
|
|
95709
|
+
for (let index = 0; index < statements.length - 1; index++) {
|
|
95710
|
+
const declaration = statements[index];
|
|
95711
|
+
const next = statements[index + 1];
|
|
95712
|
+
const cast = this.castDeclaration(declaration);
|
|
95713
|
+
const inline = declaration.findFirstExpression(Expressions.InlineData);
|
|
95714
|
+
const name = (_a = inline === null || inline === void 0 ? void 0 : inline.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
95715
|
+
if (cast === undefined || name === undefined) {
|
|
95716
|
+
continue;
|
|
95717
|
+
}
|
|
95718
|
+
const scope = syntax.spaghetti.lookupPosition(name.getStart(), file.getFilename());
|
|
95719
|
+
const identifier = scope === null || scope === void 0 ? void 0 : scope.findVariable(name.getStr());
|
|
95720
|
+
if (!(identifier instanceof _typed_identifier_1.TypedIdentifier) || !(identifier.getType() instanceof basic_1.ObjectReferenceType)
|
|
95721
|
+
|| identifier.getType().containsVoid()
|
|
95722
|
+
|| identifier.getType().isGeneric()) {
|
|
95723
|
+
continue;
|
|
95724
|
+
}
|
|
95725
|
+
const uses = references.get(this.identifierKey(identifier)) || [];
|
|
95726
|
+
const reads = uses.filter(r => r.referenceType === _reference_1.ReferenceType.DataReadReference);
|
|
95727
|
+
const writes = uses.filter(r => r.referenceType === _reference_1.ReferenceType.DataWriteReference);
|
|
95728
|
+
if (reads.length !== 1 || writes.length !== 1
|
|
95729
|
+
|| !declaration.includesToken(writes[0].position.getToken())
|
|
95730
|
+
|| uses.length !== 2 || !next.includesToken(reads[0].position.getToken())
|
|
95731
|
+
|| !this.supportedUse(next, reads[0].position, knownMethods, cast)) {
|
|
95732
|
+
continue;
|
|
95733
|
+
}
|
|
95734
|
+
// Replace the later occurrence first, also when both statements are on the same line.
|
|
95735
|
+
const fix = edit_helper_1.EditHelper.merge(edit_helper_1.EditHelper.replaceToken(file, reads[0].position.getToken(), cast.concatTokensWithLinebreaks()), edit_helper_1.EditHelper.deleteStatement(file, declaration));
|
|
95736
|
+
issues.push(issue_1.Issue.atToken(file, name, "Inline single-use CAST helper", this.getMetadata().key, this.conf.severity, fix));
|
|
95737
|
+
}
|
|
95738
|
+
}
|
|
95739
|
+
return issues;
|
|
95740
|
+
}
|
|
95741
|
+
identifierKey(identifier) {
|
|
95742
|
+
const start = identifier.getStart();
|
|
95743
|
+
return identifier.getFilename() + "," + start.getRow() + "," + start.getCol();
|
|
95744
|
+
}
|
|
95745
|
+
references(node) {
|
|
95746
|
+
return node.getData().references.concat(...node.getChildren().map(child => this.references(child)));
|
|
95747
|
+
}
|
|
95748
|
+
castDeclaration(statement) {
|
|
95749
|
+
var _a;
|
|
95750
|
+
if (!(statement.get() instanceof Statements.Move) || statement.getColon() !== undefined
|
|
95751
|
+
|| statement.getPragmas().length > 0) {
|
|
95752
|
+
return undefined;
|
|
95753
|
+
}
|
|
95754
|
+
const target = statement.findDirectExpression(Expressions.Target);
|
|
95755
|
+
const source = statement.findDirectExpression(Expressions.Source);
|
|
95756
|
+
const chain = source === null || source === void 0 ? void 0 : source.findDirectExpression(Expressions.MethodCallChain);
|
|
95757
|
+
const cast = chain === null || chain === void 0 ? void 0 : chain.findDirectExpression(Expressions.Cast);
|
|
95758
|
+
if ((target === null || target === void 0 ? void 0 : target.getChildren().length) !== 1 || target.findDirectExpression(Expressions.InlineData) === undefined
|
|
95759
|
+
|| (source === null || source === void 0 ? void 0 : source.getChildren().length) !== 1 || (chain === null || chain === void 0 ? void 0 : chain.getChildren().length) !== 1
|
|
95760
|
+
|| cast === undefined || cast.findDirectExpression(Expressions.Let) !== undefined
|
|
95761
|
+
|| cast.findDirectExpression(Expressions.Dereference) !== undefined
|
|
95762
|
+
|| ((_a = cast.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === "#"
|
|
95763
|
+
|| statement.findFirstExpression(Expressions.SourceFieldSymbol) !== undefined
|
|
95764
|
+
|| statement.getTokens().length !== target.countTokens() + source.countTokens() + 2
|
|
95765
|
+
|| statement.getTokens()[target.countTokens()].getStr() !== "=") {
|
|
95766
|
+
return undefined;
|
|
95767
|
+
}
|
|
95768
|
+
return cast;
|
|
95769
|
+
}
|
|
95770
|
+
supportedUse(statement, read, knownMethods, cast) {
|
|
95771
|
+
var _a, _b, _c;
|
|
95772
|
+
if (statement.getColon() !== undefined || statement.getPragmas().length > 0
|
|
95773
|
+
|| statement.findFirstExpression(Expressions.SourceFieldSymbol) !== undefined
|
|
95774
|
+
|| statement.findFirstExpression(Expressions.MethodParameters) !== undefined) {
|
|
95775
|
+
return false;
|
|
95776
|
+
}
|
|
95777
|
+
let chain;
|
|
95778
|
+
if (statement.get() instanceof Statements.Move) {
|
|
95779
|
+
const target = statement.findDirectExpression(Expressions.Target);
|
|
95780
|
+
const source = statement.findDirectExpression(Expressions.Source);
|
|
95781
|
+
if (target === undefined || source === undefined || !this.simpleTarget(target)
|
|
95782
|
+
|| statement.getTokens().length !== target.countTokens() + source.countTokens() + 2
|
|
95783
|
+
|| statement.getTokens()[target.countTokens()].getStr() !== "="
|
|
95784
|
+
|| source.getChildren().length !== 1) {
|
|
95785
|
+
return false;
|
|
95786
|
+
}
|
|
95787
|
+
const field = source.findDirectExpression(Expressions.FieldChain);
|
|
95788
|
+
if (field !== undefined) {
|
|
95789
|
+
const tokens = field.getTokens();
|
|
95790
|
+
return field.getFirstToken().getStart().equals(read.getStart())
|
|
95791
|
+
&& (tokens.length === 1 || (tokens.length === 3 && tokens[1].getStr() === "->"
|
|
95792
|
+
&& field.findDirectExpression(Expressions.AttributeName) !== undefined));
|
|
95793
|
+
}
|
|
95794
|
+
chain = source.findDirectExpression(Expressions.MethodCallChain);
|
|
95795
|
+
}
|
|
95796
|
+
else if (statement.get() instanceof Statements.Call) {
|
|
95797
|
+
chain = statement.findDirectExpression(Expressions.MethodCallChain);
|
|
95798
|
+
}
|
|
95799
|
+
if (chain === undefined) {
|
|
95800
|
+
return false;
|
|
95801
|
+
}
|
|
95802
|
+
const calls = chain.findDirectExpressions(Expressions.MethodCall);
|
|
95803
|
+
const receiver = chain.findDirectExpression(Expressions.FieldChain);
|
|
95804
|
+
if (calls.length !== 1 || (chain.getChildren().length !== 1 && chain.getChildren().length !== 3)
|
|
95805
|
+
|| (receiver !== undefined && receiver.countTokens() !== 1)) {
|
|
95806
|
+
return false;
|
|
95807
|
+
}
|
|
95808
|
+
if (receiver === null || receiver === void 0 ? void 0 : receiver.getFirstToken().getStart().equals(read.getStart())) {
|
|
95809
|
+
// The receiver is evaluated first; even calls in its arguments stay after the CAST.
|
|
95810
|
+
return true;
|
|
95811
|
+
}
|
|
95812
|
+
// Named argument uses are limited to functional calls with a known signature.
|
|
95813
|
+
const method = (_a = calls[0].findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
95814
|
+
if (!(statement.get() instanceof Statements.Move) || method === undefined
|
|
95815
|
+
|| !this.plainCastOperand(cast)
|
|
95816
|
+
|| !knownMethods.has(this.identifierKey(new _identifier_1.Identifier(method, read.getFilename())))) {
|
|
95817
|
+
return false;
|
|
95818
|
+
}
|
|
95819
|
+
const parameters = (_c = (_b = calls[0].findDirectExpression(Expressions.MethodCallParam)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.ParameterListS)) === null || _c === void 0 ? void 0 : _c.findDirectExpressions(Expressions.ParameterS);
|
|
95820
|
+
return parameters !== undefined && parameters.some(p => { var _a; return (_a = p.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStart().equals(read.getStart()); })
|
|
95821
|
+
&& parameters.every(p => this.plainSource(p.findDirectExpression(Expressions.Source)));
|
|
95822
|
+
}
|
|
95823
|
+
plainCastOperand(cast) {
|
|
95824
|
+
// Unlike receiver uses, argument uses can evaluate the receiver before the CAST operand.
|
|
95825
|
+
// Exclude calls, table expressions and computed offsets/lengths from the field chain.
|
|
95826
|
+
const source = cast.findDirectExpression(Expressions.Source);
|
|
95827
|
+
const field = source === null || source === void 0 ? void 0 : source.findDirectExpression(Expressions.FieldChain);
|
|
95828
|
+
return (source === null || source === void 0 ? void 0 : source.getChildren().length) === 1 && field !== undefined
|
|
95829
|
+
&& field.findFirstExpression(Expressions.MethodCall) === undefined
|
|
95830
|
+
&& field.findFirstExpression(Expressions.TableExpression) === undefined
|
|
95831
|
+
&& field.findFirstExpression(Expressions.FieldOffset) === undefined
|
|
95832
|
+
&& field.findFirstExpression(Expressions.FieldLength) === undefined;
|
|
95833
|
+
}
|
|
95834
|
+
simpleTarget(target) {
|
|
95835
|
+
return target.countTokens() === 1 && target.findDirectExpression(Expressions.TargetField) !== undefined
|
|
95836
|
+
|| target.getChildren().length === 1 && target.findDirectExpression(Expressions.InlineData) !== undefined;
|
|
95837
|
+
}
|
|
95838
|
+
plainSource(source) {
|
|
95839
|
+
if ((source === null || source === void 0 ? void 0 : source.getChildren().length) !== 1) {
|
|
95840
|
+
return false;
|
|
95841
|
+
}
|
|
95842
|
+
return source.findDirectExpression(Expressions.Constant) !== undefined
|
|
95843
|
+
|| source.countTokens() === 1 && source.findDirectExpression(Expressions.FieldChain) !== undefined;
|
|
95844
|
+
}
|
|
95845
|
+
}
|
|
95846
|
+
exports.PreferInlineCast = PreferInlineCast;
|
|
95847
|
+
//# sourceMappingURL=prefer_inline_cast.js.map
|
|
95848
|
+
|
|
95849
|
+
/***/ },
|
|
95850
|
+
|
|
93791
95851
|
/***/ "../core/build/src/rules/prefer_insert_into_table.js"
|
|
93792
95852
|
/*!***********************************************************!*\
|
|
93793
95853
|
!*** ../core/build/src/rules/prefer_insert_into_table.js ***!
|
|
@@ -95150,6 +97210,216 @@ exports.PrefixIsCurrentClass = PrefixIsCurrentClass;
|
|
|
95150
97210
|
|
|
95151
97211
|
/***/ },
|
|
95152
97212
|
|
|
97213
|
+
/***/ "../core/build/src/rules/range_row_values.js"
|
|
97214
|
+
/*!***************************************************!*\
|
|
97215
|
+
!*** ../core/build/src/rules/range_row_values.js ***!
|
|
97216
|
+
\***************************************************/
|
|
97217
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
97218
|
+
|
|
97219
|
+
"use strict";
|
|
97220
|
+
|
|
97221
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
97222
|
+
if (k2 === undefined) k2 = k;
|
|
97223
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
97224
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
97225
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
97226
|
+
}
|
|
97227
|
+
Object.defineProperty(o, k2, desc);
|
|
97228
|
+
}) : (function(o, m, k, k2) {
|
|
97229
|
+
if (k2 === undefined) k2 = k;
|
|
97230
|
+
o[k2] = m[k];
|
|
97231
|
+
}));
|
|
97232
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
97233
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
97234
|
+
}) : function(o, v) {
|
|
97235
|
+
o["default"] = v;
|
|
97236
|
+
});
|
|
97237
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
97238
|
+
var ownKeys = function(o) {
|
|
97239
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
97240
|
+
var ar = [];
|
|
97241
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
97242
|
+
return ar;
|
|
97243
|
+
};
|
|
97244
|
+
return ownKeys(o);
|
|
97245
|
+
};
|
|
97246
|
+
return function (mod) {
|
|
97247
|
+
if (mod && mod.__esModule) return mod;
|
|
97248
|
+
var result = {};
|
|
97249
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
97250
|
+
__setModuleDefault(result, mod);
|
|
97251
|
+
return result;
|
|
97252
|
+
};
|
|
97253
|
+
})();
|
|
97254
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
97255
|
+
exports.RangeRowValues = exports.RangeRowValuesConf = void 0;
|
|
97256
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
97257
|
+
const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
97258
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
97259
|
+
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
|
|
97260
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
97261
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
97262
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
97263
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
97264
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
97265
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
97266
|
+
const RANGE_COMPONENTS = ["SIGN", "OPTION", "LOW", "HIGH"];
|
|
97267
|
+
const SIGNS = ["I", "E"];
|
|
97268
|
+
const OPTIONS = ["EQ", "NE", "BT", "NB", "CP", "NP", "GT", "GE", "LT", "LE"];
|
|
97269
|
+
class RangeRowValuesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
97270
|
+
}
|
|
97271
|
+
exports.RangeRowValuesConf = RangeRowValuesConf;
|
|
97272
|
+
class RangeRowValues {
|
|
97273
|
+
constructor() {
|
|
97274
|
+
this.conf = new RangeRowValuesConf();
|
|
97275
|
+
}
|
|
97276
|
+
getMetadata() {
|
|
97277
|
+
return {
|
|
97278
|
+
key: "range_row_values",
|
|
97279
|
+
title: "Range row values",
|
|
97280
|
+
shortDescription: `Checks the SIGN and OPTION of range rows built with VALUE`,
|
|
97281
|
+
extendedInformation: `A row of a range table, ie. a structure with exactly the components SIGN, OPTION, LOW and HIGH,
|
|
97282
|
+
is a selection structure to the syntax check. For a VALUE row of one, the system warns when SIGN or OPTION
|
|
97283
|
+
is missing, and when a literal is not a permitted value: SIGN must be I or E, OPTION one of
|
|
97284
|
+
EQ NE BT NB CP NP GT GE LT LE, in upper case.
|
|
97285
|
+
|
|
97286
|
+
Components given in the VALUE header count for the rows that follow, eg. VALUE #( sign = 'I' option = 'EQ' ( low = 1 ) ).
|
|
97287
|
+
Only literals are checked, a value from a variable, constant or expression is not.`,
|
|
97288
|
+
tags: [_irule_1.RuleTag.Syntax],
|
|
97289
|
+
badExample: `TYPES ty_range TYPE RANGE OF string.
|
|
97290
|
+
DATA(range) = VALUE ty_range( ( sign = 'I' option = 'eq' low = \`a\` )
|
|
97291
|
+
( sign = 'I' low = \`b\` ) ).`,
|
|
97292
|
+
goodExample: `TYPES ty_range TYPE RANGE OF string.
|
|
97293
|
+
DATA(range) = VALUE ty_range( ( sign = 'I' option = 'EQ' low = \`a\` )
|
|
97294
|
+
( sign = 'I' option = 'EQ' low = \`b\` ) ).`,
|
|
97295
|
+
};
|
|
97296
|
+
}
|
|
97297
|
+
getConfig() {
|
|
97298
|
+
return this.conf;
|
|
97299
|
+
}
|
|
97300
|
+
setConfig(conf) {
|
|
97301
|
+
this.conf = conf;
|
|
97302
|
+
}
|
|
97303
|
+
initialize(reg) {
|
|
97304
|
+
this.reg = reg;
|
|
97305
|
+
return this;
|
|
97306
|
+
}
|
|
97307
|
+
run(obj) {
|
|
97308
|
+
var _a, _b, _c;
|
|
97309
|
+
if (!(obj instanceof _abap_object_1.ABAPObject)) {
|
|
97310
|
+
return [];
|
|
97311
|
+
}
|
|
97312
|
+
const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
97313
|
+
if (syntax.issues.length > 0) {
|
|
97314
|
+
return [];
|
|
97315
|
+
}
|
|
97316
|
+
const issues = [];
|
|
97317
|
+
for (const file of obj.getABAPFiles()) {
|
|
97318
|
+
for (const source of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressionsRecursive(Expressions.Source)) || []) {
|
|
97319
|
+
if (source.getFirstToken().getStr().toUpperCase() !== "VALUE") {
|
|
97320
|
+
continue;
|
|
97321
|
+
}
|
|
97322
|
+
const typeToken = (_b = source.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
97323
|
+
const body = source.findDirectExpression(Expressions.ValueBody);
|
|
97324
|
+
if (typeToken === undefined || body === undefined) {
|
|
97325
|
+
continue;
|
|
97326
|
+
}
|
|
97327
|
+
const scope = syntax.spaghetti.lookupPosition(typeToken.getStart(), file.getFilename());
|
|
97328
|
+
const resolved = (_c = scope === null || scope === void 0 ? void 0 : scope.getData().references.find(r => r.referenceType === _reference_1.ReferenceType.InferredType
|
|
97329
|
+
&& r.position.getStart().equals(typeToken.getStart()))) === null || _c === void 0 ? void 0 : _c.resolved;
|
|
97330
|
+
if (!(resolved instanceof _typed_identifier_1.TypedIdentifier)) {
|
|
97331
|
+
continue;
|
|
97332
|
+
}
|
|
97333
|
+
const type = resolved.getType();
|
|
97334
|
+
if (type instanceof basic_1.TableType && this.isRangeRow(type.getRowType())) {
|
|
97335
|
+
const header = new Map();
|
|
97336
|
+
for (const child of body.getChildren()) {
|
|
97337
|
+
if (!(child instanceof nodes_1.ExpressionNode)) {
|
|
97338
|
+
continue;
|
|
97339
|
+
}
|
|
97340
|
+
else if (child.get() instanceof Expressions.FieldAssignment) {
|
|
97341
|
+
this.addAssignment(header, child);
|
|
97342
|
+
}
|
|
97343
|
+
else if (child.get() instanceof Expressions.ValueBodyLine) {
|
|
97344
|
+
const assignments = child.findDirectExpressions(Expressions.FieldAssignment);
|
|
97345
|
+
if (assignments.length === 0) {
|
|
97346
|
+
continue;
|
|
97347
|
+
}
|
|
97348
|
+
const row = new Map(header);
|
|
97349
|
+
for (const a of assignments) {
|
|
97350
|
+
this.addAssignment(row, a);
|
|
97351
|
+
}
|
|
97352
|
+
issues.push(...this.checkRow(file, child, row));
|
|
97353
|
+
}
|
|
97354
|
+
}
|
|
97355
|
+
}
|
|
97356
|
+
else if (this.isRangeRow(type) && body.findDirectExpression(Expressions.ValueBase) === undefined) {
|
|
97357
|
+
const assignments = body.findDirectExpressions(Expressions.FieldAssignment);
|
|
97358
|
+
if (assignments.length === 0) {
|
|
97359
|
+
continue;
|
|
97360
|
+
}
|
|
97361
|
+
const row = new Map();
|
|
97362
|
+
for (const a of assignments) {
|
|
97363
|
+
this.addAssignment(row, a);
|
|
97364
|
+
}
|
|
97365
|
+
issues.push(...this.checkRow(file, body, row));
|
|
97366
|
+
}
|
|
97367
|
+
}
|
|
97368
|
+
}
|
|
97369
|
+
return issues;
|
|
97370
|
+
}
|
|
97371
|
+
////////////////
|
|
97372
|
+
isRangeRow(type) {
|
|
97373
|
+
if (!(type instanceof basic_1.StructureType)) {
|
|
97374
|
+
return false;
|
|
97375
|
+
}
|
|
97376
|
+
const names = type.getComponents().map(c => c.name.toUpperCase());
|
|
97377
|
+
return names.length === RANGE_COMPONENTS.length && RANGE_COMPONENTS.every(c => names.includes(c));
|
|
97378
|
+
}
|
|
97379
|
+
addAssignment(row, assignment) {
|
|
97380
|
+
var _a;
|
|
97381
|
+
const name = (_a = assignment.findDirectExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
97382
|
+
const source = assignment.findDirectExpression(Expressions.Source);
|
|
97383
|
+
if (name && source) {
|
|
97384
|
+
row.set(name, source);
|
|
97385
|
+
}
|
|
97386
|
+
}
|
|
97387
|
+
checkRow(file, node, row) {
|
|
97388
|
+
const issues = [];
|
|
97389
|
+
for (const [component, allowed] of [["SIGN", SIGNS], ["OPTION", OPTIONS]]) {
|
|
97390
|
+
const source = row.get(component);
|
|
97391
|
+
if (source === undefined) {
|
|
97392
|
+
const message = `Specification ${component} is missing in the range row`;
|
|
97393
|
+
issues.push(issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
97394
|
+
continue;
|
|
97395
|
+
}
|
|
97396
|
+
const value = this.literal(source);
|
|
97397
|
+
if (value !== undefined && !allowed.includes(value)) {
|
|
97398
|
+
const message = `"${value}" is not a permitted value for ${component}, expected ${allowed.join(" ")}`;
|
|
97399
|
+
issues.push(issue_1.Issue.atToken(file, source.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
97400
|
+
}
|
|
97401
|
+
}
|
|
97402
|
+
return issues;
|
|
97403
|
+
}
|
|
97404
|
+
/** The content of a character literal, undefined for anything else */
|
|
97405
|
+
literal(source) {
|
|
97406
|
+
var _a, _b;
|
|
97407
|
+
if (source.getChildren().length !== 1) {
|
|
97408
|
+
return undefined;
|
|
97409
|
+
}
|
|
97410
|
+
const str = (_b = (_a = source.findDirectExpression(Expressions.Constant)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.ConstantString)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
|
|
97411
|
+
if (str === undefined) {
|
|
97412
|
+
return undefined;
|
|
97413
|
+
}
|
|
97414
|
+
const quote = str.charAt(0);
|
|
97415
|
+
return str.slice(1, -1).split(quote + quote).join(quote);
|
|
97416
|
+
}
|
|
97417
|
+
}
|
|
97418
|
+
exports.RangeRowValues = RangeRowValues;
|
|
97419
|
+
//# sourceMappingURL=range_row_values.js.map
|
|
97420
|
+
|
|
97421
|
+
/***/ },
|
|
97422
|
+
|
|
95153
97423
|
/***/ "../core/build/src/rules/reduce_procedural_code.js"
|
|
95154
97424
|
/*!*********************************************************!*\
|
|
95155
97425
|
!*** ../core/build/src/rules/reduce_procedural_code.js ***!
|
|
@@ -95607,6 +97877,9 @@ text = text.`,
|
|
|
95607
97877
|
else if (child.get() instanceof Expressions.Constant) {
|
|
95608
97878
|
context = this.infer(context, constant_1.Constant.runSyntax(child));
|
|
95609
97879
|
}
|
|
97880
|
+
else if (child.get() instanceof Expressions.StringTemplate) {
|
|
97881
|
+
context = basic_1.StringType.get();
|
|
97882
|
+
}
|
|
95610
97883
|
else if (child.get() instanceof Expressions.Source) {
|
|
95611
97884
|
context = this.infer(context, this.sourceType(child, scope));
|
|
95612
97885
|
}
|
|
@@ -96661,6 +98934,7 @@ class SelectionScreenNaming extends _abap_rule_1.ABAPRule {
|
|
|
96661
98934
|
constructor() {
|
|
96662
98935
|
super(...arguments);
|
|
96663
98936
|
this.conf = new SelectionScreenNamingConf();
|
|
98937
|
+
this.regex = this.compile();
|
|
96664
98938
|
}
|
|
96665
98939
|
getMetadata() {
|
|
96666
98940
|
return {
|
|
@@ -96680,6 +98954,15 @@ class SelectionScreenNaming extends _abap_rule_1.ABAPRule {
|
|
|
96680
98954
|
}
|
|
96681
98955
|
setConfig(conf) {
|
|
96682
98956
|
this.conf = conf;
|
|
98957
|
+
this.regex = this.compile();
|
|
98958
|
+
}
|
|
98959
|
+
compile() {
|
|
98960
|
+
return {
|
|
98961
|
+
parameter: new RegExp(this.conf.parameter, "i"),
|
|
98962
|
+
selectOption: new RegExp(this.conf.selectOption, "i"),
|
|
98963
|
+
screenElement: new RegExp(this.conf.screenElement, "i"),
|
|
98964
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
98965
|
+
};
|
|
96683
98966
|
}
|
|
96684
98967
|
runParsed(file) {
|
|
96685
98968
|
const issues = [];
|
|
@@ -96703,8 +98986,8 @@ class SelectionScreenNaming extends _abap_rule_1.ABAPRule {
|
|
|
96703
98986
|
|| (stat.get() instanceof statements_1.SelectOption && !selectOptionDisabled)
|
|
96704
98987
|
|| (stat.get() instanceof statements_1.SelectionScreen && !screenElementDisabled)) {
|
|
96705
98988
|
const fieldNode = this.getFieldForStatementNode(stat);
|
|
96706
|
-
const regex =
|
|
96707
|
-
if (fieldNode && name_validator_1.NameValidator.violatesRule(fieldNode.getFirstToken().getStr(), regex, this.conf)) {
|
|
98989
|
+
const regex = this.getRegexForStatement(stat.get());
|
|
98990
|
+
if (fieldNode && name_validator_1.NameValidator.violatesRule(fieldNode.getFirstToken().getStr(), regex, this.conf, this.regex.ignorePatterns)) {
|
|
96708
98991
|
issues.push(issue_1.Issue.atToken(file, fieldNode.getFirstToken(), this.getDescription(this.getPatternForStatement(stat.get()), fieldNode.getFirstToken().getStr()), this.getMetadata().key, this.conf.severity));
|
|
96709
98992
|
}
|
|
96710
98993
|
}
|
|
@@ -96724,6 +99007,15 @@ class SelectionScreenNaming extends _abap_rule_1.ABAPRule {
|
|
|
96724
99007
|
}
|
|
96725
99008
|
return pattern;
|
|
96726
99009
|
}
|
|
99010
|
+
getRegexForStatement(statement) {
|
|
99011
|
+
if (statement instanceof statements_1.Parameter) {
|
|
99012
|
+
return this.regex.parameter;
|
|
99013
|
+
}
|
|
99014
|
+
else if (statement instanceof statements_1.SelectOption) {
|
|
99015
|
+
return this.regex.selectOption;
|
|
99016
|
+
}
|
|
99017
|
+
return this.regex.screenElement;
|
|
99018
|
+
}
|
|
96727
99019
|
getFieldForStatementNode(statNode) {
|
|
96728
99020
|
if (statNode.get() instanceof statements_1.Parameter) {
|
|
96729
99021
|
return statNode.findFirstExpression(expressions_1.FieldSub);
|
|
@@ -97126,8 +99418,7 @@ class SICFConsistency {
|
|
|
97126
99418
|
if (this.conf.skipNames && this.conf.skipNames.some((a) => a.toUpperCase() === h.toUpperCase())) {
|
|
97127
99419
|
continue;
|
|
97128
99420
|
}
|
|
97129
|
-
|
|
97130
|
-
if (pattern.test(h) === true) {
|
|
99421
|
+
if (this.reg.inErrorNamespace(h) === true) {
|
|
97131
99422
|
const message = "Handler class " + h + " not found";
|
|
97132
99423
|
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);
|
|
97133
99424
|
issues.push(issue);
|
|
@@ -97390,6 +99681,204 @@ exports.SMIMConsistency = SMIMConsistency;
|
|
|
97390
99681
|
|
|
97391
99682
|
/***/ },
|
|
97392
99683
|
|
|
99684
|
+
/***/ "../core/build/src/rules/sort_empty_key.js"
|
|
99685
|
+
/*!*************************************************!*\
|
|
99686
|
+
!*** ../core/build/src/rules/sort_empty_key.js ***!
|
|
99687
|
+
\*************************************************/
|
|
99688
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
99689
|
+
|
|
99690
|
+
"use strict";
|
|
99691
|
+
|
|
99692
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
99693
|
+
if (k2 === undefined) k2 = k;
|
|
99694
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
99695
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
99696
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
99697
|
+
}
|
|
99698
|
+
Object.defineProperty(o, k2, desc);
|
|
99699
|
+
}) : (function(o, m, k, k2) {
|
|
99700
|
+
if (k2 === undefined) k2 = k;
|
|
99701
|
+
o[k2] = m[k];
|
|
99702
|
+
}));
|
|
99703
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
99704
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
99705
|
+
}) : function(o, v) {
|
|
99706
|
+
o["default"] = v;
|
|
99707
|
+
});
|
|
99708
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
99709
|
+
var ownKeys = function(o) {
|
|
99710
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
99711
|
+
var ar = [];
|
|
99712
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
99713
|
+
return ar;
|
|
99714
|
+
};
|
|
99715
|
+
return ownKeys(o);
|
|
99716
|
+
};
|
|
99717
|
+
return function (mod) {
|
|
99718
|
+
if (mod && mod.__esModule) return mod;
|
|
99719
|
+
var result = {};
|
|
99720
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
99721
|
+
__setModuleDefault(result, mod);
|
|
99722
|
+
return result;
|
|
99723
|
+
};
|
|
99724
|
+
})();
|
|
99725
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
99726
|
+
exports.SortEmptyKey = exports.SortEmptyKeyConf = void 0;
|
|
99727
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
99728
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
99729
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
99730
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
99731
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
99732
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
99733
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
99734
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
99735
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
99736
|
+
const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
|
|
99737
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
99738
|
+
class SortEmptyKeyConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
99739
|
+
}
|
|
99740
|
+
exports.SortEmptyKeyConf = SortEmptyKeyConf;
|
|
99741
|
+
class SortEmptyKey {
|
|
99742
|
+
constructor() {
|
|
99743
|
+
this.conf = new SortEmptyKeyConf();
|
|
99744
|
+
}
|
|
99745
|
+
getMetadata() {
|
|
99746
|
+
return {
|
|
99747
|
+
key: "sort_empty_key",
|
|
99748
|
+
title: "SORT or DELETE ADJACENT DUPLICATES on a table with an empty key",
|
|
99749
|
+
shortDescription: `SORT without BY and DELETE ADJACENT DUPLICATES without COMPARING on a table with an empty primary key`,
|
|
99750
|
+
extendedInformation: `Without BY or COMPARING, both statements use the primary key of the table. For a table
|
|
99751
|
+
declared WITH EMPTY KEY there is nothing to sort or compare by, SORT does nothing.
|
|
99752
|
+
|
|
99753
|
+
The syntax check warns: "ITAB is a table with an empty primary key. Check the semantics of the statement."
|
|
99754
|
+
|
|
99755
|
+
Sorted and hashed tables, tables with a default or explicit key, and tables of unknown or generic type are not reported.
|
|
99756
|
+
|
|
99757
|
+
The quick fix adds BY table_line or COMPARING table_line, for tables with an elementary row type.`,
|
|
99758
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
99759
|
+
badExample: `DATA result TYPE STANDARD TABLE OF string WITH EMPTY KEY.
|
|
99760
|
+
SORT result.
|
|
99761
|
+
DELETE ADJACENT DUPLICATES FROM result.`,
|
|
99762
|
+
goodExample: `DATA result TYPE STANDARD TABLE OF string WITH EMPTY KEY.
|
|
99763
|
+
SORT result BY table_line.
|
|
99764
|
+
DELETE ADJACENT DUPLICATES FROM result COMPARING table_line.`,
|
|
99765
|
+
};
|
|
99766
|
+
}
|
|
99767
|
+
getConfig() {
|
|
99768
|
+
return this.conf;
|
|
99769
|
+
}
|
|
99770
|
+
initialize(reg) {
|
|
99771
|
+
this.reg = reg;
|
|
99772
|
+
return this;
|
|
99773
|
+
}
|
|
99774
|
+
setConfig(conf) {
|
|
99775
|
+
this.conf = conf;
|
|
99776
|
+
}
|
|
99777
|
+
run(obj) {
|
|
99778
|
+
if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === "INTF") {
|
|
99779
|
+
return [];
|
|
99780
|
+
}
|
|
99781
|
+
const issues = [];
|
|
99782
|
+
let spaghetti = undefined;
|
|
99783
|
+
for (const file of obj.getABAPFiles()) {
|
|
99784
|
+
for (const statement of file.getStatements()) {
|
|
99785
|
+
let addition;
|
|
99786
|
+
if (statement.get() instanceof Statements.Sort) {
|
|
99787
|
+
if (statement.findDirectTokenByText("BY") !== undefined) {
|
|
99788
|
+
continue;
|
|
99789
|
+
}
|
|
99790
|
+
addition = "BY";
|
|
99791
|
+
}
|
|
99792
|
+
else if (statement.get() instanceof Statements.DeleteInternal) {
|
|
99793
|
+
if (statement.findDirectTokenByText("ADJACENT") === undefined
|
|
99794
|
+
|| statement.findDirectTokenByText("COMPARING") !== undefined
|
|
99795
|
+
|| statement.findDirectTokenByText("USING") !== undefined) {
|
|
99796
|
+
continue;
|
|
99797
|
+
}
|
|
99798
|
+
addition = "COMPARING";
|
|
99799
|
+
}
|
|
99800
|
+
else {
|
|
99801
|
+
continue;
|
|
99802
|
+
}
|
|
99803
|
+
const target = statement.findDirectExpression(Expressions.Target);
|
|
99804
|
+
if (target === undefined) {
|
|
99805
|
+
continue;
|
|
99806
|
+
}
|
|
99807
|
+
if (spaghetti === undefined) {
|
|
99808
|
+
spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
|
|
99809
|
+
}
|
|
99810
|
+
const type = this.findType(target, spaghetti, file);
|
|
99811
|
+
if (!(type instanceof basic_1.TableType)
|
|
99812
|
+
|| type.getOptions().keyType !== basic_1.TableKeyType.empty
|
|
99813
|
+
|| type.isGeneric()
|
|
99814
|
+
|| (type.getAccessType() !== undefined && type.getAccessType() !== basic_1.TableAccessType.standard)) {
|
|
99815
|
+
continue;
|
|
99816
|
+
}
|
|
99817
|
+
const verb = addition === "BY" ? "SORT without BY" : "DELETE ADJACENT DUPLICATES without COMPARING";
|
|
99818
|
+
const message = `${verb} on "${target.concatTokens()}", a table with an empty primary key`;
|
|
99819
|
+
const fix = this.buildFix(file, statement, type.getRowType(), addition);
|
|
99820
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));
|
|
99821
|
+
}
|
|
99822
|
+
}
|
|
99823
|
+
return issues;
|
|
99824
|
+
}
|
|
99825
|
+
////////////////
|
|
99826
|
+
/** The type of a target built from names, components and attributes only, else undefined */
|
|
99827
|
+
findType(target, spaghetti, file) {
|
|
99828
|
+
var _a;
|
|
99829
|
+
let type = undefined;
|
|
99830
|
+
for (const child of target.getChildren()) {
|
|
99831
|
+
const get = child.get();
|
|
99832
|
+
if (get instanceof Expressions.TargetField
|
|
99833
|
+
|| get instanceof Expressions.TargetFieldSymbol
|
|
99834
|
+
|| get instanceof Expressions.AttributeName) {
|
|
99835
|
+
type = (_a = this.findReference(child.getFirstToken().getStart(), spaghetti, file)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
99836
|
+
}
|
|
99837
|
+
else if (get instanceof Expressions.ComponentName) {
|
|
99838
|
+
type = type instanceof basic_1.StructureType ? type.getComponentByName(child.concatTokens()) : undefined;
|
|
99839
|
+
}
|
|
99840
|
+
else if (!(get instanceof tokens_1.Dash)
|
|
99841
|
+
&& !(get instanceof tokens_1.InstanceArrow)
|
|
99842
|
+
&& !(get instanceof tokens_1.StaticArrow)
|
|
99843
|
+
&& !(get instanceof Expressions.ClassName)) {
|
|
99844
|
+
return undefined;
|
|
99845
|
+
}
|
|
99846
|
+
if (type === undefined && !(get instanceof Expressions.ClassName) && !(get instanceof tokens_1.StaticArrow)) {
|
|
99847
|
+
return undefined;
|
|
99848
|
+
}
|
|
99849
|
+
}
|
|
99850
|
+
return type;
|
|
99851
|
+
}
|
|
99852
|
+
findReference(start, spaghetti, file) {
|
|
99853
|
+
const scope = spaghetti.lookupPosition(start, file.getFilename());
|
|
99854
|
+
for (const r of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
|
|
99855
|
+
if (r.position.getStart().equals(start) && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {
|
|
99856
|
+
return r.resolved;
|
|
99857
|
+
}
|
|
99858
|
+
}
|
|
99859
|
+
return undefined;
|
|
99860
|
+
}
|
|
99861
|
+
buildFix(file, statement, rowType, addition) {
|
|
99862
|
+
if (rowType instanceof basic_1.StructureType
|
|
99863
|
+
|| rowType instanceof basic_1.TableType
|
|
99864
|
+
|| rowType instanceof basic_1.VoidType
|
|
99865
|
+
|| rowType instanceof basic_1.UnknownType
|
|
99866
|
+
|| rowType.isGeneric()) {
|
|
99867
|
+
return undefined;
|
|
99868
|
+
}
|
|
99869
|
+
const tokens = statement.getTokens();
|
|
99870
|
+
let last = tokens[tokens.length - 1];
|
|
99871
|
+
if (last instanceof tokens_1.Punctuation) {
|
|
99872
|
+
last = tokens[tokens.length - 2];
|
|
99873
|
+
}
|
|
99874
|
+
return edit_helper_1.EditHelper.insertAt(file, last.getEnd(), ` ${addition} table_line`);
|
|
99875
|
+
}
|
|
99876
|
+
}
|
|
99877
|
+
exports.SortEmptyKey = SortEmptyKey;
|
|
99878
|
+
//# sourceMappingURL=sort_empty_key.js.map
|
|
99879
|
+
|
|
99880
|
+
/***/ },
|
|
99881
|
+
|
|
97393
99882
|
/***/ "../core/build/src/rules/space_before_colon.js"
|
|
97394
99883
|
/*!*****************************************************!*\
|
|
97395
99884
|
!*** ../core/build/src/rules/space_before_colon.js ***!
|
|
@@ -98129,6 +100618,236 @@ exports.StrictSQL = StrictSQL;
|
|
|
98129
100618
|
|
|
98130
100619
|
/***/ },
|
|
98131
100620
|
|
|
100621
|
+
/***/ "../core/build/src/rules/subrc_after_assign.js"
|
|
100622
|
+
/*!*****************************************************!*\
|
|
100623
|
+
!*** ../core/build/src/rules/subrc_after_assign.js ***!
|
|
100624
|
+
\*****************************************************/
|
|
100625
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
100626
|
+
|
|
100627
|
+
"use strict";
|
|
100628
|
+
|
|
100629
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
100630
|
+
if (k2 === undefined) k2 = k;
|
|
100631
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
100632
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
100633
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
100634
|
+
}
|
|
100635
|
+
Object.defineProperty(o, k2, desc);
|
|
100636
|
+
}) : (function(o, m, k, k2) {
|
|
100637
|
+
if (k2 === undefined) k2 = k;
|
|
100638
|
+
o[k2] = m[k];
|
|
100639
|
+
}));
|
|
100640
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
100641
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
100642
|
+
}) : function(o, v) {
|
|
100643
|
+
o["default"] = v;
|
|
100644
|
+
});
|
|
100645
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
100646
|
+
var ownKeys = function(o) {
|
|
100647
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
100648
|
+
var ar = [];
|
|
100649
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
100650
|
+
return ar;
|
|
100651
|
+
};
|
|
100652
|
+
return ownKeys(o);
|
|
100653
|
+
};
|
|
100654
|
+
return function (mod) {
|
|
100655
|
+
if (mod && mod.__esModule) return mod;
|
|
100656
|
+
var result = {};
|
|
100657
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
100658
|
+
__setModuleDefault(result, mod);
|
|
100659
|
+
return result;
|
|
100660
|
+
};
|
|
100661
|
+
})();
|
|
100662
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
100663
|
+
exports.SubrcAfterAssign = exports.SubrcAfterAssignConf = void 0;
|
|
100664
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
100665
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
100666
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
100667
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
100668
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
100669
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
100670
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
100671
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
100672
|
+
const severity_1 = __webpack_require__(/*! ../severity */ "../core/build/src/severity.js");
|
|
100673
|
+
class SubrcAfterAssignConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
100674
|
+
constructor() {
|
|
100675
|
+
super(...arguments);
|
|
100676
|
+
this.severity = severity_1.Severity.Warning;
|
|
100677
|
+
}
|
|
100678
|
+
}
|
|
100679
|
+
exports.SubrcAfterAssignConf = SubrcAfterAssignConf;
|
|
100680
|
+
class SubrcAfterAssign extends _abap_rule_1.ABAPRule {
|
|
100681
|
+
constructor() {
|
|
100682
|
+
super(...arguments);
|
|
100683
|
+
this.conf = new SubrcAfterAssignConf();
|
|
100684
|
+
}
|
|
100685
|
+
getMetadata() {
|
|
100686
|
+
return {
|
|
100687
|
+
key: "subrc_after_assign",
|
|
100688
|
+
title: "sy-subrc checked after ASSIGN",
|
|
100689
|
+
shortDescription: `Reports a sy-subrc check directly after an ASSIGN, use IS [NOT] ASSIGNED instead`,
|
|
100690
|
+
extendedInformation: `On a 7.40 SP7 system sy-subrc was still 4 after a successful ASSIGN, left over from an earlier
|
|
100691
|
+
READ TABLE, see https://github.com/abap2UI5/abap2UI5/issues/1937. Current releases set sy-subrc here.
|
|
100692
|
+
IS [NOT] ASSIGNED asks the field symbol directly and does not depend on the release.
|
|
100693
|
+
|
|
100694
|
+
A failed ASSIGN keeps the previous binding of the field symbol. So inside a loop, or when the
|
|
100695
|
+
field symbol is bound earlier in the same method, IS ASSIGNED is true after a failed ASSIGN.
|
|
100696
|
+
There, add UNASSIGN <fs> before the ASSIGN. The quick fix is only offered when the field symbol
|
|
100697
|
+
is declared in the method, bound only by this ASSIGN, and the ASSIGN is not in a loop.
|
|
100698
|
+
|
|
100699
|
+
ASSIGN COMPONENT ... OF STRUCTURE is not reported.`,
|
|
100700
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
100701
|
+
badExample: `ASSIGN (lv_name) TO <attri>.
|
|
100702
|
+
IF sy-subrc = 0.
|
|
100703
|
+
WRITE <attri>.
|
|
100704
|
+
ENDIF.`,
|
|
100705
|
+
goodExample: `ASSIGN (lv_name) TO <attri>.
|
|
100706
|
+
IF <attri> IS ASSIGNED.
|
|
100707
|
+
WRITE <attri>.
|
|
100708
|
+
ENDIF.`,
|
|
100709
|
+
};
|
|
100710
|
+
}
|
|
100711
|
+
getConfig() {
|
|
100712
|
+
return this.conf;
|
|
100713
|
+
}
|
|
100714
|
+
setConfig(conf) {
|
|
100715
|
+
this.conf = conf;
|
|
100716
|
+
}
|
|
100717
|
+
runParsed(file) {
|
|
100718
|
+
var _a, _b;
|
|
100719
|
+
const issues = [];
|
|
100720
|
+
const statements = file.getStatements();
|
|
100721
|
+
for (let i = 0; i < statements.length; i++) {
|
|
100722
|
+
const statement = statements[i];
|
|
100723
|
+
if (!(statement.get() instanceof Statements.Assign)
|
|
100724
|
+
|| ((_a = statement.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toUpperCase()) === "COMPONENT") {
|
|
100725
|
+
continue;
|
|
100726
|
+
}
|
|
100727
|
+
const target = statement.findDirectExpression(Expressions.FSTarget);
|
|
100728
|
+
const fs = (_b = target === null || target === void 0 ? void 0 : target.findFirstExpression(Expressions.FieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
100729
|
+
if (target === undefined || fs === undefined) {
|
|
100730
|
+
continue;
|
|
100731
|
+
}
|
|
100732
|
+
const check = this.nextCheck(i, statements, fs.toUpperCase());
|
|
100733
|
+
if (check === undefined) {
|
|
100734
|
+
continue;
|
|
100735
|
+
}
|
|
100736
|
+
let message = `sy-subrc checked after ASSIGN, use ${fs} IS [NOT] ASSIGNED`;
|
|
100737
|
+
let fix = undefined;
|
|
100738
|
+
if (this.insideLoop(i, statements) === true) {
|
|
100739
|
+
message += ` with UNASSIGN ${fs} before the ASSIGN, it is inside a loop`;
|
|
100740
|
+
}
|
|
100741
|
+
else if (this.boundEarlier(i, statements, fs.toUpperCase()) === true) {
|
|
100742
|
+
message += ` with UNASSIGN ${fs} before the ASSIGN, ${fs} is bound earlier`;
|
|
100743
|
+
}
|
|
100744
|
+
else if (target.findDirectExpression(Expressions.InlineFS) === undefined
|
|
100745
|
+
&& this.declaredInBlock(i, statements, fs.toUpperCase()) === false) {
|
|
100746
|
+
message += ` with UNASSIGN ${fs} before the ASSIGN, ${fs} is not declared in this method`;
|
|
100747
|
+
}
|
|
100748
|
+
else {
|
|
100749
|
+
fix = this.buildFix(file, check, fs);
|
|
100750
|
+
}
|
|
100751
|
+
issues.push(issue_1.Issue.atStatement(file, check, message, this.getMetadata().key, this.conf.severity, fix));
|
|
100752
|
+
}
|
|
100753
|
+
return issues;
|
|
100754
|
+
}
|
|
100755
|
+
////////////////
|
|
100756
|
+
/** the next statement, skipping comments and ENDIF like check_subrc does, if it reads sy-subrc */
|
|
100757
|
+
nextCheck(index, statements, fs) {
|
|
100758
|
+
for (let i = index + 1; i < statements.length; i++) {
|
|
100759
|
+
const statement = statements[i];
|
|
100760
|
+
if (statement.get() instanceof _statement_1.Comment
|
|
100761
|
+
|| statement.get() instanceof Statements.EndIf
|
|
100762
|
+
|| statement.get() instanceof Statements.EndTestSeam) {
|
|
100763
|
+
continue;
|
|
100764
|
+
}
|
|
100765
|
+
const concat = statement.concatTokens().toUpperCase();
|
|
100766
|
+
if (concat.includes(fs + " IS ASSIGNED") || concat.includes(fs + " IS NOT ASSIGNED")) {
|
|
100767
|
+
return undefined;
|
|
100768
|
+
}
|
|
100769
|
+
return concat.includes("SY-SUBRC") ? statement : undefined;
|
|
100770
|
+
}
|
|
100771
|
+
return undefined;
|
|
100772
|
+
}
|
|
100773
|
+
insideLoop(index, statements) {
|
|
100774
|
+
let depth = 0;
|
|
100775
|
+
for (let i = index - 1; i >= 0 && this.startsBlock(statements[i]) === false; i--) {
|
|
100776
|
+
const s = statements[i].get();
|
|
100777
|
+
if (s instanceof Statements.EndLoop || s instanceof Statements.EndDo || s instanceof Statements.EndWhile) {
|
|
100778
|
+
depth++;
|
|
100779
|
+
}
|
|
100780
|
+
else if (s instanceof Statements.Loop || s instanceof Statements.Do || s instanceof Statements.While) {
|
|
100781
|
+
if (depth === 0) {
|
|
100782
|
+
return true;
|
|
100783
|
+
}
|
|
100784
|
+
depth--;
|
|
100785
|
+
}
|
|
100786
|
+
}
|
|
100787
|
+
return false;
|
|
100788
|
+
}
|
|
100789
|
+
/** any earlier statement in the block with the field symbol as target, eg. ASSIGN, LOOP or READ TABLE ASSIGNING */
|
|
100790
|
+
boundEarlier(index, statements, fs) {
|
|
100791
|
+
var _a;
|
|
100792
|
+
for (let i = index - 1; i >= 0 && this.startsBlock(statements[i]) === false; i--) {
|
|
100793
|
+
for (const target of statements[i].findAllExpressions(Expressions.FSTarget)) {
|
|
100794
|
+
if (((_a = target.findFirstExpression(Expressions.FieldSymbol)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === fs) {
|
|
100795
|
+
return true;
|
|
100796
|
+
}
|
|
100797
|
+
}
|
|
100798
|
+
}
|
|
100799
|
+
return false;
|
|
100800
|
+
}
|
|
100801
|
+
declaredInBlock(index, statements, fs) {
|
|
100802
|
+
var _a;
|
|
100803
|
+
for (let i = index - 1; i >= 0 && this.startsBlock(statements[i]) === false; i--) {
|
|
100804
|
+
if (statements[i].get() instanceof Statements.FieldSymbol
|
|
100805
|
+
&& ((_a = statements[i].findDirectExpression(Expressions.FieldSymbol)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === fs) {
|
|
100806
|
+
return true;
|
|
100807
|
+
}
|
|
100808
|
+
}
|
|
100809
|
+
return false;
|
|
100810
|
+
}
|
|
100811
|
+
startsBlock(statement) {
|
|
100812
|
+
const s = statement.get();
|
|
100813
|
+
return s instanceof Statements.MethodImplementation
|
|
100814
|
+
|| s instanceof Statements.Form
|
|
100815
|
+
|| s instanceof Statements.FunctionModule
|
|
100816
|
+
|| s instanceof Statements.Module
|
|
100817
|
+
|| s instanceof Statements.EndMethod
|
|
100818
|
+
|| s instanceof Statements.EndForm
|
|
100819
|
+
|| s instanceof Statements.EndFunction
|
|
100820
|
+
|| s instanceof Statements.EndModule;
|
|
100821
|
+
}
|
|
100822
|
+
/** replaces "sy-subrc = 0" or "sy-subrc <> 0" in place, also inside a longer condition */
|
|
100823
|
+
buildFix(file, statement, fs) {
|
|
100824
|
+
const tokens = statement.getTokens();
|
|
100825
|
+
for (let i = 0; i + 4 < tokens.length; i++) {
|
|
100826
|
+
if (tokens[i].getStr().toUpperCase() !== "SY"
|
|
100827
|
+
|| tokens[i + 1].getStr() !== "-"
|
|
100828
|
+
|| tokens[i + 2].getStr().toUpperCase() !== "SUBRC") {
|
|
100829
|
+
continue;
|
|
100830
|
+
}
|
|
100831
|
+
if (tokens[i + 4].getStr() !== "0") {
|
|
100832
|
+
return undefined;
|
|
100833
|
+
}
|
|
100834
|
+
const op = tokens[i + 3].getStr().toUpperCase();
|
|
100835
|
+
if (op === "=" || op === "EQ") {
|
|
100836
|
+
return edit_helper_1.EditHelper.replaceRange(file, tokens[i].getStart(), tokens[i + 4].getEnd(), `${fs} IS ASSIGNED`);
|
|
100837
|
+
}
|
|
100838
|
+
else if (op === "<>" || op === "NE") {
|
|
100839
|
+
return edit_helper_1.EditHelper.replaceRange(file, tokens[i].getStart(), tokens[i + 4].getEnd(), `${fs} IS NOT ASSIGNED`);
|
|
100840
|
+
}
|
|
100841
|
+
return undefined;
|
|
100842
|
+
}
|
|
100843
|
+
return undefined;
|
|
100844
|
+
}
|
|
100845
|
+
}
|
|
100846
|
+
exports.SubrcAfterAssign = SubrcAfterAssign;
|
|
100847
|
+
//# sourceMappingURL=subrc_after_assign.js.map
|
|
100848
|
+
|
|
100849
|
+
/***/ },
|
|
100850
|
+
|
|
98132
100851
|
/***/ "../core/build/src/rules/superclass_final.js"
|
|
98133
100852
|
/*!***************************************************!*\
|
|
98134
100853
|
!*** ../core/build/src/rules/superclass_final.js ***!
|
|
@@ -99046,6 +101765,7 @@ class TypesNaming extends _abap_rule_1.ABAPRule {
|
|
|
99046
101765
|
constructor() {
|
|
99047
101766
|
super(...arguments);
|
|
99048
101767
|
this.conf = new TypesNamingConf();
|
|
101768
|
+
this.regex = new RegExp(this.conf.pattern, "i");
|
|
99049
101769
|
}
|
|
99050
101770
|
getMetadata() {
|
|
99051
101771
|
return {
|
|
@@ -99063,10 +101783,10 @@ class TypesNaming extends _abap_rule_1.ABAPRule {
|
|
|
99063
101783
|
}
|
|
99064
101784
|
setConfig(conf) {
|
|
99065
101785
|
this.conf = conf;
|
|
101786
|
+
this.regex = new RegExp(this.conf.pattern, "i");
|
|
99066
101787
|
}
|
|
99067
101788
|
runParsed(file, obj) {
|
|
99068
101789
|
const issues = [];
|
|
99069
|
-
const testRegex = new RegExp(this.conf.pattern, "i");
|
|
99070
101790
|
let nesting = 0;
|
|
99071
101791
|
if (obj instanceof objects_1.TypePool) {
|
|
99072
101792
|
return [];
|
|
@@ -99095,7 +101815,7 @@ class TypesNaming extends _abap_rule_1.ABAPRule {
|
|
|
99095
101815
|
continue;
|
|
99096
101816
|
}
|
|
99097
101817
|
const token = expr.getFirstToken();
|
|
99098
|
-
if (
|
|
101818
|
+
if (this.regex.exec(token.getStr())) {
|
|
99099
101819
|
continue;
|
|
99100
101820
|
}
|
|
99101
101821
|
else {
|
|
@@ -101998,7 +104718,16 @@ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/ex
|
|
|
101998
104718
|
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
101999
104719
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
102000
104720
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
104721
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
104722
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
104723
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
104724
|
+
const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
|
|
102001
104725
|
class UseMessageClassConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
104726
|
+
constructor() {
|
|
104727
|
+
super(...arguments);
|
|
104728
|
+
/** Allow MESSAGE with an object reference, eg. an exception, like MESSAGE lx_error TYPE 'E' */
|
|
104729
|
+
this.allowExceptions = true;
|
|
104730
|
+
}
|
|
102002
104731
|
}
|
|
102003
104732
|
exports.UseMessageClassConf = UseMessageClassConf;
|
|
102004
104733
|
class UseMessageClass extends _abap_rule_1.ABAPRule {
|
|
@@ -102011,6 +104740,9 @@ class UseMessageClass extends _abap_rule_1.ABAPRule {
|
|
|
102011
104740
|
key: "use_message_class",
|
|
102012
104741
|
title: "Use message class",
|
|
102013
104742
|
shortDescription: `Define messages in SE91 instead of using inline text or variables`,
|
|
104743
|
+
extendedInformation: `If allowExceptions is enabled, MESSAGE with an object reference is allowed, eg. MESSAGE lx_error TYPE 'E'.
|
|
104744
|
+
|
|
104745
|
+
Void types are only allowed if the type name contains "CX_", as void class references cannot be distinguished from other void types.`,
|
|
102014
104746
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
102015
104747
|
badExample: `MESSAGE 'Something went wrong' TYPE 'E'.`,
|
|
102016
104748
|
goodExample: `MESSAGE e001(bc_msg).`,
|
|
@@ -102022,13 +104754,14 @@ class UseMessageClass extends _abap_rule_1.ABAPRule {
|
|
|
102022
104754
|
setConfig(conf) {
|
|
102023
104755
|
this.conf = conf;
|
|
102024
104756
|
}
|
|
102025
|
-
runParsed(file,
|
|
104757
|
+
runParsed(file, obj) {
|
|
102026
104758
|
const structure = file.getStructure();
|
|
102027
104759
|
if (structure === undefined) {
|
|
102028
104760
|
return [];
|
|
102029
104761
|
}
|
|
102030
104762
|
const issues = [];
|
|
102031
104763
|
const key = this.getMetadata().key;
|
|
104764
|
+
let syntax = undefined;
|
|
102032
104765
|
for (const statement of structure.findAllStatements(Statements.Message)) {
|
|
102033
104766
|
// The parser populates MessageSource only for the class-based forms (e001(bc_msg) or ID/TYPE/NUMBER).
|
|
102034
104767
|
// The text form (MESSAGE <source> TYPE <source>) uses MessageSourceSource directly with no MessageSource child.
|
|
@@ -102036,10 +104769,60 @@ class UseMessageClass extends _abap_rule_1.ABAPRule {
|
|
|
102036
104769
|
if (statement.findDirectExpression(Expressions.MessageSource) !== undefined) {
|
|
102037
104770
|
continue;
|
|
102038
104771
|
}
|
|
104772
|
+
if (this.conf.allowExceptions === true) {
|
|
104773
|
+
syntax !== null && syntax !== void 0 ? syntax : (syntax = new syntax_1.SyntaxLogic(this.reg, obj).run());
|
|
104774
|
+
if (this.isObjectReference(statement, file, syntax)) {
|
|
104775
|
+
continue;
|
|
104776
|
+
}
|
|
104777
|
+
}
|
|
102039
104778
|
issues.push(issue_1.Issue.atStatement(file, statement, "Use a message class (SE91) instead of inline text or variable", key, this.conf.severity));
|
|
102040
104779
|
}
|
|
102041
104780
|
return issues;
|
|
102042
104781
|
}
|
|
104782
|
+
isObjectReference(statement, file, syntax) {
|
|
104783
|
+
var _a, _b;
|
|
104784
|
+
const chain = (_b = (_a = statement.findDirectExpression(Expressions.MessageSourceSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.FieldChain);
|
|
104785
|
+
if (chain === undefined) {
|
|
104786
|
+
return false;
|
|
104787
|
+
}
|
|
104788
|
+
let type = undefined;
|
|
104789
|
+
for (const child of chain.getChildren()) {
|
|
104790
|
+
const c = child.get();
|
|
104791
|
+
if (c instanceof Expressions.ComponentName) {
|
|
104792
|
+
type = type instanceof basic_1.StructureType ? type.getComponentByName(child.concatTokens()) : undefined;
|
|
104793
|
+
}
|
|
104794
|
+
else if (c instanceof Expressions.SourceField
|
|
104795
|
+
|| c instanceof Expressions.SourceFieldSymbol
|
|
104796
|
+
|| c instanceof Expressions.AttributeName) {
|
|
104797
|
+
type = this.findType(child.getFirstToken().getStart(), file, syntax);
|
|
104798
|
+
}
|
|
104799
|
+
else if (c instanceof Expressions.ClassName
|
|
104800
|
+
|| c instanceof tokens_1.InstanceArrow
|
|
104801
|
+
|| c instanceof tokens_1.StaticArrow
|
|
104802
|
+
|| c instanceof tokens_1.Dash) {
|
|
104803
|
+
continue;
|
|
104804
|
+
}
|
|
104805
|
+
else {
|
|
104806
|
+
return false;
|
|
104807
|
+
}
|
|
104808
|
+
if (type === undefined) {
|
|
104809
|
+
return false;
|
|
104810
|
+
}
|
|
104811
|
+
}
|
|
104812
|
+
// void class references cannot be distinguished from other void types, guess based on the name
|
|
104813
|
+
return type instanceof basic_1.ObjectReferenceType
|
|
104814
|
+
|| type instanceof basic_1.GenericObjectReferenceType
|
|
104815
|
+
|| (type instanceof basic_1.VoidType && /CX_/i.test(type.getVoided() || ""));
|
|
104816
|
+
}
|
|
104817
|
+
findType(start, file, syntax) {
|
|
104818
|
+
const scope = syntax.spaghetti.lookupPosition(start, file.getFilename());
|
|
104819
|
+
for (const r of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
|
|
104820
|
+
if (r.position.getStart().equals(start) && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {
|
|
104821
|
+
return r.resolved.getType();
|
|
104822
|
+
}
|
|
104823
|
+
}
|
|
104824
|
+
return undefined;
|
|
104825
|
+
}
|
|
102043
104826
|
}
|
|
102044
104827
|
exports.UseMessageClass = UseMessageClass;
|
|
102045
104828
|
//# sourceMappingURL=use_message_class.js.map
|
|
@@ -102414,6 +105197,8 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/
|
|
|
102414
105197
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
102415
105198
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
102416
105199
|
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
105200
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
105201
|
+
const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
|
|
102417
105202
|
class WrongAbapdocPositionConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
102418
105203
|
}
|
|
102419
105204
|
exports.WrongAbapdocPositionConf = WrongAbapdocPositionConf;
|
|
@@ -102433,10 +105218,13 @@ elsewhere is silently ignored, leaving the declaration undocumented.
|
|
|
102433
105218
|
The following positions are reported,
|
|
102434
105219
|
* in front of a chained keyword, ie. before "CONSTANTS:" instead of after the colon,
|
|
102435
105220
|
* in the middle of a statement, ie. between the parameters of a METHODS definition,
|
|
102436
|
-
* directly in front of ENDCLASS, ENDINTERFACE or a SECTION statement
|
|
105221
|
+
* directly in front of ENDCLASS, ENDINTERFACE or a SECTION statement,
|
|
105222
|
+
* separated from its declaration by a blank line or a normal comment, the system reads both as the end of the block.
|
|
102437
105223
|
|
|
102438
|
-
Only checks ABAP Doc inside class definitions and interfaces
|
|
102439
|
-
|
|
105224
|
+
Only checks ABAP Doc inside class definitions and interfaces, and directly in front of them.
|
|
105225
|
+
|
|
105226
|
+
The quick fix for a blank line deletes the blank lines.`,
|
|
105227
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
102440
105228
|
badExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
102441
105229
|
PUBLIC SECTION.
|
|
102442
105230
|
"! Navigation modes
|
|
@@ -102462,6 +105250,7 @@ ENDCLASS.`,
|
|
|
102462
105250
|
this.conf = conf;
|
|
102463
105251
|
}
|
|
102464
105252
|
runParsed(file) {
|
|
105253
|
+
var _a;
|
|
102465
105254
|
const issues = [];
|
|
102466
105255
|
const statements = file.getStatements();
|
|
102467
105256
|
let definition = false;
|
|
@@ -102476,7 +105265,7 @@ ENDCLASS.`,
|
|
|
102476
105265
|
definition = false;
|
|
102477
105266
|
continue;
|
|
102478
105267
|
}
|
|
102479
|
-
else if (
|
|
105268
|
+
else if (this.isAbapdoc(statement) === false) {
|
|
102480
105269
|
continue;
|
|
102481
105270
|
}
|
|
102482
105271
|
else if (this.isAbapdoc(statements[i - 1]) === true
|
|
@@ -102484,19 +105273,57 @@ ENDCLASS.`,
|
|
|
102484
105273
|
continue; // only report the first row of each block
|
|
102485
105274
|
}
|
|
102486
105275
|
let next = undefined;
|
|
102487
|
-
|
|
102488
|
-
|
|
102489
|
-
|
|
105276
|
+
let j = i + 1;
|
|
105277
|
+
for (; j < statements.length; j++) {
|
|
105278
|
+
if (!(statements[j].get() instanceof _statement_1.Comment)) {
|
|
105279
|
+
next = statements[j];
|
|
105280
|
+
break;
|
|
102490
105281
|
}
|
|
102491
|
-
next = statements[j];
|
|
102492
|
-
break;
|
|
102493
105282
|
}
|
|
102494
105283
|
if (next === undefined) {
|
|
102495
105284
|
continue;
|
|
102496
105285
|
}
|
|
102497
|
-
|
|
105286
|
+
else if (definition === false
|
|
105287
|
+
&& !(next.get() instanceof Statements.ClassDefinition)
|
|
105288
|
+
&& !(next.get() instanceof Statements.Interface)) {
|
|
105289
|
+
continue;
|
|
105290
|
+
}
|
|
105291
|
+
// comments inside "next" are listed in front of it, only look at the rows above it
|
|
105292
|
+
const nextRow = this.startRow(next);
|
|
105293
|
+
const trailing = ((_a = statements[i - 1]) === null || _a === void 0 ? void 0 : _a.getEnd().getRow()) === statement.getStart().getRow();
|
|
105294
|
+
let last = statement;
|
|
105295
|
+
let separator = undefined;
|
|
105296
|
+
let fix = undefined;
|
|
105297
|
+
for (const s of trailing ? [] : statements.slice(i + 1, j)) {
|
|
105298
|
+
if (s.getStart().getRow() >= nextRow) {
|
|
105299
|
+
break;
|
|
105300
|
+
}
|
|
105301
|
+
else if (s.getStart().getRow() > last.getEnd().getRow() + 1) {
|
|
105302
|
+
separator = "a blank line";
|
|
105303
|
+
if (this.isAbapdoc(s) === true) {
|
|
105304
|
+
fix = edit_helper_1.EditHelper.deleteRange(file, new position_1.Position(last.getEnd().getRow() + 1, 1), new position_1.Position(s.getStart().getRow(), 1));
|
|
105305
|
+
}
|
|
105306
|
+
break;
|
|
105307
|
+
}
|
|
105308
|
+
else if (this.isAbapdoc(s) === false) {
|
|
105309
|
+
separator = "a comment";
|
|
105310
|
+
break;
|
|
105311
|
+
}
|
|
105312
|
+
last = s;
|
|
105313
|
+
}
|
|
105314
|
+
if (separator === undefined && trailing === false && nextRow > last.getEnd().getRow() + 1) {
|
|
105315
|
+
separator = "a blank line";
|
|
105316
|
+
fix = edit_helper_1.EditHelper.deleteRange(file, new position_1.Position(last.getEnd().getRow() + 1, 1), new position_1.Position(nextRow, 1));
|
|
105317
|
+
}
|
|
105318
|
+
let message = this.check(statement, next);
|
|
102498
105319
|
if (message !== undefined) {
|
|
102499
|
-
|
|
105320
|
+
fix = undefined;
|
|
105321
|
+
}
|
|
105322
|
+
else if (separator !== undefined) {
|
|
105323
|
+
message = "ABAP Doc is separated from its declaration by " + separator;
|
|
105324
|
+
}
|
|
105325
|
+
if (message !== undefined) {
|
|
105326
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));
|
|
102500
105327
|
}
|
|
102501
105328
|
}
|
|
102502
105329
|
return issues;
|
|
@@ -102505,6 +105332,9 @@ ENDCLASS.`,
|
|
|
102505
105332
|
return (statement === null || statement === void 0 ? void 0 : statement.get()) instanceof _statement_1.Comment
|
|
102506
105333
|
&& statement.getFirstToken().getStr().startsWith(`"!`);
|
|
102507
105334
|
}
|
|
105335
|
+
startRow(statement) {
|
|
105336
|
+
return Math.min(statement.getStart().getRow(), ...statement.getPragmas().map(p => p.getRow()));
|
|
105337
|
+
}
|
|
102508
105338
|
check(abapdoc, next) {
|
|
102509
105339
|
const type = next.get();
|
|
102510
105340
|
if (type instanceof Statements.EndClass
|
|
@@ -102645,6 +105475,10 @@ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../co
|
|
|
102645
105475
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
102646
105476
|
const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "../core/node_modules/fast-xml-parser/lib/fxp.cjs");
|
|
102647
105477
|
const severity_1 = __webpack_require__(/*! ../severity */ "../core/build/src/severity.js");
|
|
105478
|
+
const ABAPGIT_ATTRIBUTES = [
|
|
105479
|
+
["version", /<abapGit\b[^>]*\bversion="([^"]+)"/],
|
|
105480
|
+
["serializer_version", /<abapGit\b[^>]*\bserializer_version="([^"]+)"/],
|
|
105481
|
+
];
|
|
102648
105482
|
class XMLConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
102649
105483
|
constructor() {
|
|
102650
105484
|
super(...arguments);
|
|
@@ -102700,8 +105534,8 @@ class XMLConsistency {
|
|
|
102700
105534
|
issues.push(issue_1.Issue.atRow(file, 1, "XML parser error: " + res.err.msg, this.getMetadata().key, this.conf.severity));
|
|
102701
105535
|
}
|
|
102702
105536
|
else {
|
|
102703
|
-
for (const attribute of
|
|
102704
|
-
const value = (_a = xml.match(
|
|
105537
|
+
for (const [attribute, regex] of ABAPGIT_ATTRIBUTES) {
|
|
105538
|
+
const value = (_a = xml.match(regex)) === null || _a === void 0 ? void 0 : _a[1];
|
|
102705
105539
|
if (value !== undefined && value.match(/^v\d\.\d\.\d$/) === null) {
|
|
102706
105540
|
issues.push(issue_1.Issue.atRow(file, 1, `Unexpected abapGit ${attribute} "${value}"`, this.getMetadata().key, this.conf.severity));
|
|
102707
105541
|
}
|
|
@@ -104036,12 +106870,16 @@ exports.MethodLengthStats = MethodLengthStats;
|
|
|
104036
106870
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
104037
106871
|
exports.NameValidator = void 0;
|
|
104038
106872
|
class NameValidator {
|
|
104039
|
-
|
|
106873
|
+
/** compile the configured ignorePatterns, case insensitive */
|
|
106874
|
+
static compileIgnorePatterns(params) {
|
|
106875
|
+
return (params.ignorePatterns || []).map(ignored => new RegExp(ignored, "i"));
|
|
106876
|
+
}
|
|
106877
|
+
static violatesRule(name, pattern, params, ignorePatterns) {
|
|
104040
106878
|
if (params.ignoreNames && params.ignoreNames.indexOf(name.toUpperCase()) >= 0) {
|
|
104041
106879
|
return false;
|
|
104042
106880
|
}
|
|
104043
|
-
for (const ignored of
|
|
104044
|
-
if (
|
|
106881
|
+
for (const ignored of ignorePatterns) {
|
|
106882
|
+
if (ignored.test(name)) {
|
|
104045
106883
|
return false;
|
|
104046
106884
|
}
|
|
104047
106885
|
}
|