@abaplint/cli 2.120.78 → 2.120.80
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 +244 -52
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -3083,7 +3083,7 @@ class ExpandMacros {
|
|
|
3083
3083
|
listMacroNames() {
|
|
3084
3084
|
return this.macros.listMacroNames();
|
|
3085
3085
|
}
|
|
3086
|
-
find(statements, file, clear = true) {
|
|
3086
|
+
find(statements, file, clear = true, includePath = new Set()) {
|
|
3087
3087
|
var _a, _b, _c;
|
|
3088
3088
|
let nameToken = undefined;
|
|
3089
3089
|
let start = undefined;
|
|
@@ -3104,14 +3104,16 @@ class ExpandMacros {
|
|
|
3104
3104
|
else if (type instanceof Statements.Include) {
|
|
3105
3105
|
const includeName = (_b = statement.findDirectExpression(Expressions.IncludeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
3106
3106
|
// todo, this does not take function module includes into account
|
|
3107
|
-
// todo, workaround for cyclic includes?
|
|
3108
3107
|
const prog = (_c = this.reg) === null || _c === void 0 ? void 0 : _c.getObject("PROG", includeName);
|
|
3109
3108
|
if (prog) {
|
|
3110
3109
|
prog.parse(this.release, this.globalMacros, this.reg, this.languageVersion);
|
|
3111
3110
|
const includeMainFile = prog.getMainABAPFile();
|
|
3112
|
-
|
|
3111
|
+
// an include that is already on the current include path is not walked again
|
|
3112
|
+
if (includeMainFile && includePath.has(includeMainFile.getFilename()) === false) {
|
|
3113
|
+
includePath.add(includeMainFile.getFilename());
|
|
3113
3114
|
// slow, this copies everything,
|
|
3114
|
-
this.find([...includeMainFile.getStatements()], includeMainFile, false);
|
|
3115
|
+
this.find([...includeMainFile.getStatements()], includeMainFile, false, includePath);
|
|
3116
|
+
includePath.delete(includeMainFile.getFilename());
|
|
3115
3117
|
}
|
|
3116
3118
|
}
|
|
3117
3119
|
}
|
|
@@ -13366,11 +13368,11 @@ class Convert {
|
|
|
13366
13368
|
const dat = (0, combi_1.seq)("DATE", expressions_1.Source);
|
|
13367
13369
|
const tim = (0, combi_1.seq)("TIME", expressions_1.Source);
|
|
13368
13370
|
const stamp = (0, combi_1.seq)("INTO TIME STAMP", expressions_1.Target);
|
|
13369
|
-
const intoutc = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("INTO UTCLONG", expressions_1.Target));
|
|
13371
|
+
const intoutc = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("INTO UTCLONG", expressions_1.Target), { also: combi_1.AlsoIn.OpenABAP });
|
|
13370
13372
|
const invert = (0, combi_1.seq)("INTO INVERTED-DATE", expressions_1.Target);
|
|
13371
13373
|
const date = (0, combi_1.seq)((0, combi_1.per)(dat, tim), (0, combi_1.per)(daylightSource, stamp, zone, invert, intoutc));
|
|
13372
13374
|
const inv = (0, combi_1.seq)("INVERTED-DATE", expressions_1.Source, "INTO DATE", expressions_1.Target);
|
|
13373
|
-
const utclong = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("UTCLONG", expressions_1.Source, (0, combi_1.per)(zone, into,
|
|
13375
|
+
const utclong = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("UTCLONG", expressions_1.Source, (0, combi_1.per)(zone, into, daylightTarget)), { also: combi_1.AlsoIn.OpenABAP });
|
|
13374
13376
|
return (0, combi_1.seq)("CONVERT", (0, combi_1.alt)(time, date, inv, utclong));
|
|
13375
13377
|
}
|
|
13376
13378
|
}
|
|
@@ -25286,28 +25288,28 @@ BuiltIn.methods = {
|
|
|
25286
25288
|
"ABS": {
|
|
25287
25289
|
counter: BuiltIn.counter++,
|
|
25288
25290
|
mandatory: {
|
|
25289
|
-
"val": new basic_1.
|
|
25291
|
+
"val": new basic_1.NumericGenericType(),
|
|
25290
25292
|
},
|
|
25291
25293
|
return: basic_1.IntegerType.get(),
|
|
25292
25294
|
},
|
|
25293
25295
|
"ACOS": {
|
|
25294
25296
|
counter: BuiltIn.counter++,
|
|
25295
25297
|
mandatory: {
|
|
25296
|
-
"val": new basic_1.
|
|
25298
|
+
"val": new basic_1.NumericGenericType(),
|
|
25297
25299
|
},
|
|
25298
25300
|
return: new basic_1.FloatType(),
|
|
25299
25301
|
},
|
|
25300
25302
|
"ASIN": {
|
|
25301
25303
|
counter: BuiltIn.counter++,
|
|
25302
25304
|
mandatory: {
|
|
25303
|
-
"val": new basic_1.
|
|
25305
|
+
"val": new basic_1.NumericGenericType(),
|
|
25304
25306
|
},
|
|
25305
25307
|
return: new basic_1.FloatType(),
|
|
25306
25308
|
},
|
|
25307
25309
|
"ATAN": {
|
|
25308
25310
|
counter: BuiltIn.counter++,
|
|
25309
25311
|
mandatory: {
|
|
25310
|
-
"val": new basic_1.
|
|
25312
|
+
"val": new basic_1.NumericGenericType(),
|
|
25311
25313
|
},
|
|
25312
25314
|
return: new basic_1.FloatType(),
|
|
25313
25315
|
},
|
|
@@ -25341,7 +25343,7 @@ BuiltIn.methods = {
|
|
|
25341
25343
|
"CEIL": {
|
|
25342
25344
|
counter: BuiltIn.counter++,
|
|
25343
25345
|
mandatory: {
|
|
25344
|
-
"val": new basic_1.
|
|
25346
|
+
"val": new basic_1.NumericGenericType(),
|
|
25345
25347
|
},
|
|
25346
25348
|
return: basic_1.IntegerType.get(),
|
|
25347
25349
|
},
|
|
@@ -25478,14 +25480,14 @@ BuiltIn.methods = {
|
|
|
25478
25480
|
"COS": {
|
|
25479
25481
|
counter: BuiltIn.counter++,
|
|
25480
25482
|
mandatory: {
|
|
25481
|
-
"val": new basic_1.
|
|
25483
|
+
"val": new basic_1.NumericGenericType(),
|
|
25482
25484
|
},
|
|
25483
25485
|
return: new basic_1.FloatType(),
|
|
25484
25486
|
},
|
|
25485
25487
|
"COSH": {
|
|
25486
25488
|
counter: BuiltIn.counter++,
|
|
25487
25489
|
mandatory: {
|
|
25488
|
-
"val": new basic_1.
|
|
25490
|
+
"val": new basic_1.NumericGenericType(),
|
|
25489
25491
|
},
|
|
25490
25492
|
return: new basic_1.FloatType(),
|
|
25491
25493
|
},
|
|
@@ -25565,7 +25567,7 @@ BuiltIn.methods = {
|
|
|
25565
25567
|
"EXP": {
|
|
25566
25568
|
counter: BuiltIn.counter++,
|
|
25567
25569
|
mandatory: {
|
|
25568
|
-
"val": new basic_1.
|
|
25570
|
+
"val": new basic_1.NumericGenericType(),
|
|
25569
25571
|
},
|
|
25570
25572
|
return: new basic_1.FloatType(),
|
|
25571
25573
|
},
|
|
@@ -25634,14 +25636,14 @@ BuiltIn.methods = {
|
|
|
25634
25636
|
"FLOOR": {
|
|
25635
25637
|
counter: BuiltIn.counter++,
|
|
25636
25638
|
mandatory: {
|
|
25637
|
-
"val": new basic_1.
|
|
25639
|
+
"val": new basic_1.NumericGenericType(),
|
|
25638
25640
|
},
|
|
25639
25641
|
return: basic_1.IntegerType.get(),
|
|
25640
25642
|
},
|
|
25641
25643
|
"FRAC": {
|
|
25642
25644
|
counter: BuiltIn.counter++,
|
|
25643
25645
|
mandatory: {
|
|
25644
|
-
"val": new basic_1.
|
|
25646
|
+
"val": new basic_1.NumericGenericType(),
|
|
25645
25647
|
},
|
|
25646
25648
|
return: basic_1.IntegerType.get(),
|
|
25647
25649
|
},
|
|
@@ -25673,8 +25675,8 @@ BuiltIn.methods = {
|
|
|
25673
25675
|
"IPOW": {
|
|
25674
25676
|
counter: BuiltIn.counter++,
|
|
25675
25677
|
mandatory: {
|
|
25676
|
-
"base": new basic_1.
|
|
25677
|
-
"exp": new basic_1.
|
|
25678
|
+
"base": new basic_1.NumericGenericType(),
|
|
25679
|
+
"exp": new basic_1.NumericGenericType(),
|
|
25678
25680
|
},
|
|
25679
25681
|
return: basic_1.IntegerType.get(),
|
|
25680
25682
|
release: version_1.Release.v740sp02,
|
|
@@ -25706,14 +25708,14 @@ BuiltIn.methods = {
|
|
|
25706
25708
|
"LOG": {
|
|
25707
25709
|
counter: BuiltIn.counter++,
|
|
25708
25710
|
mandatory: {
|
|
25709
|
-
"val": new basic_1.
|
|
25711
|
+
"val": new basic_1.NumericGenericType(),
|
|
25710
25712
|
},
|
|
25711
25713
|
return: new basic_1.FloatType(),
|
|
25712
25714
|
},
|
|
25713
25715
|
"LOG10": {
|
|
25714
25716
|
counter: BuiltIn.counter++,
|
|
25715
25717
|
mandatory: {
|
|
25716
|
-
"val": new basic_1.
|
|
25718
|
+
"val": new basic_1.NumericGenericType(),
|
|
25717
25719
|
},
|
|
25718
25720
|
return: new basic_1.FloatType(),
|
|
25719
25721
|
},
|
|
@@ -25819,7 +25821,7 @@ BuiltIn.methods = {
|
|
|
25819
25821
|
"RESCALE": {
|
|
25820
25822
|
counter: BuiltIn.counter++,
|
|
25821
25823
|
mandatory: {
|
|
25822
|
-
"val": new basic_1.
|
|
25824
|
+
"val": new basic_1.NumericGenericType(),
|
|
25823
25825
|
},
|
|
25824
25826
|
optional: {
|
|
25825
25827
|
"dec": basic_1.IntegerType.get(),
|
|
@@ -25840,7 +25842,7 @@ BuiltIn.methods = {
|
|
|
25840
25842
|
"ROUND": {
|
|
25841
25843
|
counter: BuiltIn.counter++,
|
|
25842
25844
|
mandatory: {
|
|
25843
|
-
"val": new basic_1.
|
|
25845
|
+
"val": new basic_1.NumericGenericType(),
|
|
25844
25846
|
},
|
|
25845
25847
|
optional: {
|
|
25846
25848
|
"dec": basic_1.IntegerType.get(),
|
|
@@ -25892,28 +25894,28 @@ BuiltIn.methods = {
|
|
|
25892
25894
|
"SIGN": {
|
|
25893
25895
|
counter: BuiltIn.counter++,
|
|
25894
25896
|
mandatory: {
|
|
25895
|
-
"val": new basic_1.
|
|
25897
|
+
"val": new basic_1.NumericGenericType(),
|
|
25896
25898
|
},
|
|
25897
25899
|
return: basic_1.IntegerType.get(),
|
|
25898
25900
|
},
|
|
25899
25901
|
"SIN": {
|
|
25900
25902
|
counter: BuiltIn.counter++,
|
|
25901
25903
|
mandatory: {
|
|
25902
|
-
"val": new basic_1.
|
|
25904
|
+
"val": new basic_1.NumericGenericType(),
|
|
25903
25905
|
},
|
|
25904
25906
|
return: new basic_1.FloatType(),
|
|
25905
25907
|
},
|
|
25906
25908
|
"SINH": {
|
|
25907
25909
|
counter: BuiltIn.counter++,
|
|
25908
25910
|
mandatory: {
|
|
25909
|
-
"val": new basic_1.
|
|
25911
|
+
"val": new basic_1.NumericGenericType(),
|
|
25910
25912
|
},
|
|
25911
25913
|
return: new basic_1.FloatType(),
|
|
25912
25914
|
},
|
|
25913
25915
|
"SQRT": {
|
|
25914
25916
|
counter: BuiltIn.counter++,
|
|
25915
25917
|
mandatory: {
|
|
25916
|
-
"val": new basic_1.
|
|
25918
|
+
"val": new basic_1.NumericGenericType(),
|
|
25917
25919
|
},
|
|
25918
25920
|
return: new basic_1.FloatType(),
|
|
25919
25921
|
},
|
|
@@ -26003,14 +26005,14 @@ BuiltIn.methods = {
|
|
|
26003
26005
|
"TAN": {
|
|
26004
26006
|
counter: BuiltIn.counter++,
|
|
26005
26007
|
mandatory: {
|
|
26006
|
-
"val": new basic_1.
|
|
26008
|
+
"val": new basic_1.NumericGenericType(),
|
|
26007
26009
|
},
|
|
26008
26010
|
return: new basic_1.FloatType(),
|
|
26009
26011
|
},
|
|
26010
26012
|
"TANH": {
|
|
26011
26013
|
counter: BuiltIn.counter++,
|
|
26012
26014
|
mandatory: {
|
|
26013
|
-
"val": new basic_1.
|
|
26015
|
+
"val": new basic_1.NumericGenericType(),
|
|
26014
26016
|
},
|
|
26015
26017
|
return: new basic_1.FloatType(),
|
|
26016
26018
|
},
|
|
@@ -26054,7 +26056,7 @@ BuiltIn.methods = {
|
|
|
26054
26056
|
"TRUNC": {
|
|
26055
26057
|
counter: BuiltIn.counter++,
|
|
26056
26058
|
mandatory: {
|
|
26057
|
-
"val": new basic_1.
|
|
26059
|
+
"val": new basic_1.NumericGenericType(),
|
|
26058
26060
|
},
|
|
26059
26061
|
return: basic_1.IntegerType.get(),
|
|
26060
26062
|
},
|
|
@@ -26065,9 +26067,9 @@ BuiltIn.methods = {
|
|
|
26065
26067
|
},
|
|
26066
26068
|
optional: {
|
|
26067
26069
|
"days": basic_1.IntegerType.get(),
|
|
26068
|
-
"
|
|
26069
|
-
"minutes": basic_1.
|
|
26070
|
-
"seconds": new basic_1.
|
|
26070
|
+
"hours": basic_1.IntegerType.get(),
|
|
26071
|
+
"minutes": new basic_1.Integer8Type(),
|
|
26072
|
+
"seconds": new basic_1.DecFloat34Type(),
|
|
26071
26073
|
},
|
|
26072
26074
|
return: new basic_1.UTCLongType(),
|
|
26073
26075
|
release: version_1.Release.v754,
|
|
@@ -26083,7 +26085,7 @@ BuiltIn.methods = {
|
|
|
26083
26085
|
"high": new basic_1.UTCLongType(),
|
|
26084
26086
|
"low": new basic_1.UTCLongType(),
|
|
26085
26087
|
},
|
|
26086
|
-
return: new basic_1.
|
|
26088
|
+
return: new basic_1.DecFloat34Type(),
|
|
26087
26089
|
release: version_1.Release.v754,
|
|
26088
26090
|
},
|
|
26089
26091
|
"XSDBOOL": {
|
|
@@ -27435,7 +27437,12 @@ class Procedural {
|
|
|
27435
27437
|
this.scope = scope;
|
|
27436
27438
|
this.reg = reg;
|
|
27437
27439
|
}
|
|
27438
|
-
addAllFormDefinitions(file, obj) {
|
|
27440
|
+
addAllFormDefinitions(file, obj, visited = new Set()) {
|
|
27441
|
+
// an include reached again through a cycle of INCLUDEs is not walked twice
|
|
27442
|
+
if (visited.has(file.getFilename())) {
|
|
27443
|
+
return;
|
|
27444
|
+
}
|
|
27445
|
+
visited.add(file.getFilename());
|
|
27439
27446
|
const structure = file.getStructure();
|
|
27440
27447
|
if (structure) {
|
|
27441
27448
|
const input = {
|
|
@@ -27456,12 +27463,12 @@ class Procedural {
|
|
|
27456
27463
|
for (const node of includes) {
|
|
27457
27464
|
const found = this.findInclude(node, obj);
|
|
27458
27465
|
if (found) {
|
|
27459
|
-
this.addAllFormDefinitions(found, obj);
|
|
27466
|
+
this.addAllFormDefinitions(found, obj, visited);
|
|
27460
27467
|
}
|
|
27461
27468
|
}
|
|
27462
27469
|
}
|
|
27463
27470
|
findInclude(node, obj) {
|
|
27464
|
-
//
|
|
27471
|
+
// cyclic includes are cut by the callers, includes not found are reported by rule "check_include"
|
|
27465
27472
|
// todo: how to make sure code is not duplicated here and in rule "check_include" / include graph?
|
|
27466
27473
|
const expr = node.findFirstExpression(Expressions.IncludeName);
|
|
27467
27474
|
if (expr === undefined) {
|
|
@@ -28263,7 +28270,9 @@ class TypeUtils {
|
|
|
28263
28270
|
return false;
|
|
28264
28271
|
}
|
|
28265
28272
|
else if (source instanceof basic_1.Integer8Type) {
|
|
28266
|
-
if (target instanceof basic_1.IntegerType
|
|
28273
|
+
if (target instanceof basic_1.IntegerType
|
|
28274
|
+
|| target instanceof basic_1.StringType
|
|
28275
|
+
|| target instanceof basic_1.FloatType) {
|
|
28267
28276
|
return false;
|
|
28268
28277
|
}
|
|
28269
28278
|
}
|
|
@@ -30131,7 +30140,11 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
|
|
|
30131
30140
|
// On a character or byte field of fixed length the substring must lie inside the field, else it is
|
|
30132
30141
|
// a syntax error. Other types, a dynamic offset or length and "*" (undefined) are left alone, as is
|
|
30133
30142
|
// length 0. The offset is applied first, so the length is compared to what remains after the offset.
|
|
30143
|
+
// A substring of a date, time or numeric text field has type n; its bounds are not checked.
|
|
30134
30144
|
function substringType(context, offset, length, node, input) {
|
|
30145
|
+
if (context instanceof basic_1.DateType || context instanceof basic_1.TimeType || context instanceof basic_1.NumericType) {
|
|
30146
|
+
return numericSubstringType(context, offset, length);
|
|
30147
|
+
}
|
|
30135
30148
|
if (!(context instanceof basic_1.CharacterType) && !(context instanceof basic_1.HexType)) {
|
|
30136
30149
|
return context;
|
|
30137
30150
|
}
|
|
@@ -30154,6 +30167,24 @@ function substringType(context, offset, length, node, input) {
|
|
|
30154
30167
|
}
|
|
30155
30168
|
return context;
|
|
30156
30169
|
}
|
|
30170
|
+
function numericSubstringType(context, offset, length) {
|
|
30171
|
+
const hasOffset = offset !== undefined && offset > 0;
|
|
30172
|
+
const hasLength = length !== undefined && length > 0;
|
|
30173
|
+
if (hasOffset === false && hasLength === false) {
|
|
30174
|
+
return context;
|
|
30175
|
+
}
|
|
30176
|
+
let remaining = context instanceof basic_1.DateType ? 8 : context instanceof basic_1.TimeType ? 6 : context.getLength();
|
|
30177
|
+
if (hasOffset) {
|
|
30178
|
+
remaining = remaining - offset;
|
|
30179
|
+
}
|
|
30180
|
+
if (hasLength) {
|
|
30181
|
+
remaining = Math.min(remaining, length);
|
|
30182
|
+
}
|
|
30183
|
+
if (remaining <= 0) {
|
|
30184
|
+
return context;
|
|
30185
|
+
}
|
|
30186
|
+
return new basic_1.NumericType(remaining);
|
|
30187
|
+
}
|
|
30157
30188
|
// A field symbol typed "c" or "x" is generic, but its type is represented with length 1, so the
|
|
30158
30189
|
// offset or length at "index" is not checked when it directly follows the field symbol
|
|
30159
30190
|
function isFieldSymbolItself(children, index) {
|
|
@@ -40286,6 +40317,16 @@ class Convert {
|
|
|
40286
40317
|
target_1.Target.runSyntax(stampTarget, input);
|
|
40287
40318
|
}
|
|
40288
40319
|
}
|
|
40320
|
+
const utclongTarget = node.findExpressionAfterToken("UTCLONG");
|
|
40321
|
+
if ((utclongTarget === null || utclongTarget === void 0 ? void 0 : utclongTarget.get()) instanceof Expressions.Target) {
|
|
40322
|
+
const inline = utclongTarget === null || utclongTarget === void 0 ? void 0 : utclongTarget.findDirectExpression(Expressions.InlineData);
|
|
40323
|
+
if (inline) {
|
|
40324
|
+
inline_data_1.InlineData.runSyntax(inline, input, new basic_1.UTCLongType());
|
|
40325
|
+
}
|
|
40326
|
+
else {
|
|
40327
|
+
target_1.Target.runSyntax(utclongTarget, input);
|
|
40328
|
+
}
|
|
40329
|
+
}
|
|
40289
40330
|
}
|
|
40290
40331
|
}
|
|
40291
40332
|
exports.Convert = Convert;
|
|
@@ -49806,6 +49847,8 @@ if (Object.keys(map).length === 0) {
|
|
|
49806
49847
|
// -----------------------------------
|
|
49807
49848
|
class SyntaxLogic {
|
|
49808
49849
|
constructor(reg, object) {
|
|
49850
|
+
// files the traversal walked into through INCLUDEs, outermost first
|
|
49851
|
+
this.includeStack = [];
|
|
49809
49852
|
this.reg = reg;
|
|
49810
49853
|
this.issues = [];
|
|
49811
49854
|
this.deferred = [];
|
|
@@ -49913,11 +49956,20 @@ class SyntaxLogic {
|
|
|
49913
49956
|
// walk into INCLUDEs
|
|
49914
49957
|
if (isStatement && child.get() instanceof Statements.Include) {
|
|
49915
49958
|
const file = this.helpers.proc.findInclude(child, this.object);
|
|
49916
|
-
|
|
49959
|
+
// an INCLUDE that leads back to a file already being walked is not followed again
|
|
49960
|
+
const cyclic = file !== undefined && (file.getFilename() === this.currentFile.getFilename()
|
|
49961
|
+
|| this.includeStack.includes(file.getFilename()));
|
|
49962
|
+
if (file !== undefined && file.getStructure() !== undefined && cyclic === false) {
|
|
49917
49963
|
const old = this.currentFile;
|
|
49964
|
+
this.includeStack.push(old.getFilename());
|
|
49918
49965
|
this.currentFile = file;
|
|
49919
|
-
|
|
49920
|
-
|
|
49966
|
+
try {
|
|
49967
|
+
this.traverse(file.getStructure());
|
|
49968
|
+
}
|
|
49969
|
+
finally {
|
|
49970
|
+
this.currentFile = old;
|
|
49971
|
+
this.includeStack.pop();
|
|
49972
|
+
}
|
|
49921
49973
|
}
|
|
49922
49974
|
}
|
|
49923
49975
|
if (isStructure || isStatement) {
|
|
@@ -50327,11 +50379,46 @@ exports.ArtifactsABAP = ArtifactsABAP;
|
|
|
50327
50379
|
|
|
50328
50380
|
"use strict";
|
|
50329
50381
|
|
|
50382
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
50383
|
+
if (k2 === undefined) k2 = k;
|
|
50384
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
50385
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
50386
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
50387
|
+
}
|
|
50388
|
+
Object.defineProperty(o, k2, desc);
|
|
50389
|
+
}) : (function(o, m, k, k2) {
|
|
50390
|
+
if (k2 === undefined) k2 = k;
|
|
50391
|
+
o[k2] = m[k];
|
|
50392
|
+
}));
|
|
50393
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
50394
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
50395
|
+
}) : function(o, v) {
|
|
50396
|
+
o["default"] = v;
|
|
50397
|
+
});
|
|
50398
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
50399
|
+
var ownKeys = function(o) {
|
|
50400
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
50401
|
+
var ar = [];
|
|
50402
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
50403
|
+
return ar;
|
|
50404
|
+
};
|
|
50405
|
+
return ownKeys(o);
|
|
50406
|
+
};
|
|
50407
|
+
return function (mod) {
|
|
50408
|
+
if (mod && mod.__esModule) return mod;
|
|
50409
|
+
var result = {};
|
|
50410
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
50411
|
+
__setModuleDefault(result, mod);
|
|
50412
|
+
return result;
|
|
50413
|
+
};
|
|
50414
|
+
})();
|
|
50330
50415
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
50331
50416
|
exports.CrossIncludeMacros = void 0;
|
|
50332
50417
|
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
50333
50418
|
const program_1 = __webpack_require__(/*! ../objects/program */ "../core/build/src/objects/program.js");
|
|
50334
50419
|
const _statement_1 = __webpack_require__(/*! ./2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
50420
|
+
const statements_1 = __webpack_require__(/*! ./2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js");
|
|
50421
|
+
const Expressions = __importStar(__webpack_require__(/*! ./2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
50335
50422
|
const expand_macros_1 = __webpack_require__(/*! ./2_statements/expand_macros */ "../core/build/src/abap/2_statements/expand_macros.js");
|
|
50336
50423
|
const include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ "../core/build/src/utils/include_graph.js");
|
|
50337
50424
|
// Macros can be defined in one include and used in a sibling include, connected
|
|
@@ -50344,6 +50431,7 @@ class CrossIncludeMacros {
|
|
|
50344
50431
|
this.reg = reg;
|
|
50345
50432
|
}
|
|
50346
50433
|
run() {
|
|
50434
|
+
this.reparseCyclicPrograms();
|
|
50347
50435
|
const candidates = this.findCandidates();
|
|
50348
50436
|
if (candidates.length === 0) {
|
|
50349
50437
|
return;
|
|
@@ -50371,6 +50459,45 @@ class CrossIncludeMacros {
|
|
|
50371
50459
|
}
|
|
50372
50460
|
}
|
|
50373
50461
|
//////////////////////////////
|
|
50462
|
+
// A program or include in an INCLUDE cycle can be parsed while the include defining its macros is still
|
|
50463
|
+
// being parsed, depending on the order the files were added. Everything is parsed now, so parse it again.
|
|
50464
|
+
reparseCyclicPrograms() {
|
|
50465
|
+
const config = this.reg.getConfig();
|
|
50466
|
+
for (const obj of this.reg.getObjects()) {
|
|
50467
|
+
if (obj instanceof program_1.Program && this.hasUnknown(obj) && this.isInIncludeCycle(obj)) {
|
|
50468
|
+
obj.setDirty();
|
|
50469
|
+
obj.parse(config.getRelease(), config.getSyntaxSetttings().globalMacros, this.reg, config.getLanguageVersion());
|
|
50470
|
+
}
|
|
50471
|
+
}
|
|
50472
|
+
}
|
|
50473
|
+
hasUnknown(prog) {
|
|
50474
|
+
return prog.getABAPFiles().some(f => f.getStatements().some(s => s.get() instanceof _statement_1.Unknown));
|
|
50475
|
+
}
|
|
50476
|
+
// the include graph does not link INCLUDEs of main programs, so follow the INCLUDEs from the program
|
|
50477
|
+
isInIncludeCycle(prog) {
|
|
50478
|
+
var _a;
|
|
50479
|
+
const seen = new Set();
|
|
50480
|
+
const stack = [prog];
|
|
50481
|
+
while (stack.length > 0) {
|
|
50482
|
+
for (const file of stack.pop().getABAPFiles()) {
|
|
50483
|
+
for (const statement of file.getStatements()) {
|
|
50484
|
+
if (!(statement.get() instanceof statements_1.Include)) {
|
|
50485
|
+
continue;
|
|
50486
|
+
}
|
|
50487
|
+
const name = (_a = statement.findDirectExpression(Expressions.IncludeName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
50488
|
+
const included = this.reg.getObject("PROG", name);
|
|
50489
|
+
if (included === prog) {
|
|
50490
|
+
return true;
|
|
50491
|
+
}
|
|
50492
|
+
else if (included instanceof program_1.Program && seen.has(included) === false) {
|
|
50493
|
+
seen.add(included);
|
|
50494
|
+
stack.push(included);
|
|
50495
|
+
}
|
|
50496
|
+
}
|
|
50497
|
+
}
|
|
50498
|
+
}
|
|
50499
|
+
return false;
|
|
50500
|
+
}
|
|
50374
50501
|
findCandidates() {
|
|
50375
50502
|
const ret = [];
|
|
50376
50503
|
for (const obj of this.reg.getObjects()) {
|
|
@@ -62144,6 +62271,7 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
|
|
|
62144
62271
|
}
|
|
62145
62272
|
constructor(name) {
|
|
62146
62273
|
super(name);
|
|
62274
|
+
this.parsing = false;
|
|
62147
62275
|
this.parsed = [];
|
|
62148
62276
|
this.texts = undefined;
|
|
62149
62277
|
this.rawXMLCache = undefined;
|
|
@@ -62152,11 +62280,19 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
|
|
|
62152
62280
|
return !!x && x instanceof ABAPObject;
|
|
62153
62281
|
}
|
|
62154
62282
|
parse(release, globalMacros, reg, languageVersion = version_1.LanguageVersion.Normal) {
|
|
62155
|
-
|
|
62283
|
+
// an INCLUDE that leads back to this object while it is being parsed is not followed again
|
|
62284
|
+
if (this.isDirty() === false || this.parsing === true) {
|
|
62156
62285
|
return { updated: false, runtime: 0 };
|
|
62157
62286
|
}
|
|
62158
62287
|
const abapFiles = this.getFiles().filter(f => f.getFilename().endsWith(".abap"));
|
|
62159
|
-
|
|
62288
|
+
let result;
|
|
62289
|
+
this.parsing = true;
|
|
62290
|
+
try {
|
|
62291
|
+
result = new abap_parser_1.ABAPParser({ release, globalMacros, reg, languageVersion }).parse(abapFiles);
|
|
62292
|
+
}
|
|
62293
|
+
finally {
|
|
62294
|
+
this.parsing = false;
|
|
62295
|
+
}
|
|
62160
62296
|
this.parsed = result.output;
|
|
62161
62297
|
this.old = result.issues;
|
|
62162
62298
|
this.dirty = false;
|
|
@@ -71373,7 +71509,7 @@ class Registry {
|
|
|
71373
71509
|
}
|
|
71374
71510
|
static abaplintVersion() {
|
|
71375
71511
|
// magic, see build script "version.js"
|
|
71376
|
-
return "2.120.
|
|
71512
|
+
return "2.120.80";
|
|
71377
71513
|
}
|
|
71378
71514
|
getDDICReferences() {
|
|
71379
71515
|
return this.ddicReferences;
|
|
@@ -89957,6 +90093,7 @@ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js"
|
|
|
89957
90093
|
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
89958
90094
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
89959
90095
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
90096
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
89960
90097
|
class MaxOneMethodParameterPerLineConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
89961
90098
|
}
|
|
89962
90099
|
exports.MaxOneMethodParameterPerLineConf = MaxOneMethodParameterPerLineConf;
|
|
@@ -89970,7 +90107,7 @@ class MaxOneMethodParameterPerLine extends _abap_rule_1.ABAPRule {
|
|
|
89970
90107
|
key: "max_one_method_parameter_per_line",
|
|
89971
90108
|
title: "Max one method parameter definition per line",
|
|
89972
90109
|
shortDescription: `Keep max one method parameter description per line`,
|
|
89973
|
-
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace],
|
|
90110
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix],
|
|
89974
90111
|
badExample: `
|
|
89975
90112
|
METHODS apps_scope_token
|
|
89976
90113
|
IMPORTING
|
|
@@ -89999,7 +90136,8 @@ METHODS apps_scope_token
|
|
|
89999
90136
|
continue;
|
|
90000
90137
|
}
|
|
90001
90138
|
if (prev.getFirstToken().getStart().getRow() === p.getFirstToken().getStart().getRow()) {
|
|
90002
|
-
const
|
|
90139
|
+
const fix = this.buildFix(file, statement, p);
|
|
90140
|
+
const issue = issue_1.Issue.atToken(file, prev.getFirstToken(), this.getMetadata().title, this.getMetadata().key, this.conf.severity, fix);
|
|
90003
90141
|
issues.push(issue);
|
|
90004
90142
|
}
|
|
90005
90143
|
prev = p;
|
|
@@ -90007,8 +90145,32 @@ METHODS apps_scope_token
|
|
|
90007
90145
|
}
|
|
90008
90146
|
return issues;
|
|
90009
90147
|
}
|
|
90148
|
+
/** moves the parameter, or its preceding section keyword, to a new line */
|
|
90149
|
+
buildFix(file, statement, param) {
|
|
90150
|
+
const tokens = statement.getTokens();
|
|
90151
|
+
const index = tokens.indexOf(param.getFirstToken());
|
|
90152
|
+
if (index < 1) {
|
|
90153
|
+
return undefined;
|
|
90154
|
+
}
|
|
90155
|
+
let target = tokens[index];
|
|
90156
|
+
let indent = statement.findFirstExpression(Expressions.MethodParam).getFirstToken().getStart().getCol();
|
|
90157
|
+
const before = tokens[index - 1];
|
|
90158
|
+
if (MaxOneMethodParameterPerLine.SECTIONS.includes(before.getStr().toUpperCase())) {
|
|
90159
|
+
if (index < 2) {
|
|
90160
|
+
return undefined;
|
|
90161
|
+
}
|
|
90162
|
+
target = before;
|
|
90163
|
+
indent = tokens.find(t => MaxOneMethodParameterPerLine.SECTIONS.includes(t.getStr().toUpperCase())).getStart().getCol();
|
|
90164
|
+
}
|
|
90165
|
+
const previous = tokens[tokens.indexOf(target) - 1];
|
|
90166
|
+
if (previous.getEnd().getRow() !== target.getStart().getRow()) {
|
|
90167
|
+
return undefined;
|
|
90168
|
+
}
|
|
90169
|
+
return edit_helper_1.EditHelper.replaceRange(file, previous.getEnd(), target.getStart(), "\n" + " ".repeat(indent - 1));
|
|
90170
|
+
}
|
|
90010
90171
|
}
|
|
90011
90172
|
exports.MaxOneMethodParameterPerLine = MaxOneMethodParameterPerLine;
|
|
90173
|
+
MaxOneMethodParameterPerLine.SECTIONS = ["IMPORTING", "EXPORTING", "CHANGING", "RETURNING"];
|
|
90012
90174
|
//# sourceMappingURL=max_one_method_parameter_per_line.js.map
|
|
90013
90175
|
|
|
90014
90176
|
/***/ },
|
|
@@ -96433,7 +96595,7 @@ class PreferPragmas extends _abap_rule_1.ABAPRule {
|
|
|
96433
96595
|
return {
|
|
96434
96596
|
key: "prefer_pragmas",
|
|
96435
96597
|
title: "prefer pragmas over pseudo comments ",
|
|
96436
|
-
shortDescription: `prefer pragmas over pseudo comments
|
|
96598
|
+
shortDescription: `prefer pragmas over pseudo comments`,
|
|
96437
96599
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-pragmas-to-pseudo-comments`,
|
|
96438
96600
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
96439
96601
|
badExample: `DATA foo1 TYPE i. "#EC NEEDED`,
|
|
@@ -98322,9 +98484,9 @@ text = text.`,
|
|
|
98322
98484
|
context = this.infer(context, this.sourceType(child, scope));
|
|
98323
98485
|
}
|
|
98324
98486
|
else if (child.get() instanceof Expressions.ArithOperator) {
|
|
98325
|
-
|
|
98326
|
-
|
|
98327
|
-
|
|
98487
|
+
// the CONV sets the calculation type of arithmetic expressions, only redundant
|
|
98488
|
+
// if the assignment target has the same type, see arithmeticUsesSameTargetType
|
|
98489
|
+
return undefined;
|
|
98328
98490
|
}
|
|
98329
98491
|
else {
|
|
98330
98492
|
return undefined;
|
|
@@ -107003,7 +107165,6 @@ const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/pos
|
|
|
107003
107165
|
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
107004
107166
|
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
107005
107167
|
const severity_1 = __webpack_require__(/*! ../severity */ "../core/build/src/severity.js");
|
|
107006
|
-
// todo, check for cycles/circular dependencies, method findTop
|
|
107007
107168
|
// todo, add configurable error for multiple use includes
|
|
107008
107169
|
const FMXXINCLUDE = /^(\/\w+\/)?L.+XX$/;
|
|
107009
107170
|
function getABAPObjects(reg) {
|
|
@@ -107039,11 +107200,33 @@ class Graph {
|
|
|
107039
107200
|
}
|
|
107040
107201
|
this.edges[from.filename].push(toFilename);
|
|
107041
107202
|
}
|
|
107042
|
-
|
|
107203
|
+
// true if "to" is reachable from "from" via the edges, "from" itself counts
|
|
107204
|
+
isReachable(from, to) {
|
|
107205
|
+
const seen = new Set();
|
|
107206
|
+
const stack = [from];
|
|
107207
|
+
while (stack.length > 0) {
|
|
107208
|
+
const current = stack.pop();
|
|
107209
|
+
if (current === to) {
|
|
107210
|
+
return true;
|
|
107211
|
+
}
|
|
107212
|
+
if (seen.has(current) === false) {
|
|
107213
|
+
seen.add(current);
|
|
107214
|
+
stack.push(...this.edges[current] || []);
|
|
107215
|
+
}
|
|
107216
|
+
}
|
|
107217
|
+
return false;
|
|
107218
|
+
}
|
|
107219
|
+
findTop(filename, path = new Set()) {
|
|
107043
107220
|
const ret = [];
|
|
107221
|
+
path.add(filename);
|
|
107044
107222
|
for (const to of this.edges[filename] || []) {
|
|
107045
|
-
|
|
107223
|
+
// an INCLUDE cycle, the file is already on the current path
|
|
107224
|
+
if (path.has(to)) {
|
|
107225
|
+
continue;
|
|
107226
|
+
}
|
|
107227
|
+
ret.push(...this.findTop(to, path));
|
|
107046
107228
|
}
|
|
107229
|
+
path.delete(filename);
|
|
107047
107230
|
if (ret.length === 0) {
|
|
107048
107231
|
const found = this.findVertexByFilename(filename);
|
|
107049
107232
|
if (found !== undefined) {
|
|
@@ -107098,6 +107281,7 @@ class IncludeGraph {
|
|
|
107098
107281
|
///////////////////////////////
|
|
107099
107282
|
build() {
|
|
107100
107283
|
this.addVertices();
|
|
107284
|
+
const included = [];
|
|
107101
107285
|
for (const o of getABAPObjects(this.reg)) {
|
|
107102
107286
|
for (const f of o.getABAPFiles()) {
|
|
107103
107287
|
if (f.getFilename().includes(".prog.screen_") || f.getFilename().includes(".fugr.screen_")) {
|
|
@@ -107128,11 +107312,19 @@ class IncludeGraph {
|
|
|
107128
107312
|
}
|
|
107129
107313
|
else {
|
|
107130
107314
|
this.graph.addEdge(found, f.getFilename());
|
|
107315
|
+
included.push({ file: f, statement: s, vertex: found, name });
|
|
107131
107316
|
}
|
|
107132
107317
|
}
|
|
107133
107318
|
}
|
|
107134
107319
|
}
|
|
107135
107320
|
}
|
|
107321
|
+
// cycles are not followed, but ABAP rejects them, so report them
|
|
107322
|
+
for (const i of included) {
|
|
107323
|
+
if (this.graph.isReachable(i.file.getFilename(), i.vertex.filename)) {
|
|
107324
|
+
const issue = issue_1.Issue.atStatement(i.file, i.statement, "Cyclic INCLUDE, " + i.name, new check_include_1.CheckInclude().getMetadata().key, this.severity);
|
|
107325
|
+
this.issues.push(issue);
|
|
107326
|
+
}
|
|
107327
|
+
}
|
|
107136
107328
|
}
|
|
107137
107329
|
addVertices() {
|
|
107138
107330
|
for (const o of getABAPObjects(this.reg)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.80",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.120.
|
|
42
|
+
"@abaplint/core": "^2.120.80",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|