@abaplint/transpiler-cli 2.14.9 → 2.14.11
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/bundle.js +3077 -184
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -1619,11 +1619,40 @@ exports.LexerStream = LexerStream;
|
|
|
1619
1619
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1620
1620
|
exports.AbstractToken = void 0;
|
|
1621
1621
|
const position_1 = __webpack_require__(/*! ../../../position */ "./node_modules/@abaplint/core/build/src/position.js");
|
|
1622
|
-
|
|
1622
|
+
const virtual_position_1 = __webpack_require__(/*! ../../../virtual_position */ "./node_modules/@abaplint/core/build/src/virtual_position.js");
|
|
1623
|
+
// token strings repeat a lot across files (keywords, common names, upper cased copies), share them.
|
|
1624
|
+
// Longer strings are typically comments or text literals, not worth sharing
|
|
1625
|
+
const INTERN_MAX_LENGTH = 30;
|
|
1626
|
+
// bound the table, it lives for the lifetime of the process
|
|
1627
|
+
const INTERN_MAX_ENTRIES = 100000;
|
|
1628
|
+
// V8 represents substrings of this length or longer as slices that reference the full source,
|
|
1629
|
+
// these are flattened before being stored, so the table does not keep removed files alive
|
|
1630
|
+
const SLICED_MIN_LENGTH = 13;
|
|
1631
|
+
let interned = new Map();
|
|
1632
|
+
function intern(str) {
|
|
1633
|
+
if (str.length > INTERN_MAX_LENGTH) {
|
|
1634
|
+
return str;
|
|
1635
|
+
}
|
|
1636
|
+
const found = interned.get(str);
|
|
1637
|
+
if (found !== undefined) {
|
|
1638
|
+
return found;
|
|
1639
|
+
}
|
|
1640
|
+
if (interned.size >= INTERN_MAX_ENTRIES) {
|
|
1641
|
+
interned = new Map();
|
|
1642
|
+
}
|
|
1643
|
+
const copy = str.length >= SLICED_MIN_LENGTH ? str.split("").join("") : str;
|
|
1644
|
+
interned.set(copy, copy);
|
|
1645
|
+
return copy;
|
|
1646
|
+
}
|
|
1647
|
+
// the token is its own start position, saves a separate Position object per token
|
|
1648
|
+
class AbstractToken extends position_1.Position {
|
|
1623
1649
|
constructor(start, str) {
|
|
1624
|
-
|
|
1625
|
-
this.str = str;
|
|
1626
|
-
this.strUpper = str.toUpperCase();
|
|
1650
|
+
super(start.getRow(), start.getCol());
|
|
1651
|
+
this.str = intern(str);
|
|
1652
|
+
this.strUpper = intern(str.toUpperCase());
|
|
1653
|
+
if (start instanceof virtual_position_1.VirtualPosition) {
|
|
1654
|
+
this.virtual = start;
|
|
1655
|
+
}
|
|
1627
1656
|
}
|
|
1628
1657
|
// special function, for debugging purposes, see https://github.com/abaplint/abaplint/pull/3137
|
|
1629
1658
|
[Symbol.for("debug.description")]() {
|
|
@@ -1635,17 +1664,12 @@ class AbstractToken {
|
|
|
1635
1664
|
getUpperStr() {
|
|
1636
1665
|
return this.strUpper;
|
|
1637
1666
|
}
|
|
1638
|
-
getRow() {
|
|
1639
|
-
return this.start.getRow();
|
|
1640
|
-
}
|
|
1641
|
-
getCol() {
|
|
1642
|
-
return this.start.getCol();
|
|
1643
|
-
}
|
|
1644
1667
|
getStart() {
|
|
1645
|
-
|
|
1668
|
+
var _a;
|
|
1669
|
+
return (_a = this.virtual) !== null && _a !== void 0 ? _a : this;
|
|
1646
1670
|
}
|
|
1647
1671
|
getEnd() {
|
|
1648
|
-
return new position_1.Position(this.
|
|
1672
|
+
return new position_1.Position(this.getRow(), this.getCol() + this.str.length);
|
|
1649
1673
|
}
|
|
1650
1674
|
}
|
|
1651
1675
|
exports.AbstractToken = AbstractToken;
|
|
@@ -12333,23 +12357,25 @@ class Result {
|
|
|
12333
12357
|
return this.tokens[this.tokenIndex + offset];
|
|
12334
12358
|
}
|
|
12335
12359
|
shift(node) {
|
|
12336
|
-
return Result.fromChain(this.tokens, this.tokenIndex + 1, { node, previous: this.nodes }, this.nodeCount + 1);
|
|
12360
|
+
return Result.fromChain(this.tokens, this.tokenIndex + 1, { node, tokenCount: 1, previous: this.nodes }, this.nodeCount + 1);
|
|
12337
12361
|
}
|
|
12338
12362
|
wrapConsumed(consumedTokens, node) {
|
|
12339
12363
|
let current = this.nodes;
|
|
12340
12364
|
let currentCount = this.nodeCount;
|
|
12365
|
+
let tokenCount = 0;
|
|
12341
12366
|
const children = [];
|
|
12342
12367
|
while (consumedTokens > 0) {
|
|
12343
12368
|
if (current === undefined) {
|
|
12344
12369
|
break;
|
|
12345
12370
|
}
|
|
12346
12371
|
children.push(current.node);
|
|
12347
|
-
consumedTokens = consumedTokens - current.
|
|
12372
|
+
consumedTokens = consumedTokens - current.tokenCount;
|
|
12373
|
+
tokenCount = tokenCount + current.tokenCount;
|
|
12348
12374
|
current = current.previous;
|
|
12349
12375
|
currentCount--;
|
|
12350
12376
|
}
|
|
12351
12377
|
node.setChildren(children.reverse());
|
|
12352
|
-
this.nodes = { node, previous: current };
|
|
12378
|
+
this.nodes = { node, tokenCount, previous: current };
|
|
12353
12379
|
this.nodeCount = currentCount + 1;
|
|
12354
12380
|
return this;
|
|
12355
12381
|
}
|
|
@@ -12378,7 +12404,7 @@ class Result {
|
|
|
12378
12404
|
this.nodes = undefined;
|
|
12379
12405
|
this.nodeCount = 0;
|
|
12380
12406
|
for (const node of n) {
|
|
12381
|
-
this.nodes = { node, previous: this.nodes };
|
|
12407
|
+
this.nodes = { node, tokenCount: node.countTokens(), previous: this.nodes };
|
|
12382
12408
|
this.nodeCount++;
|
|
12383
12409
|
}
|
|
12384
12410
|
}
|
|
@@ -20468,11 +20494,15 @@ class Submit {
|
|
|
20468
20494
|
const datasetExpiration = (0, combi_1.seq)("DATASET EXPIRATION", expressions_1.Source);
|
|
20469
20495
|
const coverText = (0, combi_1.seq)("COVER TEXT", expressions_1.Source);
|
|
20470
20496
|
const listName = (0, combi_1.seq)("LIST NAME", expressions_1.Source);
|
|
20497
|
+
const listDataset = (0, combi_1.seq)("LIST DATASET", expressions_1.Source);
|
|
20498
|
+
const listAuthority = (0, combi_1.seq)("LIST AUTHORITY", expressions_1.Source);
|
|
20499
|
+
const coverPage = (0, combi_1.seq)("COVER PAGE", expressions_1.Source);
|
|
20500
|
+
const department = (0, combi_1.seq)("DEPARTMENT", expressions_1.Source);
|
|
20471
20501
|
const keep = (0, combi_1.seq)("KEEP IN SPOOL", expressions_1.Source);
|
|
20472
20502
|
const imm = (0, combi_1.seq)("IMMEDIATELY", expressions_1.Source);
|
|
20473
20503
|
const dest = (0, combi_1.seq)("DESTINATION", expressions_1.Source);
|
|
20474
20504
|
const language = (0, combi_1.seq)("LANGUAGE", expressions_1.Source);
|
|
20475
|
-
const perm = (0, combi_1.per)((0, combi_1.plusPrio)(awith), selectionTable, (0, combi_1.plusPrio)(awith), (0, combi_1.plusPrio)(awith), spool, lineSize, lineCount, archive, archiveMode, receiver, user, sset, ssetp, keep, cover, imm, layout, dest, coverText, listName, language, free, newList, uss, copies, datasetExpiration, "TO SAP-SPOOL", "WITHOUT SPOOL DYNPRO", "VIA SELECTION-SCREEN", exporting, expressions_1.AndReturn, job);
|
|
20505
|
+
const perm = (0, combi_1.per)((0, combi_1.plusPrio)(awith), selectionTable, (0, combi_1.plusPrio)(awith), (0, combi_1.plusPrio)(awith), spool, lineSize, lineCount, archive, archiveMode, receiver, user, sset, ssetp, keep, cover, imm, layout, dest, coverText, listName, listDataset, listAuthority, coverPage, department, language, free, newList, uss, copies, datasetExpiration, "TO SAP-SPOOL", "WITHOUT SPOOL DYNPRO", "VIA SELECTION-SCREEN", exporting, expressions_1.AndReturn, job);
|
|
20476
20506
|
const ret = (0, combi_1.seq)("SUBMIT", prog, (0, combi_1.opt)(perm));
|
|
20477
20507
|
return (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, ret);
|
|
20478
20508
|
}
|
|
@@ -27265,7 +27295,7 @@ class CurrentScope {
|
|
|
27265
27295
|
else if (this.isOO() && this.current.getData().vars[upper] !== undefined) {
|
|
27266
27296
|
throw new Error(`"${name}" already defined`);
|
|
27267
27297
|
}
|
|
27268
|
-
this.current.
|
|
27298
|
+
this.current.setType(upper, type);
|
|
27269
27299
|
}
|
|
27270
27300
|
addExtraLikeType(type) {
|
|
27271
27301
|
if (type === undefined) {
|
|
@@ -27284,7 +27314,7 @@ class CurrentScope {
|
|
|
27284
27314
|
if (this.current.getData().extraLikeTypes[upper] !== undefined) {
|
|
27285
27315
|
throw new Error(`Type name "${name}" already defined`);
|
|
27286
27316
|
}
|
|
27287
|
-
this.current.
|
|
27317
|
+
this.current.setExtraLikeType(upper, type);
|
|
27288
27318
|
}
|
|
27289
27319
|
addClassDefinition(c) {
|
|
27290
27320
|
if (this.current === undefined) {
|
|
@@ -27294,13 +27324,13 @@ class CurrentScope {
|
|
|
27294
27324
|
if (this.current.getData().cdefs[name] !== undefined) {
|
|
27295
27325
|
throw new Error(`Class "${name}" already defined`);
|
|
27296
27326
|
}
|
|
27297
|
-
this.current.
|
|
27327
|
+
this.current.setClassDefinition(name, c);
|
|
27298
27328
|
}
|
|
27299
27329
|
addFormDefinitions(f) {
|
|
27300
27330
|
if (this.current === undefined) {
|
|
27301
27331
|
return;
|
|
27302
27332
|
}
|
|
27303
|
-
this.current.
|
|
27333
|
+
this.current.addFormDefinitions(f);
|
|
27304
27334
|
}
|
|
27305
27335
|
/** The FORM definitions are built up front, at that point the program level types are not known.
|
|
27306
27336
|
* When the FORM statement is traversed it is replaced with one resolved in the scope of the FORM */
|
|
@@ -27325,7 +27355,7 @@ class CurrentScope {
|
|
|
27325
27355
|
if (this.current.getData().cdefs[name] !== undefined) {
|
|
27326
27356
|
throw new Error(`Interface "${name}" already defined`);
|
|
27327
27357
|
}
|
|
27328
|
-
this.current.
|
|
27358
|
+
this.current.setInterfaceDefinition(name, i);
|
|
27329
27359
|
}
|
|
27330
27360
|
addNamedIdentifier(name, identifier) {
|
|
27331
27361
|
if (this.current === undefined) {
|
|
@@ -27339,7 +27369,7 @@ class CurrentScope {
|
|
|
27339
27369
|
else if (this.isOO() && this.current.getData().types[upper] !== undefined) {
|
|
27340
27370
|
throw new Error(`"${name}" already defined`);
|
|
27341
27371
|
}
|
|
27342
|
-
this.current.
|
|
27372
|
+
this.current.setVariable(upper, identifier);
|
|
27343
27373
|
}
|
|
27344
27374
|
addNamedIdentifierToParent(name, identifier) {
|
|
27345
27375
|
if (this.current === undefined) {
|
|
@@ -27357,7 +27387,7 @@ class CurrentScope {
|
|
|
27357
27387
|
else if (this.isOO() && parent.getData().types[upper] !== undefined) {
|
|
27358
27388
|
throw new Error(`"${name}" already defined`);
|
|
27359
27389
|
}
|
|
27360
|
-
parent.
|
|
27390
|
+
parent.setVariable(upper, identifier);
|
|
27361
27391
|
}
|
|
27362
27392
|
addIdentifier(identifier) {
|
|
27363
27393
|
if (identifier === undefined) {
|
|
@@ -27369,7 +27399,7 @@ class CurrentScope {
|
|
|
27369
27399
|
if (token === undefined) {
|
|
27370
27400
|
return;
|
|
27371
27401
|
}
|
|
27372
|
-
this.current.
|
|
27402
|
+
this.current.setDeferred(token.getStr().toUpperCase(), { token, ooType: type });
|
|
27373
27403
|
}
|
|
27374
27404
|
addListPrefix(identifiers, prefix) {
|
|
27375
27405
|
for (const id of identifiers) {
|
|
@@ -27389,16 +27419,16 @@ class CurrentScope {
|
|
|
27389
27419
|
const position = new _identifier_1.Identifier(usage, filename);
|
|
27390
27420
|
if (Array.isArray(type)) {
|
|
27391
27421
|
for (const t of type) {
|
|
27392
|
-
(_a = this.current) === null || _a === void 0 ? void 0 : _a.
|
|
27422
|
+
(_a = this.current) === null || _a === void 0 ? void 0 : _a.addReference({ position, resolved: referencing, referenceType: t, extra });
|
|
27393
27423
|
}
|
|
27394
27424
|
}
|
|
27395
27425
|
else {
|
|
27396
|
-
(_b = this.current) === null || _b === void 0 ? void 0 : _b.
|
|
27426
|
+
(_b = this.current) === null || _b === void 0 ? void 0 : _b.addReference({ position, resolved: referencing, referenceType: type, extra });
|
|
27397
27427
|
}
|
|
27398
27428
|
}
|
|
27399
27429
|
addSQLConversion(fieldName, message, token) {
|
|
27400
27430
|
var _a;
|
|
27401
|
-
(_a = this.current) === null || _a === void 0 ? void 0 : _a.
|
|
27431
|
+
(_a = this.current) === null || _a === void 0 ? void 0 : _a.addSQLConversion({ fieldName, message, token });
|
|
27402
27432
|
}
|
|
27403
27433
|
///////////////////////////
|
|
27404
27434
|
findFunctionModule(name) {
|
|
@@ -27434,6 +27464,9 @@ class CurrentScope {
|
|
|
27434
27464
|
return undefined;
|
|
27435
27465
|
}
|
|
27436
27466
|
const name = (_a = this.parentObj.getClassDefinition()) === null || _a === void 0 ? void 0 : _a.behaviorDefinitionName;
|
|
27467
|
+
return this.findBehaviorDefinitionByName(name);
|
|
27468
|
+
}
|
|
27469
|
+
findBehaviorDefinitionByName(name) {
|
|
27437
27470
|
if (name === undefined) {
|
|
27438
27471
|
return undefined;
|
|
27439
27472
|
}
|
|
@@ -27763,6 +27796,84 @@ exports.CurrentScope = CurrentScope;
|
|
|
27763
27796
|
|
|
27764
27797
|
/***/ },
|
|
27765
27798
|
|
|
27799
|
+
/***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_eml.js"
|
|
27800
|
+
/*!*********************************************************************!*\
|
|
27801
|
+
!*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/_eml.js ***!
|
|
27802
|
+
\*********************************************************************/
|
|
27803
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
27804
|
+
|
|
27805
|
+
"use strict";
|
|
27806
|
+
|
|
27807
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27808
|
+
if (k2 === undefined) k2 = k;
|
|
27809
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
27810
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27811
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27812
|
+
}
|
|
27813
|
+
Object.defineProperty(o, k2, desc);
|
|
27814
|
+
}) : (function(o, m, k, k2) {
|
|
27815
|
+
if (k2 === undefined) k2 = k;
|
|
27816
|
+
o[k2] = m[k];
|
|
27817
|
+
}));
|
|
27818
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27819
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27820
|
+
}) : function(o, v) {
|
|
27821
|
+
o["default"] = v;
|
|
27822
|
+
});
|
|
27823
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27824
|
+
var ownKeys = function(o) {
|
|
27825
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27826
|
+
var ar = [];
|
|
27827
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27828
|
+
return ar;
|
|
27829
|
+
};
|
|
27830
|
+
return ownKeys(o);
|
|
27831
|
+
};
|
|
27832
|
+
return function (mod) {
|
|
27833
|
+
if (mod && mod.__esModule) return mod;
|
|
27834
|
+
var result = {};
|
|
27835
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
27836
|
+
__setModuleDefault(result, mod);
|
|
27837
|
+
return result;
|
|
27838
|
+
};
|
|
27839
|
+
})();
|
|
27840
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
27841
|
+
exports.EML = void 0;
|
|
27842
|
+
const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
27843
|
+
const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
27844
|
+
/** checks the entities referenced in EML statements, eg. READ ENTITIES and MODIFY ENTITIES */
|
|
27845
|
+
class EML {
|
|
27846
|
+
static checkEntities(node, input) {
|
|
27847
|
+
var _a;
|
|
27848
|
+
var _b;
|
|
27849
|
+
const nameNode = node.findDirectExpression(Expressions.NamespaceSimpleName);
|
|
27850
|
+
if (nameNode === undefined) {
|
|
27851
|
+
// eg. dynamic "MODIFY ENTITIES OPERATIONS" or "ENTITY zentity\_association"
|
|
27852
|
+
return;
|
|
27853
|
+
}
|
|
27854
|
+
const name = nameNode.concatTokens();
|
|
27855
|
+
const scope = input.scope;
|
|
27856
|
+
if (node.findDirectTokenByText("ENTITIES") !== undefined) {
|
|
27857
|
+
// "ENTITIES OF" refers to the behavior definition
|
|
27858
|
+
if (scope.findBehaviorDefinitionByName(name) === undefined && scope.getDDIC().inErrorNamespace(name)) {
|
|
27859
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), `Behavior definition "${name}" not found`));
|
|
27860
|
+
}
|
|
27861
|
+
return;
|
|
27862
|
+
}
|
|
27863
|
+
// single "ENTITY", inside a behavior pool the alias defined in the BDEF can be used
|
|
27864
|
+
const entity = (_b = (_a = scope.findBehaviorDefinition()) === null || _a === void 0 ? void 0 : _a.findEntityNameByAlias(name)) !== null && _b !== void 0 ? _b : name;
|
|
27865
|
+
if (scope.getDDIC().inErrorNamespace(entity)
|
|
27866
|
+
&& scope.findBehaviorDefinitionByName(entity) === undefined
|
|
27867
|
+
&& scope.getDDIC().lookupDDLS(entity) === undefined) {
|
|
27868
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), `Entity "${name}" not found`));
|
|
27869
|
+
}
|
|
27870
|
+
}
|
|
27871
|
+
}
|
|
27872
|
+
exports.EML = EML;
|
|
27873
|
+
//# sourceMappingURL=_eml.js.map
|
|
27874
|
+
|
|
27875
|
+
/***/ },
|
|
27876
|
+
|
|
27766
27877
|
/***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_loop_table_change.js"
|
|
27767
27878
|
/*!***********************************************************************************!*\
|
|
27768
27879
|
!*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/_loop_table_change.js ***!
|
|
@@ -28133,6 +28244,16 @@ class ObjectOriented {
|
|
|
28133
28244
|
}
|
|
28134
28245
|
return `The special method "${name}" cannot be called directly`;
|
|
28135
28246
|
}
|
|
28247
|
+
// classic exceptions cannot be raised in a method declaring class based exceptions, returns the message otherwise
|
|
28248
|
+
checkClassicException() {
|
|
28249
|
+
var _a;
|
|
28250
|
+
const methodName = this.scope.getEnclosingMethodName();
|
|
28251
|
+
const classDef = this.scope.findClassDefinition(this.scope.getEnclosingClassName());
|
|
28252
|
+
if (methodName && classDef && ((_a = this.searchMethodName(classDef, methodName).method) === null || _a === void 0 ? void 0 : _a.getRaising().length)) {
|
|
28253
|
+
return "Classic exceptions cannot be raised in methods with class based exceptions";
|
|
28254
|
+
}
|
|
28255
|
+
return undefined;
|
|
28256
|
+
}
|
|
28136
28257
|
// SUPER-> can only call the previous implementation of the method it is used in, returns the message otherwise
|
|
28137
28258
|
// both names are resolved in the super class, so an alias and the method it stands for are the same
|
|
28138
28259
|
checkSuperCall(superDef, methodName) {
|
|
@@ -30752,6 +30873,10 @@ class BasicTypes {
|
|
|
30752
30873
|
this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, chain.getFirstToken(), message));
|
|
30753
30874
|
return undefined;
|
|
30754
30875
|
}
|
|
30876
|
+
else if (concat === "SY-REPID" || concat === "SYST-REPID") {
|
|
30877
|
+
// predefined constant in every program, not a SYST component
|
|
30878
|
+
return undefined;
|
|
30879
|
+
}
|
|
30755
30880
|
return this.resolveConstantValue(chain);
|
|
30756
30881
|
}
|
|
30757
30882
|
throw new Error("findValue, unexpected");
|
|
@@ -38742,23 +38867,81 @@ const _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier *
|
|
|
38742
38867
|
const _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js");
|
|
38743
38868
|
const _reference_1 = __webpack_require__(/*! ./_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
|
|
38744
38869
|
const assert_error_1 = __webpack_require__(/*! ./assert_error */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/assert_error.js");
|
|
38870
|
+
// most scopes only use a few of the containers, empty ones are shared and replaced on first write
|
|
38871
|
+
const EMPTY_OBJECT = Object.freeze({});
|
|
38872
|
+
const EMPTY_ARRAY = Object.freeze([]);
|
|
38745
38873
|
class ScopeData {
|
|
38746
38874
|
constructor() {
|
|
38747
38875
|
this.data = {
|
|
38748
|
-
vars:
|
|
38749
|
-
cdefs:
|
|
38750
|
-
idefs:
|
|
38751
|
-
forms:
|
|
38752
|
-
types:
|
|
38753
|
-
extraLikeTypes:
|
|
38754
|
-
deferred:
|
|
38755
|
-
references:
|
|
38756
|
-
sqlConversion:
|
|
38876
|
+
vars: EMPTY_OBJECT,
|
|
38877
|
+
cdefs: EMPTY_OBJECT,
|
|
38878
|
+
idefs: EMPTY_OBJECT,
|
|
38879
|
+
forms: EMPTY_ARRAY, // todo, refactor to object
|
|
38880
|
+
types: EMPTY_OBJECT,
|
|
38881
|
+
extraLikeTypes: EMPTY_OBJECT,
|
|
38882
|
+
deferred: EMPTY_OBJECT,
|
|
38883
|
+
references: EMPTY_ARRAY,
|
|
38884
|
+
sqlConversion: EMPTY_ARRAY,
|
|
38757
38885
|
};
|
|
38758
38886
|
}
|
|
38759
38887
|
getData() {
|
|
38760
38888
|
return this.data;
|
|
38761
38889
|
}
|
|
38890
|
+
// the shared empty containers are frozen, the methods below replace them on first write
|
|
38891
|
+
setVariable(name, identifier) {
|
|
38892
|
+
if (this.data.vars === EMPTY_OBJECT) {
|
|
38893
|
+
this.data.vars = {};
|
|
38894
|
+
}
|
|
38895
|
+
this.data.vars[name] = identifier;
|
|
38896
|
+
}
|
|
38897
|
+
setType(name, type) {
|
|
38898
|
+
if (this.data.types === EMPTY_OBJECT) {
|
|
38899
|
+
this.data.types = {};
|
|
38900
|
+
}
|
|
38901
|
+
this.data.types[name] = type;
|
|
38902
|
+
}
|
|
38903
|
+
setExtraLikeType(name, type) {
|
|
38904
|
+
if (this.data.extraLikeTypes === EMPTY_OBJECT) {
|
|
38905
|
+
this.data.extraLikeTypes = {};
|
|
38906
|
+
}
|
|
38907
|
+
this.data.extraLikeTypes[name] = type;
|
|
38908
|
+
}
|
|
38909
|
+
setDeferred(name, deferred) {
|
|
38910
|
+
if (this.data.deferred === EMPTY_OBJECT) {
|
|
38911
|
+
this.data.deferred = {};
|
|
38912
|
+
}
|
|
38913
|
+
this.data.deferred[name] = deferred;
|
|
38914
|
+
}
|
|
38915
|
+
setClassDefinition(name, cdef) {
|
|
38916
|
+
if (this.data.cdefs === EMPTY_OBJECT) {
|
|
38917
|
+
this.data.cdefs = {};
|
|
38918
|
+
}
|
|
38919
|
+
this.data.cdefs[name] = cdef;
|
|
38920
|
+
}
|
|
38921
|
+
setInterfaceDefinition(name, idef) {
|
|
38922
|
+
if (this.data.idefs === EMPTY_OBJECT) {
|
|
38923
|
+
this.data.idefs = {};
|
|
38924
|
+
}
|
|
38925
|
+
this.data.idefs[name] = idef;
|
|
38926
|
+
}
|
|
38927
|
+
addFormDefinitions(forms) {
|
|
38928
|
+
if (this.data.forms === EMPTY_ARRAY) {
|
|
38929
|
+
this.data.forms = [];
|
|
38930
|
+
}
|
|
38931
|
+
this.data.forms.push(...forms);
|
|
38932
|
+
}
|
|
38933
|
+
addReference(reference) {
|
|
38934
|
+
if (this.data.references === EMPTY_ARRAY) {
|
|
38935
|
+
this.data.references = [];
|
|
38936
|
+
}
|
|
38937
|
+
this.data.references.push(reference);
|
|
38938
|
+
}
|
|
38939
|
+
addSQLConversion(conversion) {
|
|
38940
|
+
if (this.data.sqlConversion === EMPTY_ARRAY) {
|
|
38941
|
+
this.data.sqlConversion = [];
|
|
38942
|
+
}
|
|
38943
|
+
this.data.sqlConversion.push(conversion);
|
|
38944
|
+
}
|
|
38762
38945
|
}
|
|
38763
38946
|
class SpaghettiScopeNode extends ScopeData {
|
|
38764
38947
|
[Symbol.for("debug.description")]() {
|
|
@@ -44963,8 +45146,16 @@ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@ab
|
|
|
44963
45146
|
const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
44964
45147
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
44965
45148
|
const message_source_1 = __webpack_require__(/*! ../expressions/message_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/message_source.js");
|
|
45149
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
45150
|
+
const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
|
|
44966
45151
|
class Message {
|
|
44967
45152
|
runSyntax(node, input) {
|
|
45153
|
+
const exceptionName = node.findDirectExpression(Expressions.ExceptionName);
|
|
45154
|
+
const classicMessage = exceptionName ? new _object_oriented_1.ObjectOriented(input.scope).checkClassicException() : undefined;
|
|
45155
|
+
if (exceptionName && classicMessage) {
|
|
45156
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, exceptionName.getFirstToken(), classicMessage));
|
|
45157
|
+
return;
|
|
45158
|
+
}
|
|
44968
45159
|
const found = node.findExpressionAfterToken("INTO");
|
|
44969
45160
|
const inline = found === null || found === void 0 ? void 0 : found.findDirectExpression(Expressions.InlineData);
|
|
44970
45161
|
if (inline) {
|
|
@@ -45230,8 +45421,10 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
|
|
|
45230
45421
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
45231
45422
|
const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
|
|
45232
45423
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
45424
|
+
const _eml_1 = __webpack_require__(/*! ../_eml */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_eml.js");
|
|
45233
45425
|
class ModifyEntities {
|
|
45234
45426
|
runSyntax(node, input) {
|
|
45427
|
+
_eml_1.EML.checkEntities(node, input);
|
|
45235
45428
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
45236
45429
|
source_1.Source.runSyntax(s, input);
|
|
45237
45430
|
}
|
|
@@ -46207,6 +46400,12 @@ class Raise {
|
|
|
46207
46400
|
var _a, _b, _c, _d, _e, _f;
|
|
46208
46401
|
const helper = new _object_oriented_1.ObjectOriented(input.scope);
|
|
46209
46402
|
let method;
|
|
46403
|
+
const exceptionName = node.findDirectExpression(Expressions.ExceptionName);
|
|
46404
|
+
const classicMessage = exceptionName ? helper.checkClassicException() : undefined;
|
|
46405
|
+
if (exceptionName && classicMessage) {
|
|
46406
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, exceptionName.getFirstToken(), classicMessage));
|
|
46407
|
+
return;
|
|
46408
|
+
}
|
|
46210
46409
|
const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
46211
46410
|
const className = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
|
|
46212
46411
|
if (classTok && className) {
|
|
@@ -46541,8 +46740,10 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
|
|
|
46541
46740
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
46542
46741
|
const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
|
|
46543
46742
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
46743
|
+
const _eml_1 = __webpack_require__(/*! ../_eml */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_eml.js");
|
|
46544
46744
|
class ReadEntities {
|
|
46545
46745
|
runSyntax(node, input) {
|
|
46746
|
+
_eml_1.EML.checkEntities(node, input);
|
|
46546
46747
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
46547
46748
|
source_1.Source.runSyntax(s, input);
|
|
46548
46749
|
}
|
|
@@ -50951,7 +51152,7 @@ class SyntaxLogic {
|
|
|
50951
51152
|
this.reg.getMSAGReferences().clear(this.object);
|
|
50952
51153
|
if (this.object instanceof objects_1.Program && this.object.isInclude()) {
|
|
50953
51154
|
// todo, show some kind of error?
|
|
50954
|
-
return { issues: [], spaghetti: this.scope.pop(new position_1.Position(
|
|
51155
|
+
return { issues: [], spaghetti: this.scope.pop(new position_1.Position(position_1.MAX_POSITION_VALUE, position_1.MAX_POSITION_VALUE)) };
|
|
50955
51156
|
}
|
|
50956
51157
|
this.traverseObject();
|
|
50957
51158
|
// the FORM definitions are now all traversed, ie. their parameters are typed
|
|
@@ -50960,7 +51161,7 @@ class SyntaxLogic {
|
|
|
50960
51161
|
}
|
|
50961
51162
|
this.deferred = [];
|
|
50962
51163
|
for (;;) {
|
|
50963
|
-
const spaghetti = this.scope.pop(new position_1.Position(
|
|
51164
|
+
const spaghetti = this.scope.pop(new position_1.Position(position_1.MAX_POSITION_VALUE, position_1.MAX_POSITION_VALUE)); // pop built-in scopes
|
|
50964
51165
|
if (spaghetti.getTop().getIdentifier().stype === _scope_type_1.ScopeType.BuiltIn) {
|
|
50965
51166
|
const result = { issues: this.issues, spaghetti };
|
|
50966
51167
|
this.object.syntaxResult = result;
|
|
@@ -51695,7 +51896,6 @@ const _abstract_node_1 = __webpack_require__(/*! ./_abstract_node */ "./node_mod
|
|
|
51695
51896
|
class ExpressionNode extends _abstract_node_1.AbstractNode {
|
|
51696
51897
|
constructor(expression) {
|
|
51697
51898
|
super();
|
|
51698
|
-
this.tokenCount = 0;
|
|
51699
51899
|
this.expression = expression;
|
|
51700
51900
|
}
|
|
51701
51901
|
addChild(_n) {
|
|
@@ -51706,13 +51906,15 @@ class ExpressionNode extends _abstract_node_1.AbstractNode {
|
|
|
51706
51906
|
}
|
|
51707
51907
|
setChildren(children) {
|
|
51708
51908
|
super.setChildren(children);
|
|
51709
|
-
for (const child of this.getChildren()) {
|
|
51710
|
-
this.tokenCount = this.tokenCount + child.countTokens();
|
|
51711
|
-
}
|
|
51712
51909
|
return this;
|
|
51713
51910
|
}
|
|
51911
|
+
// not stored on the node, saves a field per ExpressionNode, the statement parser tracks counts itself
|
|
51714
51912
|
countTokens() {
|
|
51715
|
-
|
|
51913
|
+
let count = 0;
|
|
51914
|
+
for (const child of this.getChildren()) {
|
|
51915
|
+
count = count + child.countTokens();
|
|
51916
|
+
}
|
|
51917
|
+
return count;
|
|
51716
51918
|
}
|
|
51717
51919
|
getFirstToken() {
|
|
51718
51920
|
for (const child of this.getChildren()) {
|
|
@@ -56644,6 +56846,874 @@ exports.ArtifactsRules = ArtifactsRules;
|
|
|
56644
56846
|
|
|
56645
56847
|
/***/ },
|
|
56646
56848
|
|
|
56849
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/bdef_parser.js"
|
|
56850
|
+
/*!*******************************************************************!*\
|
|
56851
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/bdef_parser.js ***!
|
|
56852
|
+
\*******************************************************************/
|
|
56853
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
56854
|
+
|
|
56855
|
+
"use strict";
|
|
56856
|
+
|
|
56857
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
56858
|
+
if (k2 === undefined) k2 = k;
|
|
56859
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
56860
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
56861
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
56862
|
+
}
|
|
56863
|
+
Object.defineProperty(o, k2, desc);
|
|
56864
|
+
}) : (function(o, m, k, k2) {
|
|
56865
|
+
if (k2 === undefined) k2 = k;
|
|
56866
|
+
o[k2] = m[k];
|
|
56867
|
+
}));
|
|
56868
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
56869
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
56870
|
+
}) : function(o, v) {
|
|
56871
|
+
o["default"] = v;
|
|
56872
|
+
});
|
|
56873
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
56874
|
+
var ownKeys = function(o) {
|
|
56875
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
56876
|
+
var ar = [];
|
|
56877
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
56878
|
+
return ar;
|
|
56879
|
+
};
|
|
56880
|
+
return ownKeys(o);
|
|
56881
|
+
};
|
|
56882
|
+
return function (mod) {
|
|
56883
|
+
if (mod && mod.__esModule) return mod;
|
|
56884
|
+
var result = {};
|
|
56885
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
56886
|
+
__setModuleDefault(result, mod);
|
|
56887
|
+
return result;
|
|
56888
|
+
};
|
|
56889
|
+
})();
|
|
56890
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
56891
|
+
exports.BDEFParser = void 0;
|
|
56892
|
+
const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
|
|
56893
|
+
const combi_1 = __webpack_require__(/*! ../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
56894
|
+
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
56895
|
+
const cds_lexer_1 = __webpack_require__(/*! ../cds/cds_lexer */ "./node_modules/@abaplint/core/build/src/cds/cds_lexer.js");
|
|
56896
|
+
const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
56897
|
+
const Expressions = __importStar(__webpack_require__(/*! ./expressions */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js"));
|
|
56898
|
+
class BDEFParser {
|
|
56899
|
+
parse(file) {
|
|
56900
|
+
if (file === undefined) {
|
|
56901
|
+
return undefined;
|
|
56902
|
+
}
|
|
56903
|
+
// BDEF has the same comments, strings and delimiters as CDS
|
|
56904
|
+
const tokens = this.removePragmas(cds_lexer_1.CDSLexer.run(file).filter(t => !(t instanceof tokens_1.Comment)));
|
|
56905
|
+
const res = combi_1.Combi.run(new Expressions.BDEFDefinition(), tokens, version_1.defaultRelease);
|
|
56906
|
+
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
56907
|
+
return undefined;
|
|
56908
|
+
}
|
|
56909
|
+
return res[0];
|
|
56910
|
+
}
|
|
56911
|
+
/** pragmas can occur in many places, eg. "##NOT_ASSIGNED_TO_DETACT" or "##UNMAPPED_FIELD[SingletonID]" */
|
|
56912
|
+
removePragmas(tokens) {
|
|
56913
|
+
var _a;
|
|
56914
|
+
const ret = [];
|
|
56915
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
56916
|
+
if (tokens[i].getStr().startsWith("##") === false) {
|
|
56917
|
+
ret.push(tokens[i]);
|
|
56918
|
+
continue;
|
|
56919
|
+
}
|
|
56920
|
+
if (((_a = tokens[i + 1]) === null || _a === void 0 ? void 0 : _a.getStr()) === "[") {
|
|
56921
|
+
while (i < tokens.length - 1 && tokens[i].getStr() !== "]") {
|
|
56922
|
+
i++;
|
|
56923
|
+
}
|
|
56924
|
+
}
|
|
56925
|
+
}
|
|
56926
|
+
return ret;
|
|
56927
|
+
}
|
|
56928
|
+
}
|
|
56929
|
+
exports.BDEFParser = BDEFParser;
|
|
56930
|
+
//# sourceMappingURL=bdef_parser.js.map
|
|
56931
|
+
|
|
56932
|
+
/***/ },
|
|
56933
|
+
|
|
56934
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_action.js"
|
|
56935
|
+
/*!*******************************************************************************!*\
|
|
56936
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_action.js ***!
|
|
56937
|
+
\*******************************************************************************/
|
|
56938
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
56939
|
+
|
|
56940
|
+
"use strict";
|
|
56941
|
+
|
|
56942
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
56943
|
+
exports.BDEFAction = void 0;
|
|
56944
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
56945
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
56946
|
+
/** actions and functions, eg. "static factory action ( features : global ) copy parameter ZPARAM result [1] $self;" */
|
|
56947
|
+
class BDEFAction extends combi_1.Expression {
|
|
56948
|
+
getRunnable() {
|
|
56949
|
+
const modifier = (0, combi_1.altPrio)("INTERNAL", "STATIC", "FACTORY", "DEFAULT", "DRAFT", "REPEATABLE", "RECOMMENDATION", (0, combi_1.seq)("SAVE", (0, combi_1.optPrio)(_1.BDEFOptions)), (0, combi_1.seq)("KEY", _1.BDEFOptions));
|
|
56950
|
+
const tail = (0, combi_1.altPrio)((0, combi_1.seq)("EXTERNAL", _1.BDEFString), (0, combi_1.seq)("AS", _1.BDEFName), _1.BDEFParameter, _1.BDEFResult, _1.BDEFCardinality, "OPTIMIZED", "EXTENSIBLE", "WITH ADDITIONAL IMPLEMENTATION");
|
|
56951
|
+
return (0, combi_1.seq)((0, combi_1.starPrio)(modifier), (0, combi_1.altPrio)("ACTION", "FUNCTION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.starPrio)(tail), (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction));
|
|
56952
|
+
}
|
|
56953
|
+
}
|
|
56954
|
+
exports.BDEFAction = BDEFAction;
|
|
56955
|
+
//# sourceMappingURL=bdef_action.js.map
|
|
56956
|
+
|
|
56957
|
+
/***/ },
|
|
56958
|
+
|
|
56959
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_alias.js"
|
|
56960
|
+
/*!******************************************************************************!*\
|
|
56961
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_alias.js ***!
|
|
56962
|
+
\******************************************************************************/
|
|
56963
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
56964
|
+
|
|
56965
|
+
"use strict";
|
|
56966
|
+
|
|
56967
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
56968
|
+
exports.BDEFAlias = void 0;
|
|
56969
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
56970
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
56971
|
+
class BDEFAlias extends combi_1.Expression {
|
|
56972
|
+
getRunnable() {
|
|
56973
|
+
return (0, combi_1.seq)("ALIAS", _1.BDEFName);
|
|
56974
|
+
}
|
|
56975
|
+
}
|
|
56976
|
+
exports.BDEFAlias = BDEFAlias;
|
|
56977
|
+
//# sourceMappingURL=bdef_alias.js.map
|
|
56978
|
+
|
|
56979
|
+
/***/ },
|
|
56980
|
+
|
|
56981
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_association.js"
|
|
56982
|
+
/*!************************************************************************************!*\
|
|
56983
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_association.js ***!
|
|
56984
|
+
\************************************************************************************/
|
|
56985
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
56986
|
+
|
|
56987
|
+
"use strict";
|
|
56988
|
+
|
|
56989
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
56990
|
+
exports.BDEFAssociation = void 0;
|
|
56991
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
56992
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
56993
|
+
/** eg. "association _Booking { create; with draft; }" */
|
|
56994
|
+
class BDEFAssociation extends combi_1.Expression {
|
|
56995
|
+
getRunnable() {
|
|
56996
|
+
// cross BO association, eg. "using /DMO/R_TRAVELTP_XBO \_Agency"
|
|
56997
|
+
const using = (0, combi_1.seq)("USING", _1.BDEFName, (0, combi_1.optPrio)((0, combi_1.regex)(/^\\\w+$/)));
|
|
56998
|
+
return (0, combi_1.seq)((0, combi_1.starPrio)((0, combi_1.altPrio)("INTERNAL", "UNMANAGED", "ANCESTOR")), "ASSOCIATION", (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.optPrio)(using), (0, combi_1.optPrio)((0, combi_1.seq)("ABBREVIATION", _1.BDEFName)), (0, combi_1.optPrio)("WITH HIERARCHY"), (0, combi_1.altPrio)(";", _1.BDEFAssociationBody));
|
|
56999
|
+
}
|
|
57000
|
+
}
|
|
57001
|
+
exports.BDEFAssociation = BDEFAssociation;
|
|
57002
|
+
//# sourceMappingURL=bdef_association.js.map
|
|
57003
|
+
|
|
57004
|
+
/***/ },
|
|
57005
|
+
|
|
57006
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_association_body.js"
|
|
57007
|
+
/*!*****************************************************************************************!*\
|
|
57008
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_association_body.js ***!
|
|
57009
|
+
\*****************************************************************************************/
|
|
57010
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57011
|
+
|
|
57012
|
+
"use strict";
|
|
57013
|
+
|
|
57014
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57015
|
+
exports.BDEFAssociationBody = void 0;
|
|
57016
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57017
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57018
|
+
/** eg. "{ create ( features : instance ); with draft; link action linkManager; }" */
|
|
57019
|
+
class BDEFAssociationBody extends combi_1.Expression {
|
|
57020
|
+
getRunnable() {
|
|
57021
|
+
const create = (0, combi_1.seq)((0, combi_1.optPrio)("INTERNAL"), "CREATE", (0, combi_1.optPrio)(_1.BDEFOptions), (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction));
|
|
57022
|
+
const withh = (0, combi_1.seq)("WITH", (0, combi_1.altPrio)("DRAFT", "DEPENDENT DRAFT", "CASCADING DELETE"), ";");
|
|
57023
|
+
const link = (0, combi_1.seq)((0, combi_1.altPrio)("LINK", "UNLINK"), "ACTION", _1.BDEFName, ";");
|
|
57024
|
+
const inverse = (0, combi_1.seq)("INVERSE FUNCTION", _1.BDEFName, ";");
|
|
57025
|
+
const item = (0, combi_1.altPrio)(create, withh, link, inverse, ";");
|
|
57026
|
+
return (0, combi_1.seq)("{", (0, combi_1.starPrio)(item), "}");
|
|
57027
|
+
}
|
|
57028
|
+
}
|
|
57029
|
+
exports.BDEFAssociationBody = BDEFAssociationBody;
|
|
57030
|
+
//# sourceMappingURL=bdef_association_body.js.map
|
|
57031
|
+
|
|
57032
|
+
/***/ },
|
|
57033
|
+
|
|
57034
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_authorization_context.js"
|
|
57035
|
+
/*!**********************************************************************************************!*\
|
|
57036
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_authorization_context.js ***!
|
|
57037
|
+
\**********************************************************************************************/
|
|
57038
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57039
|
+
|
|
57040
|
+
"use strict";
|
|
57041
|
+
|
|
57042
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57043
|
+
exports.BDEFAuthorizationContext = void 0;
|
|
57044
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57045
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57046
|
+
/** eg. "define own authorization context { 'S_TABU_NAM'; }" or "define own authorization context by privileged mode;" */
|
|
57047
|
+
class BDEFAuthorizationContext extends combi_1.Expression {
|
|
57048
|
+
getRunnable() {
|
|
57049
|
+
const item = (0, combi_1.seq)((0, combi_1.altPrio)(_1.BDEFString, _1.BDEFName), ";");
|
|
57050
|
+
const body = (0, combi_1.seq)("{", (0, combi_1.starPrio)(item), "}", (0, combi_1.optPrio)(";"));
|
|
57051
|
+
const privileged = (0, combi_1.seq)("BY PRIVILEGED MODE", (0, combi_1.optPrio)("AND"));
|
|
57052
|
+
return (0, combi_1.seq)("DEFINE", (0, combi_1.optPrio)("OWN"), "AUTHORIZATION CONTEXT", (0, combi_1.optPrio)((0, combi_1.altPrio)(privileged, _1.BDEFName)), (0, combi_1.optPrio)((0, combi_1.seq)("FOR DISABLE", _1.BDEFOptions)), (0, combi_1.altPrio)(";", body));
|
|
57053
|
+
}
|
|
57054
|
+
}
|
|
57055
|
+
exports.BDEFAuthorizationContext = BDEFAuthorizationContext;
|
|
57056
|
+
//# sourceMappingURL=bdef_authorization_context.js.map
|
|
57057
|
+
|
|
57058
|
+
/***/ },
|
|
57059
|
+
|
|
57060
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_cardinality.js"
|
|
57061
|
+
/*!************************************************************************************!*\
|
|
57062
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_cardinality.js ***!
|
|
57063
|
+
\************************************************************************************/
|
|
57064
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57065
|
+
|
|
57066
|
+
"use strict";
|
|
57067
|
+
|
|
57068
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57069
|
+
exports.BDEFCardinality = void 0;
|
|
57070
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57071
|
+
/** eg. "[1]" or "[0..*]" */
|
|
57072
|
+
class BDEFCardinality extends combi_1.Expression {
|
|
57073
|
+
getRunnable() {
|
|
57074
|
+
const integer = (0, combi_1.regex)(/^\d+$/);
|
|
57075
|
+
return (0, combi_1.seq)("[", integer, (0, combi_1.optPrio)((0, combi_1.seq)(".", ".", (0, combi_1.altPrio)(integer, "*"))), "]");
|
|
57076
|
+
}
|
|
57077
|
+
}
|
|
57078
|
+
exports.BDEFCardinality = BDEFCardinality;
|
|
57079
|
+
//# sourceMappingURL=bdef_cardinality.js.map
|
|
57080
|
+
|
|
57081
|
+
/***/ },
|
|
57082
|
+
|
|
57083
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_default_function.js"
|
|
57084
|
+
/*!*****************************************************************************************!*\
|
|
57085
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_default_function.js ***!
|
|
57086
|
+
\*****************************************************************************************/
|
|
57087
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57088
|
+
|
|
57089
|
+
"use strict";
|
|
57090
|
+
|
|
57091
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57092
|
+
exports.BDEFDefaultFunction = void 0;
|
|
57093
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57094
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57095
|
+
/** eg. "{ default function GetDefaultsForCreate; }" */
|
|
57096
|
+
class BDEFDefaultFunction extends combi_1.Expression {
|
|
57097
|
+
getRunnable() {
|
|
57098
|
+
const func = (0, combi_1.seq)("DEFAULT FUNCTION", (0, combi_1.optPrio)((0, combi_1.seq)(_1.BDEFName, (0, combi_1.optPrio)((0, combi_1.seq)("EXTERNAL", _1.BDEFString)))), ";");
|
|
57099
|
+
return (0, combi_1.seq)("{", (0, combi_1.plusPrio)(func), "}");
|
|
57100
|
+
}
|
|
57101
|
+
}
|
|
57102
|
+
exports.BDEFDefaultFunction = BDEFDefaultFunction;
|
|
57103
|
+
//# sourceMappingURL=bdef_default_function.js.map
|
|
57104
|
+
|
|
57105
|
+
/***/ },
|
|
57106
|
+
|
|
57107
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_define_behavior.js"
|
|
57108
|
+
/*!****************************************************************************************!*\
|
|
57109
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_define_behavior.js ***!
|
|
57110
|
+
\****************************************************************************************/
|
|
57111
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57112
|
+
|
|
57113
|
+
"use strict";
|
|
57114
|
+
|
|
57115
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57116
|
+
exports.BDEFDefineBehavior = void 0;
|
|
57117
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57118
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57119
|
+
/** behavior of one entity, "define behavior for ZI_Travel alias Travel ... { ... }" */
|
|
57120
|
+
class BDEFDefineBehavior extends combi_1.Expression {
|
|
57121
|
+
getRunnable() {
|
|
57122
|
+
const fieldMapping = (0, combi_1.seq)(_1.BDEFName, "=", _1.BDEFName);
|
|
57123
|
+
const lockMapping = (0, combi_1.seq)("(", fieldMapping, (0, combi_1.starPrio)((0, combi_1.seq)(",", fieldMapping)), ")");
|
|
57124
|
+
const dependentBy = (0, combi_1.seq)("DEPENDENT", (0, combi_1.optPrio)((0, combi_1.seq)("BY", _1.BDEFName)));
|
|
57125
|
+
const save = (0, combi_1.seq)((0, combi_1.altPrio)("WITH ADDITIONAL SAVE", "WITH UNMANAGED SAVE"), (0, combi_1.optPrio)("AND CLEANUP"), (0, combi_1.optPrio)("WITH FULL DATA"));
|
|
57126
|
+
const option = (0, combi_1.altPrio)(_1.BDEFAlias, _1.BDEFImplementationIn, (0, combi_1.seq)("EXTERNAL", _1.BDEFString), (0, combi_1.seq)("PERSISTENT TABLE", _1.BDEFName), (0, combi_1.seq)("DRAFT TABLE", _1.BDEFName), (0, combi_1.seq)("QUERY", _1.BDEFName), (0, combi_1.seq)("LOCK", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", (0, combi_1.optPrio)("UNMANAGED")), (0, combi_1.seq)(dependentBy, (0, combi_1.optPrio)(lockMapping)))), (0, combi_1.seq)("AUTHORIZATION", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", _1.BDEFOptions), dependentBy)), (0, combi_1.seq)((0, combi_1.optPrio)("TOTAL"), "ETAG", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", _1.BDEFName), dependentBy, _1.BDEFName)),
|
|
57127
|
+
// eg. "( lock, authorization, etag ) dependent by _Travel"
|
|
57128
|
+
(0, combi_1.seq)(_1.BDEFOptions, dependentBy), (0, combi_1.seq)((0, combi_1.altPrio)("LATE", "EARLY"), "NUMBERING", (0, combi_1.optPrio)("IN PLACE")), save, "WITH CONTROL", "USE ETAG", (0, combi_1.seq)("USING", _1.BDEFName), (0, combi_1.seq)("CHANGEDOCUMENTS", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", (0, combi_1.optPrio)("UTC"), (0, combi_1.optPrio)(_1.BDEFOptions)), dependentBy)), "EXTENSIBLE");
|
|
57129
|
+
const item = (0, combi_1.altPrio)(_1.BDEFUse, _1.BDEFDetermineAction, _1.BDEFOperation, _1.BDEFAction, _1.BDEFDetermination, _1.BDEFField, _1.BDEFAssociation, _1.BDEFMapping, _1.BDEFSideEffects, _1.BDEFEvent, _1.BDEFHierarchy, _1.BDEFKey, (0, combi_1.seq)("CHANGEDOCUMENTS", _1.BDEFOptions, ";"), ";");
|
|
57130
|
+
return (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.seq)("DEFINE", (0, combi_1.optPrio)("ROOT"), "BEHAVIOR FOR"), "EXTEND BEHAVIOR FOR"), _1.BDEFName, (0, combi_1.starPrio)(option), "{", (0, combi_1.starPrio)(item), "}", (0, combi_1.optPrio)(";"));
|
|
57131
|
+
}
|
|
57132
|
+
}
|
|
57133
|
+
exports.BDEFDefineBehavior = BDEFDefineBehavior;
|
|
57134
|
+
//# sourceMappingURL=bdef_define_behavior.js.map
|
|
57135
|
+
|
|
57136
|
+
/***/ },
|
|
57137
|
+
|
|
57138
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_definition.js"
|
|
57139
|
+
/*!***********************************************************************************!*\
|
|
57140
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_definition.js ***!
|
|
57141
|
+
\***********************************************************************************/
|
|
57142
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57143
|
+
|
|
57144
|
+
"use strict";
|
|
57145
|
+
|
|
57146
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57147
|
+
exports.BDEFDefinition = void 0;
|
|
57148
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57149
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57150
|
+
class BDEFDefinition extends combi_1.Expression {
|
|
57151
|
+
getRunnable() {
|
|
57152
|
+
return (0, combi_1.seq)(_1.BDEFImplementationType, (0, combi_1.starPrio)((0, combi_1.altPrio)(_1.BDEFHeader, _1.BDEFDefineBehavior, _1.BDEFAuthorizationContext)));
|
|
57153
|
+
}
|
|
57154
|
+
}
|
|
57155
|
+
exports.BDEFDefinition = BDEFDefinition;
|
|
57156
|
+
//# sourceMappingURL=bdef_definition.js.map
|
|
57157
|
+
|
|
57158
|
+
/***/ },
|
|
57159
|
+
|
|
57160
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_determination.js"
|
|
57161
|
+
/*!**************************************************************************************!*\
|
|
57162
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_determination.js ***!
|
|
57163
|
+
\**************************************************************************************/
|
|
57164
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57165
|
+
|
|
57166
|
+
"use strict";
|
|
57167
|
+
|
|
57168
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57169
|
+
exports.BDEFDetermination = void 0;
|
|
57170
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57171
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57172
|
+
/** determinations and validations, eg. "validation validateDates on save { create; field BeginDate, EndDate; }" */
|
|
57173
|
+
class BDEFDetermination extends combi_1.Expression {
|
|
57174
|
+
getRunnable() {
|
|
57175
|
+
const fields = (0, combi_1.seq)(_1.BDEFFieldPath, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFFieldPath)));
|
|
57176
|
+
const trigger = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), ";"), (0, combi_1.seq)("FIELD", fields, ";"), (0, combi_1.seq)("ENTITY", fields, ";"), ";");
|
|
57177
|
+
return (0, combi_1.seq)((0, combi_1.altPrio)("DETERMINATION", "VALIDATION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, "ON", (0, combi_1.altPrio)("MODIFY", "SAVE"), "{", (0, combi_1.starPrio)(trigger), "}");
|
|
57178
|
+
}
|
|
57179
|
+
}
|
|
57180
|
+
exports.BDEFDetermination = BDEFDetermination;
|
|
57181
|
+
//# sourceMappingURL=bdef_determination.js.map
|
|
57182
|
+
|
|
57183
|
+
/***/ },
|
|
57184
|
+
|
|
57185
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_determine_action.js"
|
|
57186
|
+
/*!*****************************************************************************************!*\
|
|
57187
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_determine_action.js ***!
|
|
57188
|
+
\*****************************************************************************************/
|
|
57189
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57190
|
+
|
|
57191
|
+
"use strict";
|
|
57192
|
+
|
|
57193
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57194
|
+
exports.BDEFDetermineAction = void 0;
|
|
57195
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57196
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57197
|
+
/** eg. "draft determine action Prepare { validation validateDate; determination ( always ) Child ~ setStatus; }" */
|
|
57198
|
+
class BDEFDetermineAction extends combi_1.Expression {
|
|
57199
|
+
getRunnable() {
|
|
57200
|
+
const item = (0, combi_1.seq)((0, combi_1.altPrio)("VALIDATION", "DETERMINATION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFReference, ";");
|
|
57201
|
+
const body = (0, combi_1.seq)("{", (0, combi_1.starPrio)(item), "}");
|
|
57202
|
+
return (0, combi_1.seq)((0, combi_1.optPrio)("EXTEND"), (0, combi_1.optPrio)("DRAFT"), "DETERMINE ACTION", (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.optPrio)("EXTENSIBLE"), (0, combi_1.altPrio)(";", body));
|
|
57203
|
+
}
|
|
57204
|
+
}
|
|
57205
|
+
exports.BDEFDetermineAction = BDEFDetermineAction;
|
|
57206
|
+
//# sourceMappingURL=bdef_determine_action.js.map
|
|
57207
|
+
|
|
57208
|
+
/***/ },
|
|
57209
|
+
|
|
57210
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_event.js"
|
|
57211
|
+
/*!******************************************************************************!*\
|
|
57212
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_event.js ***!
|
|
57213
|
+
\******************************************************************************/
|
|
57214
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57215
|
+
|
|
57216
|
+
"use strict";
|
|
57217
|
+
|
|
57218
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57219
|
+
exports.BDEFEvent = void 0;
|
|
57220
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57221
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57222
|
+
/** eg. "event TravelCreated parameter ZD_TRAVEL_EVENT;" or "event StatusUpdated for side effects;" */
|
|
57223
|
+
class BDEFEvent extends combi_1.Expression {
|
|
57224
|
+
getRunnable() {
|
|
57225
|
+
const tail = (0, combi_1.altPrio)((0, combi_1.seq)("ON", _1.BDEFName), _1.BDEFParameter, "FOR SIDE EFFECTS", (0, combi_1.seq)("DESCRIPTION", _1.BDEFString), (0, combi_1.seq)("CATEGORY", _1.BDEFName));
|
|
57226
|
+
return (0, combi_1.seq)((0, combi_1.optPrio)("MANAGED"), "EVENT", _1.BDEFName, (0, combi_1.starPrio)(tail), ";");
|
|
57227
|
+
}
|
|
57228
|
+
}
|
|
57229
|
+
exports.BDEFEvent = BDEFEvent;
|
|
57230
|
+
//# sourceMappingURL=bdef_event.js.map
|
|
57231
|
+
|
|
57232
|
+
/***/ },
|
|
57233
|
+
|
|
57234
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_field.js"
|
|
57235
|
+
/*!******************************************************************************!*\
|
|
57236
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_field.js ***!
|
|
57237
|
+
\******************************************************************************/
|
|
57238
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57239
|
+
|
|
57240
|
+
"use strict";
|
|
57241
|
+
|
|
57242
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57243
|
+
exports.BDEFField = void 0;
|
|
57244
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57245
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57246
|
+
/** field characteristics, eg. "field ( readonly, numbering : managed ) ID, CreatedBy;" */
|
|
57247
|
+
class BDEFField extends combi_1.Expression {
|
|
57248
|
+
getRunnable() {
|
|
57249
|
+
return (0, combi_1.seq)("FIELD", _1.BDEFOptions, _1.BDEFFieldPath, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFFieldPath)), (0, combi_1.optPrio)(","), ";");
|
|
57250
|
+
}
|
|
57251
|
+
}
|
|
57252
|
+
exports.BDEFField = BDEFField;
|
|
57253
|
+
//# sourceMappingURL=bdef_field.js.map
|
|
57254
|
+
|
|
57255
|
+
/***/ },
|
|
57256
|
+
|
|
57257
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_field_path.js"
|
|
57258
|
+
/*!***********************************************************************************!*\
|
|
57259
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_field_path.js ***!
|
|
57260
|
+
\***********************************************************************************/
|
|
57261
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57262
|
+
|
|
57263
|
+
"use strict";
|
|
57264
|
+
|
|
57265
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57266
|
+
exports.BDEFFieldPath = void 0;
|
|
57267
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57268
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57269
|
+
/** field or association, possibly via associations, eg. "_Root.TotalPieces" */
|
|
57270
|
+
class BDEFFieldPath extends combi_1.Expression {
|
|
57271
|
+
getRunnable() {
|
|
57272
|
+
return (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.BDEFName)));
|
|
57273
|
+
}
|
|
57274
|
+
}
|
|
57275
|
+
exports.BDEFFieldPath = BDEFFieldPath;
|
|
57276
|
+
//# sourceMappingURL=bdef_field_path.js.map
|
|
57277
|
+
|
|
57278
|
+
/***/ },
|
|
57279
|
+
|
|
57280
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_header.js"
|
|
57281
|
+
/*!*******************************************************************************!*\
|
|
57282
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_header.js ***!
|
|
57283
|
+
\*******************************************************************************/
|
|
57284
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57285
|
+
|
|
57286
|
+
"use strict";
|
|
57287
|
+
|
|
57288
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57289
|
+
exports.BDEFHeader = void 0;
|
|
57290
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57291
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57292
|
+
/** header statements following the implementation type, eg. "strict ( 2 );" or "with draft;" */
|
|
57293
|
+
class BDEFHeader extends combi_1.Expression {
|
|
57294
|
+
getRunnable() {
|
|
57295
|
+
const extensibleItem = (0, combi_1.seq)("WITH", (0, combi_1.plusPrio)((0, combi_1.regex)(/^\w+$/)), ";");
|
|
57296
|
+
const extensible = (0, combi_1.seq)("EXTENSIBLE", (0, combi_1.optPrio)((0, combi_1.seq)("{", (0, combi_1.starPrio)(extensibleItem), "}")), (0, combi_1.optPrio)(";"));
|
|
57297
|
+
return (0, combi_1.altPrio)((0, combi_1.seq)("STRICT", (0, combi_1.optPrio)((0, combi_1.seq)("(", (0, combi_1.regex)(/^\d+$/), ")")), ";"), (0, combi_1.seq)("WITH DRAFT", ";"), (0, combi_1.seq)("USE DRAFT", (0, combi_1.optPrio)("AS DEPENDENT"), ";"), (0, combi_1.seq)((0, combi_1.altPrio)("WITH", "USE"), "COLLABORATIVE DRAFT", ";"), (0, combi_1.seq)("WITH PRIVILEGED MODE", (0, combi_1.optPrio)((0, combi_1.seq)("DISABLING", _1.BDEFName)), ";"), (0, combi_1.seq)("WITH MANAGED INSTANCE FILTER", ";"), (0, combi_1.seq)("WITH HIERARCHY", ";"), (0, combi_1.seq)("WITH CROSS ASSOCIATIONS", ";"), (0, combi_1.seq)("USE SIDE EFFECTS", ";"), (0, combi_1.seq)("USE RECOMMENDATIONS", ";"), (0, combi_1.seq)("FOREIGN ENTITY", _1.BDEFName, (0, combi_1.optPrio)(_1.BDEFAlias), ";"), (0, combi_1.seq)("SCALAR ENTITY", _1.BDEFName, "FIELD", _1.BDEFName, ";"), (0, combi_1.seq)("AUXILIARY CLASS", _1.BDEFName, ";"), extensible);
|
|
57298
|
+
}
|
|
57299
|
+
}
|
|
57300
|
+
exports.BDEFHeader = BDEFHeader;
|
|
57301
|
+
//# sourceMappingURL=bdef_header.js.map
|
|
57302
|
+
|
|
57303
|
+
/***/ },
|
|
57304
|
+
|
|
57305
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_hierarchy.js"
|
|
57306
|
+
/*!**********************************************************************************!*\
|
|
57307
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_hierarchy.js ***!
|
|
57308
|
+
\**********************************************************************************/
|
|
57309
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57310
|
+
|
|
57311
|
+
"use strict";
|
|
57312
|
+
|
|
57313
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57314
|
+
exports.BDEFHierarchy = void 0;
|
|
57315
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57316
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57317
|
+
/** eg. "instance hierarchy /DMO/I_EmployeeHN { managed reorder action changeNextSibling; ascending association _Manager; }" */
|
|
57318
|
+
class BDEFHierarchy extends combi_1.Expression {
|
|
57319
|
+
getRunnable() {
|
|
57320
|
+
const action = (0, combi_1.seq)((0, combi_1.optPrio)("MANAGED"), (0, combi_1.altPrio)("REORDER", "COPY"), "ACTION", _1.BDEFName, ";");
|
|
57321
|
+
const association = (0, combi_1.seq)((0, combi_1.altPrio)("ASCENDING", "DESCENDING"), "ASSOCIATION", _1.BDEFName, (0, combi_1.altPrio)(";", _1.BDEFAssociationBody));
|
|
57322
|
+
const item = (0, combi_1.altPrio)(action, association, _1.BDEFField, ";");
|
|
57323
|
+
return (0, combi_1.seq)("INSTANCE HIERARCHY", _1.BDEFName, "{", (0, combi_1.starPrio)(item), "}");
|
|
57324
|
+
}
|
|
57325
|
+
}
|
|
57326
|
+
exports.BDEFHierarchy = BDEFHierarchy;
|
|
57327
|
+
//# sourceMappingURL=bdef_hierarchy.js.map
|
|
57328
|
+
|
|
57329
|
+
/***/ },
|
|
57330
|
+
|
|
57331
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_implementation_in.js"
|
|
57332
|
+
/*!******************************************************************************************!*\
|
|
57333
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_implementation_in.js ***!
|
|
57334
|
+
\******************************************************************************************/
|
|
57335
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57336
|
+
|
|
57337
|
+
"use strict";
|
|
57338
|
+
|
|
57339
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57340
|
+
exports.BDEFImplementationIn = void 0;
|
|
57341
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57342
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57343
|
+
class BDEFImplementationIn extends combi_1.Expression {
|
|
57344
|
+
getRunnable() {
|
|
57345
|
+
return (0, combi_1.seq)("IMPLEMENTATION IN CLASS", _1.BDEFName, (0, combi_1.optPrio)("UNIQUE"));
|
|
57346
|
+
}
|
|
57347
|
+
}
|
|
57348
|
+
exports.BDEFImplementationIn = BDEFImplementationIn;
|
|
57349
|
+
//# sourceMappingURL=bdef_implementation_in.js.map
|
|
57350
|
+
|
|
57351
|
+
/***/ },
|
|
57352
|
+
|
|
57353
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_implementation_type.js"
|
|
57354
|
+
/*!********************************************************************************************!*\
|
|
57355
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_implementation_type.js ***!
|
|
57356
|
+
\********************************************************************************************/
|
|
57357
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57358
|
+
|
|
57359
|
+
"use strict";
|
|
57360
|
+
|
|
57361
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57362
|
+
exports.BDEFImplementationType = void 0;
|
|
57363
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57364
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57365
|
+
/** first statement, eg. "managed with additional save implementation in class zbp_travel unique;" */
|
|
57366
|
+
class BDEFImplementationType extends combi_1.Expression {
|
|
57367
|
+
getRunnable() {
|
|
57368
|
+
const extension = (0, combi_1.seq)("EXTENSION", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("USING INTERFACE", _1.BDEFName), (0, combi_1.seq)("FOR", (0, combi_1.altPrio)("PROJECTION", "INTERFACE")))));
|
|
57369
|
+
const type = (0, combi_1.altPrio)("MANAGED", "UNMANAGED", "ABSTRACT", "PROJECTION", "INTERFACE", extension,
|
|
57370
|
+
// old syntax, eg. "implementation unmanaged;"
|
|
57371
|
+
(0, combi_1.seq)("IMPLEMENTATION", (0, combi_1.altPrio)("MANAGED", "UNMANAGED", "ABSTRACT", "PROJECTION")));
|
|
57372
|
+
const save = (0, combi_1.seq)((0, combi_1.altPrio)("WITH ADDITIONAL SAVE", "WITH UNMANAGED SAVE"), (0, combi_1.optPrio)("AND CLEANUP"), (0, combi_1.optPrio)("WITH FULL DATA"));
|
|
57373
|
+
const option = (0, combi_1.altPrio)(_1.BDEFImplementationIn, save);
|
|
57374
|
+
return (0, combi_1.seq)(type, (0, combi_1.starPrio)(option), ";");
|
|
57375
|
+
}
|
|
57376
|
+
}
|
|
57377
|
+
exports.BDEFImplementationType = BDEFImplementationType;
|
|
57378
|
+
//# sourceMappingURL=bdef_implementation_type.js.map
|
|
57379
|
+
|
|
57380
|
+
/***/ },
|
|
57381
|
+
|
|
57382
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_key.js"
|
|
57383
|
+
/*!****************************************************************************!*\
|
|
57384
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_key.js ***!
|
|
57385
|
+
\****************************************************************************/
|
|
57386
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57387
|
+
|
|
57388
|
+
"use strict";
|
|
57389
|
+
|
|
57390
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57391
|
+
exports.BDEFKey = void 0;
|
|
57392
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57393
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57394
|
+
/** alternative key, eg. "define pure key AlternativeKey { id; }" */
|
|
57395
|
+
class BDEFKey extends combi_1.Expression {
|
|
57396
|
+
getRunnable() {
|
|
57397
|
+
const fields = (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFName)), ";");
|
|
57398
|
+
return (0, combi_1.seq)("DEFINE", (0, combi_1.optPrio)("PURE"), "KEY", _1.BDEFName, "{", (0, combi_1.starPrio)(fields), "}");
|
|
57399
|
+
}
|
|
57400
|
+
}
|
|
57401
|
+
exports.BDEFKey = BDEFKey;
|
|
57402
|
+
//# sourceMappingURL=bdef_key.js.map
|
|
57403
|
+
|
|
57404
|
+
/***/ },
|
|
57405
|
+
|
|
57406
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_mapping.js"
|
|
57407
|
+
/*!********************************************************************************!*\
|
|
57408
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_mapping.js ***!
|
|
57409
|
+
\********************************************************************************/
|
|
57410
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57411
|
+
|
|
57412
|
+
"use strict";
|
|
57413
|
+
|
|
57414
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57415
|
+
exports.BDEFMapping = void 0;
|
|
57416
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57417
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57418
|
+
/** eg. "mapping for ztravel corresponding { TravelID = travel_id; }" */
|
|
57419
|
+
class BDEFMapping extends combi_1.Expression {
|
|
57420
|
+
getRunnable() {
|
|
57421
|
+
const names = (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFName)));
|
|
57422
|
+
const line = (0, combi_1.seq)(_1.BDEFName, "=", _1.BDEFName, (0, combi_1.optPrio)((0, combi_1.seq)("CONTROL", _1.BDEFName)), ";");
|
|
57423
|
+
// deep mapping of a sub node, eg. "sub _Items = items;"
|
|
57424
|
+
const sub = (0, combi_1.seq)("SUB", _1.BDEFName, "=", _1.BDEFName, ";");
|
|
57425
|
+
const body = (0, combi_1.seq)("{", (0, combi_1.starPrio)((0, combi_1.altPrio)(sub, line, ";")), "}");
|
|
57426
|
+
const option = (0, combi_1.altPrio)("CORRESPONDING", "EXTENSIBLE", (0, combi_1.seq)("EXCEPT", names), (0, combi_1.seq)("CONTROL", _1.BDEFName));
|
|
57427
|
+
return (0, combi_1.seq)((0, combi_1.optPrio)("DEEP"), "MAPPING FOR", _1.BDEFName, (0, combi_1.starPrio)(option), (0, combi_1.altPrio)(";", body));
|
|
57428
|
+
}
|
|
57429
|
+
}
|
|
57430
|
+
exports.BDEFMapping = BDEFMapping;
|
|
57431
|
+
//# sourceMappingURL=bdef_mapping.js.map
|
|
57432
|
+
|
|
57433
|
+
/***/ },
|
|
57434
|
+
|
|
57435
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_name.js"
|
|
57436
|
+
/*!*****************************************************************************!*\
|
|
57437
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_name.js ***!
|
|
57438
|
+
\*****************************************************************************/
|
|
57439
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57440
|
+
|
|
57441
|
+
"use strict";
|
|
57442
|
+
|
|
57443
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57444
|
+
exports.BDEFName = void 0;
|
|
57445
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57446
|
+
class BDEFName extends combi_1.Expression {
|
|
57447
|
+
getRunnable() {
|
|
57448
|
+
const word = (0, combi_1.regex)(/^\$?\w+$/);
|
|
57449
|
+
const slashName = (0, combi_1.seq)("/", (0, combi_1.regex)(/^\w+$/), "/", (0, combi_1.regex)(/^\w+$/));
|
|
57450
|
+
return (0, combi_1.altPrio)(slashName, word);
|
|
57451
|
+
}
|
|
57452
|
+
}
|
|
57453
|
+
exports.BDEFName = BDEFName;
|
|
57454
|
+
//# sourceMappingURL=bdef_name.js.map
|
|
57455
|
+
|
|
57456
|
+
/***/ },
|
|
57457
|
+
|
|
57458
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_operation.js"
|
|
57459
|
+
/*!**********************************************************************************!*\
|
|
57460
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_operation.js ***!
|
|
57461
|
+
\**********************************************************************************/
|
|
57462
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57463
|
+
|
|
57464
|
+
"use strict";
|
|
57465
|
+
|
|
57466
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57467
|
+
exports.BDEFOperation = void 0;
|
|
57468
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57469
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57470
|
+
/** standard operations, eg. "internal create ( features : global );" */
|
|
57471
|
+
class BDEFOperation extends combi_1.Expression {
|
|
57472
|
+
getRunnable() {
|
|
57473
|
+
return (0, combi_1.seq)((0, combi_1.starPrio)((0, combi_1.altPrio)("INTERNAL", "STATIC")), (0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), (0, combi_1.optPrio)(_1.BDEFOptions), (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction));
|
|
57474
|
+
}
|
|
57475
|
+
}
|
|
57476
|
+
exports.BDEFOperation = BDEFOperation;
|
|
57477
|
+
//# sourceMappingURL=bdef_operation.js.map
|
|
57478
|
+
|
|
57479
|
+
/***/ },
|
|
57480
|
+
|
|
57481
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_options.js"
|
|
57482
|
+
/*!********************************************************************************!*\
|
|
57483
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_options.js ***!
|
|
57484
|
+
\********************************************************************************/
|
|
57485
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57486
|
+
|
|
57487
|
+
"use strict";
|
|
57488
|
+
|
|
57489
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57490
|
+
exports.BDEFOptions = void 0;
|
|
57491
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57492
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57493
|
+
/** eg. "( features : instance, precheck )", "( read only )" or "( hierarchy-index )" */
|
|
57494
|
+
class BDEFOptions extends combi_1.Expression {
|
|
57495
|
+
getRunnable() {
|
|
57496
|
+
const name = (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.altPrio)((0, combi_1.seq)("-", _1.BDEFName), _1.BDEFName)));
|
|
57497
|
+
const option = (0, combi_1.seq)(name, (0, combi_1.optPrio)((0, combi_1.seq)(":", _1.BDEFName)));
|
|
57498
|
+
return (0, combi_1.seq)("(", option, (0, combi_1.starPrio)((0, combi_1.seq)(",", option)), ")");
|
|
57499
|
+
}
|
|
57500
|
+
}
|
|
57501
|
+
exports.BDEFOptions = BDEFOptions;
|
|
57502
|
+
//# sourceMappingURL=bdef_options.js.map
|
|
57503
|
+
|
|
57504
|
+
/***/ },
|
|
57505
|
+
|
|
57506
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_parameter.js"
|
|
57507
|
+
/*!**********************************************************************************!*\
|
|
57508
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_parameter.js ***!
|
|
57509
|
+
\**********************************************************************************/
|
|
57510
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57511
|
+
|
|
57512
|
+
"use strict";
|
|
57513
|
+
|
|
57514
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57515
|
+
exports.BDEFParameter = void 0;
|
|
57516
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57517
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57518
|
+
/** eg. "deep parameter ZD_PARAMETER" */
|
|
57519
|
+
class BDEFParameter extends combi_1.Expression {
|
|
57520
|
+
getRunnable() {
|
|
57521
|
+
return (0, combi_1.seq)((0, combi_1.optPrio)("DEEP"), "PARAMETER", _1.BDEFName);
|
|
57522
|
+
}
|
|
57523
|
+
}
|
|
57524
|
+
exports.BDEFParameter = BDEFParameter;
|
|
57525
|
+
//# sourceMappingURL=bdef_parameter.js.map
|
|
57526
|
+
|
|
57527
|
+
/***/ },
|
|
57528
|
+
|
|
57529
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_reference.js"
|
|
57530
|
+
/*!**********************************************************************************!*\
|
|
57531
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_reference.js ***!
|
|
57532
|
+
\**********************************************************************************/
|
|
57533
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57534
|
+
|
|
57535
|
+
"use strict";
|
|
57536
|
+
|
|
57537
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57538
|
+
exports.BDEFReference = void 0;
|
|
57539
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57540
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57541
|
+
/** reference to a determination, validation or action, optionally prefixed with an entity, eg. "Child ~ validatePercentage" */
|
|
57542
|
+
class BDEFReference extends combi_1.Expression {
|
|
57543
|
+
getRunnable() {
|
|
57544
|
+
const namespace = (0, combi_1.seq)("/", (0, combi_1.regex)(/^\w+$/), "/");
|
|
57545
|
+
const tildeEnd = (0, combi_1.regex)(/^\w+~$/);
|
|
57546
|
+
return (0, combi_1.altPrio)((0, combi_1.seq)(_1.BDEFName, "~", _1.BDEFName), (0, combi_1.seq)(_1.BDEFName, (0, combi_1.regex)(/^~\w+$/)), (0, combi_1.seq)((0, combi_1.optPrio)(namespace), tildeEnd, _1.BDEFName), (0, combi_1.seq)((0, combi_1.optPrio)(namespace), (0, combi_1.regex)(/^\w+~\w+$/)), _1.BDEFName);
|
|
57547
|
+
}
|
|
57548
|
+
}
|
|
57549
|
+
exports.BDEFReference = BDEFReference;
|
|
57550
|
+
//# sourceMappingURL=bdef_reference.js.map
|
|
57551
|
+
|
|
57552
|
+
/***/ },
|
|
57553
|
+
|
|
57554
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_result.js"
|
|
57555
|
+
/*!*******************************************************************************!*\
|
|
57556
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_result.js ***!
|
|
57557
|
+
\*******************************************************************************/
|
|
57558
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57559
|
+
|
|
57560
|
+
"use strict";
|
|
57561
|
+
|
|
57562
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57563
|
+
exports.BDEFResult = void 0;
|
|
57564
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57565
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57566
|
+
/** eg. "result [1] $self", "deep result ZD_RESULT" or "result selective [0..*] entity ZI_Travel" */
|
|
57567
|
+
class BDEFResult extends combi_1.Expression {
|
|
57568
|
+
getRunnable() {
|
|
57569
|
+
return (0, combi_1.seq)((0, combi_1.optPrio)("DEEP"), "RESULT", (0, combi_1.optPrio)("SELECTIVE"), (0, combi_1.optPrio)(_1.BDEFCardinality), (0, combi_1.optPrio)("ENTITY"), _1.BDEFName);
|
|
57570
|
+
}
|
|
57571
|
+
}
|
|
57572
|
+
exports.BDEFResult = BDEFResult;
|
|
57573
|
+
//# sourceMappingURL=bdef_result.js.map
|
|
57574
|
+
|
|
57575
|
+
/***/ },
|
|
57576
|
+
|
|
57577
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_side_effects.js"
|
|
57578
|
+
/*!*************************************************************************************!*\
|
|
57579
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_side_effects.js ***!
|
|
57580
|
+
\*************************************************************************************/
|
|
57581
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57582
|
+
|
|
57583
|
+
"use strict";
|
|
57584
|
+
|
|
57585
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57586
|
+
exports.BDEFSideEffects = void 0;
|
|
57587
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57588
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57589
|
+
/** eg. "side effects { field Price affects field TotalPrice, messages; }" */
|
|
57590
|
+
class BDEFSideEffects extends combi_1.Expression {
|
|
57591
|
+
getRunnable() {
|
|
57592
|
+
const fieldList = (0, combi_1.seq)("(", _1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFName)), ")");
|
|
57593
|
+
// eg. "field *", "field ( A, B )", "field _Item.*" or "field _Root.( A, B )"
|
|
57594
|
+
const field = (0, combi_1.seq)("FIELD", (0, combi_1.altPrio)("*", fieldList, (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(".", (0, combi_1.altPrio)("*", fieldList, _1.BDEFName))))));
|
|
57595
|
+
const permission = (0, combi_1.altPrio)((0, combi_1.seq)("ACTION", _1.BDEFReference), field, (0, combi_1.seq)((0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), (0, combi_1.optPrio)(_1.BDEFName)));
|
|
57596
|
+
const permissions = (0, combi_1.seq)("PERMISSIONS", "(", permission, (0, combi_1.starPrio)((0, combi_1.seq)(",", permission)), ")");
|
|
57597
|
+
const target = (0, combi_1.altPrio)(field, (0, combi_1.seq)("ENTITY", _1.BDEFFieldPath), "MESSAGES", permissions, "$SELF");
|
|
57598
|
+
const targets = (0, combi_1.seq)(target, (0, combi_1.starPrio)((0, combi_1.seq)(",", target)));
|
|
57599
|
+
const trigger = (0, combi_1.altPrio)(field, (0, combi_1.seq)("ENTITY", _1.BDEFFieldPath), "$SELF");
|
|
57600
|
+
const triggers = (0, combi_1.seq)(trigger, (0, combi_1.starPrio)((0, combi_1.seq)(",", trigger)));
|
|
57601
|
+
const source = (0, combi_1.altPrio)(field, (0, combi_1.seq)("ACTION", _1.BDEFReference), (0, combi_1.seq)("DETERMINE ACTION", _1.BDEFReference, "EXECUTED ON", triggers), (0, combi_1.seq)("ENTITY", _1.BDEFFieldPath), (0, combi_1.seq)("EVENT", _1.BDEFName), "$SELF");
|
|
57602
|
+
const recommendation = (0, combi_1.seq)("RECOMMENDATION FUNCTION", _1.BDEFName, "EXECUTED ON", triggers, ";");
|
|
57603
|
+
const item = (0, combi_1.altPrio)((0, combi_1.seq)(source, "AFFECTS", targets, ";"), recommendation, ";");
|
|
57604
|
+
return (0, combi_1.seq)("SIDE EFFECTS", "{", (0, combi_1.starPrio)(item), "}");
|
|
57605
|
+
}
|
|
57606
|
+
}
|
|
57607
|
+
exports.BDEFSideEffects = BDEFSideEffects;
|
|
57608
|
+
//# sourceMappingURL=bdef_side_effects.js.map
|
|
57609
|
+
|
|
57610
|
+
/***/ },
|
|
57611
|
+
|
|
57612
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_string.js"
|
|
57613
|
+
/*!*******************************************************************************!*\
|
|
57614
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_string.js ***!
|
|
57615
|
+
\*******************************************************************************/
|
|
57616
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57617
|
+
|
|
57618
|
+
"use strict";
|
|
57619
|
+
|
|
57620
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57621
|
+
exports.BDEFString = void 0;
|
|
57622
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57623
|
+
class BDEFString extends combi_1.Expression {
|
|
57624
|
+
getRunnable() {
|
|
57625
|
+
return (0, combi_1.regex)(/^'(?:[^']|'')*'$/);
|
|
57626
|
+
}
|
|
57627
|
+
}
|
|
57628
|
+
exports.BDEFString = BDEFString;
|
|
57629
|
+
//# sourceMappingURL=bdef_string.js.map
|
|
57630
|
+
|
|
57631
|
+
/***/ },
|
|
57632
|
+
|
|
57633
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_use.js"
|
|
57634
|
+
/*!****************************************************************************!*\
|
|
57635
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_use.js ***!
|
|
57636
|
+
\****************************************************************************/
|
|
57637
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57638
|
+
|
|
57639
|
+
"use strict";
|
|
57640
|
+
|
|
57641
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57642
|
+
exports.BDEFUse = void 0;
|
|
57643
|
+
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
57644
|
+
const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
|
|
57645
|
+
/** reuse in projections and interfaces, eg. "use action acceptTravel as accept;" */
|
|
57646
|
+
class BDEFUse extends combi_1.Expression {
|
|
57647
|
+
getRunnable() {
|
|
57648
|
+
const end = (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction);
|
|
57649
|
+
const operation = (0, combi_1.seq)((0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), (0, combi_1.optPrio)(_1.BDEFOptions), end);
|
|
57650
|
+
const actionTail = (0, combi_1.altPrio)((0, combi_1.seq)("AS", _1.BDEFName), (0, combi_1.seq)("EXTERNAL", _1.BDEFString), _1.BDEFParameter, _1.BDEFResult);
|
|
57651
|
+
const action = (0, combi_1.seq)((0, combi_1.altPrio)("ACTION", "FUNCTION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.starPrio)(actionTail), end);
|
|
57652
|
+
const association = (0, combi_1.seq)("ASSOCIATION", (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.optPrio)((0, combi_1.seq)("ABBREVIATION", _1.BDEFName)), (0, combi_1.altPrio)(";", _1.BDEFAssociationBody));
|
|
57653
|
+
return (0, combi_1.seq)("USE", (0, combi_1.altPrio)(operation, action, association, (0, combi_1.seq)("ETAG", ";"), (0, combi_1.seq)("SIDE EFFECTS", ";"), (0, combi_1.seq)("KEY", _1.BDEFName, ";"), (0, combi_1.seq)("EVENT", _1.BDEFName, (0, combi_1.optPrio)(_1.BDEFParameter), ";")));
|
|
57654
|
+
}
|
|
57655
|
+
}
|
|
57656
|
+
exports.BDEFUse = BDEFUse;
|
|
57657
|
+
//# sourceMappingURL=bdef_use.js.map
|
|
57658
|
+
|
|
57659
|
+
/***/ },
|
|
57660
|
+
|
|
57661
|
+
/***/ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js"
|
|
57662
|
+
/*!*************************************************************************!*\
|
|
57663
|
+
!*** ./node_modules/@abaplint/core/build/src/bdef/expressions/index.js ***!
|
|
57664
|
+
\*************************************************************************/
|
|
57665
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
57666
|
+
|
|
57667
|
+
"use strict";
|
|
57668
|
+
|
|
57669
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
57670
|
+
if (k2 === undefined) k2 = k;
|
|
57671
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
57672
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
57673
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
57674
|
+
}
|
|
57675
|
+
Object.defineProperty(o, k2, desc);
|
|
57676
|
+
}) : (function(o, m, k, k2) {
|
|
57677
|
+
if (k2 === undefined) k2 = k;
|
|
57678
|
+
o[k2] = m[k];
|
|
57679
|
+
}));
|
|
57680
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
57681
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
57682
|
+
};
|
|
57683
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
57684
|
+
__exportStar(__webpack_require__(/*! ./bdef_action */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_action.js"), exports);
|
|
57685
|
+
__exportStar(__webpack_require__(/*! ./bdef_alias */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_alias.js"), exports);
|
|
57686
|
+
__exportStar(__webpack_require__(/*! ./bdef_association_body */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_association_body.js"), exports);
|
|
57687
|
+
__exportStar(__webpack_require__(/*! ./bdef_association */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_association.js"), exports);
|
|
57688
|
+
__exportStar(__webpack_require__(/*! ./bdef_authorization_context */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_authorization_context.js"), exports);
|
|
57689
|
+
__exportStar(__webpack_require__(/*! ./bdef_cardinality */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_cardinality.js"), exports);
|
|
57690
|
+
__exportStar(__webpack_require__(/*! ./bdef_default_function */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_default_function.js"), exports);
|
|
57691
|
+
__exportStar(__webpack_require__(/*! ./bdef_define_behavior */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_define_behavior.js"), exports);
|
|
57692
|
+
__exportStar(__webpack_require__(/*! ./bdef_definition */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_definition.js"), exports);
|
|
57693
|
+
__exportStar(__webpack_require__(/*! ./bdef_determination */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_determination.js"), exports);
|
|
57694
|
+
__exportStar(__webpack_require__(/*! ./bdef_determine_action */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_determine_action.js"), exports);
|
|
57695
|
+
__exportStar(__webpack_require__(/*! ./bdef_event */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_event.js"), exports);
|
|
57696
|
+
__exportStar(__webpack_require__(/*! ./bdef_field_path */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_field_path.js"), exports);
|
|
57697
|
+
__exportStar(__webpack_require__(/*! ./bdef_field */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_field.js"), exports);
|
|
57698
|
+
__exportStar(__webpack_require__(/*! ./bdef_header */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_header.js"), exports);
|
|
57699
|
+
__exportStar(__webpack_require__(/*! ./bdef_hierarchy */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_hierarchy.js"), exports);
|
|
57700
|
+
__exportStar(__webpack_require__(/*! ./bdef_implementation_in */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_implementation_in.js"), exports);
|
|
57701
|
+
__exportStar(__webpack_require__(/*! ./bdef_implementation_type */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_implementation_type.js"), exports);
|
|
57702
|
+
__exportStar(__webpack_require__(/*! ./bdef_key */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_key.js"), exports);
|
|
57703
|
+
__exportStar(__webpack_require__(/*! ./bdef_mapping */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_mapping.js"), exports);
|
|
57704
|
+
__exportStar(__webpack_require__(/*! ./bdef_name */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_name.js"), exports);
|
|
57705
|
+
__exportStar(__webpack_require__(/*! ./bdef_operation */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_operation.js"), exports);
|
|
57706
|
+
__exportStar(__webpack_require__(/*! ./bdef_options */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_options.js"), exports);
|
|
57707
|
+
__exportStar(__webpack_require__(/*! ./bdef_parameter */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_parameter.js"), exports);
|
|
57708
|
+
__exportStar(__webpack_require__(/*! ./bdef_reference */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_reference.js"), exports);
|
|
57709
|
+
__exportStar(__webpack_require__(/*! ./bdef_result */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_result.js"), exports);
|
|
57710
|
+
__exportStar(__webpack_require__(/*! ./bdef_side_effects */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_side_effects.js"), exports);
|
|
57711
|
+
__exportStar(__webpack_require__(/*! ./bdef_string */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_string.js"), exports);
|
|
57712
|
+
__exportStar(__webpack_require__(/*! ./bdef_use */ "./node_modules/@abaplint/core/build/src/bdef/expressions/bdef_use.js"), exports);
|
|
57713
|
+
//# sourceMappingURL=index.js.map
|
|
57714
|
+
|
|
57715
|
+
/***/ },
|
|
57716
|
+
|
|
56647
57717
|
/***/ "./node_modules/@abaplint/core/build/src/cds/cds_determine_types.js"
|
|
56648
57718
|
/*!**************************************************************************!*\
|
|
56649
57719
|
!*** ./node_modules/@abaplint/core/build/src/cds/cds_determine_types.js ***!
|
|
@@ -61667,6 +62737,7 @@ exports.Diagnostics = Diagnostics;
|
|
|
61667
62737
|
|
|
61668
62738
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
61669
62739
|
exports.DumpScope = void 0;
|
|
62740
|
+
const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
|
|
61670
62741
|
const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
|
|
61671
62742
|
class DumpScope {
|
|
61672
62743
|
static dump(spaghetti) {
|
|
@@ -61680,8 +62751,8 @@ class DumpScope {
|
|
|
61680
62751
|
const sident = " ".repeat(indent * 2);
|
|
61681
62752
|
let ret = sident + "<u>" + identifier.stype + ", <tt>" + identifier.sname + "</tt>";
|
|
61682
62753
|
ret += ", (" + coverage.start.getRow() + ", " + coverage.start.getCol() + ")";
|
|
61683
|
-
if (coverage.end.getRow() ===
|
|
61684
|
-
&& coverage.end.getCol() ===
|
|
62754
|
+
if (coverage.end.getRow() === position_1.MAX_POSITION_VALUE
|
|
62755
|
+
&& coverage.end.getCol() === position_1.MAX_POSITION_VALUE) {
|
|
61685
62756
|
ret += ", (max, max)";
|
|
61686
62757
|
}
|
|
61687
62758
|
else {
|
|
@@ -64285,6 +65356,8 @@ exports.BADIDefinition = BADIDefinition;
|
|
|
64285
65356
|
|
|
64286
65357
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
64287
65358
|
exports.BehaviorDefinition = void 0;
|
|
65359
|
+
const bdef_parser_1 = __webpack_require__(/*! ../bdef/bdef_parser */ "./node_modules/@abaplint/core/build/src/bdef/bdef_parser.js");
|
|
65360
|
+
const expressions_1 = __webpack_require__(/*! ../bdef/expressions */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
64288
65361
|
const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
|
|
64289
65362
|
class BehaviorDefinition extends _abstract_object_1.AbstractObject {
|
|
64290
65363
|
constructor() {
|
|
@@ -64307,8 +65380,30 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
|
|
|
64307
65380
|
findSourceFile() {
|
|
64308
65381
|
return this.getFiles().find(f => f.getFilename().endsWith(".asbdef"));
|
|
64309
65382
|
}
|
|
65383
|
+
parse() {
|
|
65384
|
+
if (this.isDirty() === false && this.parsedData !== undefined) {
|
|
65385
|
+
return { updated: false, runtime: 0 };
|
|
65386
|
+
}
|
|
65387
|
+
const start = Date.now();
|
|
65388
|
+
const tree = new bdef_parser_1.BDEFParser().parse(this.findSourceFile());
|
|
65389
|
+
this.parsedData = {
|
|
65390
|
+
entities: tree ? this.findEntities(tree) : this.findEntitiesFallback(),
|
|
65391
|
+
tree,
|
|
65392
|
+
};
|
|
65393
|
+
this.dirty = false;
|
|
65394
|
+
return { updated: true, runtime: Date.now() - start };
|
|
65395
|
+
}
|
|
65396
|
+
getTree() {
|
|
65397
|
+
var _a;
|
|
65398
|
+
this.parse();
|
|
65399
|
+
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.tree;
|
|
65400
|
+
}
|
|
65401
|
+
hasParserError() {
|
|
65402
|
+
return this.findSourceFile() !== undefined && this.getTree() === undefined;
|
|
65403
|
+
}
|
|
64310
65404
|
listEntities() {
|
|
64311
|
-
|
|
65405
|
+
this.parse();
|
|
65406
|
+
return this.parsedData.entities;
|
|
64312
65407
|
}
|
|
64313
65408
|
/** finds the entity name for a given alias, undefined if the alias is not defined */
|
|
64314
65409
|
findEntityNameByAlias(alias) {
|
|
@@ -64322,15 +65417,29 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
|
|
|
64322
65417
|
return undefined;
|
|
64323
65418
|
}
|
|
64324
65419
|
/////////////////////////
|
|
64325
|
-
|
|
65420
|
+
findEntities(tree) {
|
|
64326
65421
|
var _a;
|
|
64327
|
-
|
|
64328
|
-
|
|
65422
|
+
const ret = [];
|
|
65423
|
+
for (const define of tree.findDirectExpressions(expressions_1.BDEFDefineBehavior)) {
|
|
65424
|
+
const name = define.findDirectExpression(expressions_1.BDEFName);
|
|
65425
|
+
if (name === undefined) {
|
|
65426
|
+
continue;
|
|
65427
|
+
}
|
|
65428
|
+
const alias = (_a = define.findDirectExpression(expressions_1.BDEFAlias)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.BDEFName);
|
|
65429
|
+
ret.push({
|
|
65430
|
+
name: name.concatTokens().replace(/ /g, ""),
|
|
65431
|
+
alias: alias === null || alias === void 0 ? void 0 : alias.concatTokens().replace(/ /g, ""),
|
|
65432
|
+
});
|
|
64329
65433
|
}
|
|
64330
|
-
|
|
65434
|
+
return ret;
|
|
65435
|
+
}
|
|
65436
|
+
/** used if the source cannot be parsed */
|
|
65437
|
+
findEntitiesFallback() {
|
|
65438
|
+
var _a;
|
|
65439
|
+
const ret = [];
|
|
64331
65440
|
const raw = (_a = this.findSourceFile()) === null || _a === void 0 ? void 0 : _a.getRaw();
|
|
64332
65441
|
if (raw === undefined) {
|
|
64333
|
-
return
|
|
65442
|
+
return ret;
|
|
64334
65443
|
}
|
|
64335
65444
|
// BDEF uses "//" for line comments
|
|
64336
65445
|
const stripped = raw.replace(/\/\/.*$/gm, "");
|
|
@@ -64338,10 +65447,10 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
|
|
|
64338
65447
|
const regex = /\bdefine\s+(?:\w+\s+)*?behavior\s+for\s+([\w/]+)(?:\s+alias\s+(\w+))?/gi;
|
|
64339
65448
|
let match = regex.exec(stripped);
|
|
64340
65449
|
while (match !== null) {
|
|
64341
|
-
|
|
65450
|
+
ret.push({ name: match[1], alias: match[2] });
|
|
64342
65451
|
match = regex.exec(stripped);
|
|
64343
65452
|
}
|
|
64344
|
-
return
|
|
65453
|
+
return ret;
|
|
64345
65454
|
}
|
|
64346
65455
|
}
|
|
64347
65456
|
exports.BehaviorDefinition = BehaviorDefinition;
|
|
@@ -72051,7 +73160,10 @@ exports.WebReportingTemplate = WebReportingTemplate;
|
|
|
72051
73160
|
"use strict";
|
|
72052
73161
|
|
|
72053
73162
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
72054
|
-
exports.Position = void 0;
|
|
73163
|
+
exports.Position = exports.MAX_POSITION_VALUE = void 0;
|
|
73164
|
+
// largest value that is a Smi on all V8 builds, larger values (eg. Number.MAX_SAFE_INTEGER) make V8
|
|
73165
|
+
// store row/col of every Position as boxed heap numbers, costing ~32 bytes per Position
|
|
73166
|
+
exports.MAX_POSITION_VALUE = 2 ** 30 - 1;
|
|
72055
73167
|
// first position is (1,1)
|
|
72056
73168
|
class Position {
|
|
72057
73169
|
constructor(row, col) {
|
|
@@ -72602,7 +73714,7 @@ class Registry {
|
|
|
72602
73714
|
}
|
|
72603
73715
|
static abaplintVersion() {
|
|
72604
73716
|
// magic, see build script "version.js"
|
|
72605
|
-
return "2.120.
|
|
73717
|
+
return "2.120.86";
|
|
72606
73718
|
}
|
|
72607
73719
|
getDDICReferences() {
|
|
72608
73720
|
return this.ddicReferences;
|
|
@@ -73158,14 +74270,18 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
73158
74270
|
};
|
|
73159
74271
|
})();
|
|
73160
74272
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
73161
|
-
exports.SourceKind = exports.PredicateKind = exports.Procedure = exports.ObjectAnalysis = exports.Variable = exports.OccurrenceKind = void 0;
|
|
74273
|
+
exports.Hierarchy = exports.NUMERIC_FUNCTIONS = exports.SourceKind = exports.PredicateKind = exports.InitialDeclaration = exports.Procedure = exports.ObjectAnalysis = exports.Variable = exports.OccurrenceKind = void 0;
|
|
73162
74274
|
exports.findStructures = findStructures;
|
|
73163
74275
|
exports.expressionPath = expressionPath;
|
|
73164
74276
|
exports.plainMove = plainMove;
|
|
74277
|
+
exports.plainCreateObject = plainCreateObject;
|
|
73165
74278
|
exports.singleField = singleField;
|
|
73166
74279
|
exports.singleTarget = singleTarget;
|
|
73167
74280
|
exports.plainClear = plainClear;
|
|
73168
74281
|
exports.plainData = plainData;
|
|
74282
|
+
exports.initialValue = initialValue;
|
|
74283
|
+
exports.initialDeclaration = initialDeclaration;
|
|
74284
|
+
exports.initialAtFirstReference = initialAtFirstReference;
|
|
73169
74285
|
exports.isImmutable = isImmutable;
|
|
73170
74286
|
exports.isReferenceType = isReferenceType;
|
|
73171
74287
|
exports.identicalTypes = identicalTypes;
|
|
@@ -73176,6 +74292,10 @@ exports.isCondition = isCondition;
|
|
|
73176
74292
|
exports.dataSource = dataSource;
|
|
73177
74293
|
exports.targetType = targetType;
|
|
73178
74294
|
exports.unchangedBetween = unchangedBetween;
|
|
74295
|
+
exports.formalParameter = formalParameter;
|
|
74296
|
+
exports.passedByValue = passedByValue;
|
|
74297
|
+
exports.literalType = literalType;
|
|
74298
|
+
exports.expressionType = expressionType;
|
|
73179
74299
|
exports.mergeEdits = mergeEdits;
|
|
73180
74300
|
exports.deleteRegion = deleteRegion;
|
|
73181
74301
|
exports.deleteStatement = deleteStatement;
|
|
@@ -73195,6 +74315,10 @@ const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "./node_modu
|
|
|
73195
74315
|
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
73196
74316
|
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
|
|
73197
74317
|
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
74318
|
+
const class_definition_1 = __webpack_require__(/*! ../abap/types/class_definition */ "./node_modules/@abaplint/core/build/src/abap/types/class_definition.js");
|
|
74319
|
+
const interface_definition_1 = __webpack_require__(/*! ../abap/types/interface_definition */ "./node_modules/@abaplint/core/build/src/abap/types/interface_definition.js");
|
|
74320
|
+
const class_1 = __webpack_require__(/*! ../objects/class */ "./node_modules/@abaplint/core/build/src/objects/class.js");
|
|
74321
|
+
const interface_1 = __webpack_require__(/*! ../objects/interface */ "./node_modules/@abaplint/core/build/src/objects/interface.js");
|
|
73198
74322
|
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
|
|
73199
74323
|
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
73200
74324
|
const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
|
|
@@ -73467,6 +74591,23 @@ class Procedure {
|
|
|
73467
74591
|
}
|
|
73468
74592
|
return between;
|
|
73469
74593
|
}
|
|
74594
|
+
/** the next statement executed after a direct statement of a block, skipping declarations, which have no effect
|
|
74595
|
+
* where they are written; undefined if there is none in the block */
|
|
74596
|
+
nextExecuted(statement) {
|
|
74597
|
+
const block = this.block(statement);
|
|
74598
|
+
for (let index = this.index(statement) + 1; index < this.statements.length; index++) {
|
|
74599
|
+
const next = this.statements[index];
|
|
74600
|
+
const type = next.get();
|
|
74601
|
+
if (this.block(next) !== block) {
|
|
74602
|
+
return undefined;
|
|
74603
|
+
}
|
|
74604
|
+
else if (!(this.isSimple(next) && (type instanceof Statements.Data || type instanceof Statements.Type
|
|
74605
|
+
|| type instanceof Statements.Constant || type instanceof Statements.FieldSymbol || type instanceof _statement_1.Comment))) {
|
|
74606
|
+
return next;
|
|
74607
|
+
}
|
|
74608
|
+
}
|
|
74609
|
+
return undefined;
|
|
74610
|
+
}
|
|
73470
74611
|
/** a comment line or end of line comment between the two positions */
|
|
73471
74612
|
hasComment(start, end) {
|
|
73472
74613
|
if (this.comments === undefined) {
|
|
@@ -73477,6 +74618,18 @@ class Procedure {
|
|
|
73477
74618
|
}
|
|
73478
74619
|
return this.comments.some(c => !c.isBefore(start) && c.isBefore(end));
|
|
73479
74620
|
}
|
|
74621
|
+
/** a structure of one of the types contains the statement */
|
|
74622
|
+
enclosedBy(statement, types) {
|
|
74623
|
+
let parent = this.parents.get(statement);
|
|
74624
|
+
while (parent !== undefined && parent !== this.structure) {
|
|
74625
|
+
const type = parent.get();
|
|
74626
|
+
if (types.some(t => type instanceof t)) {
|
|
74627
|
+
return true;
|
|
74628
|
+
}
|
|
74629
|
+
parent = this.parents.get(parent);
|
|
74630
|
+
}
|
|
74631
|
+
return false;
|
|
74632
|
+
}
|
|
73480
74633
|
/** the IF structure of an IF or ELSEIF statement */
|
|
73481
74634
|
ifStructure(statement) {
|
|
73482
74635
|
let parent = this.parents.get(statement);
|
|
@@ -73549,6 +74702,23 @@ class Procedure {
|
|
|
73549
74702
|
}
|
|
73550
74703
|
return variable;
|
|
73551
74704
|
}
|
|
74705
|
+
/** memory that only this procedure can reach: a local variable, or a pass-by-value or RETURNING parameter of
|
|
74706
|
+
* a method or form, with all references understood and its address never taken */
|
|
74707
|
+
private(identifier) {
|
|
74708
|
+
const variable = this.variable(identifier);
|
|
74709
|
+
if (variable === undefined || variable.complete === false || variable.escapes()
|
|
74710
|
+
|| variable.identifier.getMeta().includes("static" /* IdentifierMeta.Static */)) {
|
|
74711
|
+
return undefined;
|
|
74712
|
+
}
|
|
74713
|
+
const meta = variable.identifier.getMeta();
|
|
74714
|
+
if (variable.isLocal()) {
|
|
74715
|
+
return variable;
|
|
74716
|
+
}
|
|
74717
|
+
// function module parameters can be global parameters of the function group
|
|
74718
|
+
const parameter = !(this.structure.get() instanceof Structures.FunctionModule)
|
|
74719
|
+
&& (meta.includes("pass_by_value" /* IdentifierMeta.PassByValue */) || meta.includes("returning" /* IdentifierMeta.MethodReturning */));
|
|
74720
|
+
return parameter ? variable : undefined;
|
|
74721
|
+
}
|
|
73552
74722
|
/** all local variables declared in the procedure */
|
|
73553
74723
|
locals() {
|
|
73554
74724
|
var _a;
|
|
@@ -73640,6 +74810,17 @@ class Procedure {
|
|
|
73640
74810
|
}
|
|
73641
74811
|
return statement.findFirstExpression(Expressions.NewObject) === undefined;
|
|
73642
74812
|
}
|
|
74813
|
+
/** the method or builtin function called at the method name token */
|
|
74814
|
+
methodAt(token) {
|
|
74815
|
+
for (const reference of this.analysis.referencesAt(this.file.getFilename(), token)) {
|
|
74816
|
+
if ((reference.referenceType === _reference_1.ReferenceType.MethodReference
|
|
74817
|
+
|| reference.referenceType === _reference_1.ReferenceType.BuiltinMethodReference)
|
|
74818
|
+
&& reference.resolved !== undefined && "getParameters" in reference.resolved) {
|
|
74819
|
+
return reference.resolved;
|
|
74820
|
+
}
|
|
74821
|
+
}
|
|
74822
|
+
return undefined;
|
|
74823
|
+
}
|
|
73643
74824
|
/** every data write in the statement goes to a local variable, a pass-by-value parameter or the
|
|
73644
74825
|
* RETURNING parameter, ie. memory that no other data object, field symbol or reference can share */
|
|
73645
74826
|
writesOnlyPrivate(statement) {
|
|
@@ -73810,6 +74991,31 @@ function plainMove(statement) {
|
|
|
73810
74991
|
}
|
|
73811
74992
|
return { target, source, operator };
|
|
73812
74993
|
}
|
|
74994
|
+
/** CREATE OBJECT target [TYPE class] [EXPORTING parameters]. without chaining, pragmas, EXCEPTIONS or dynamic parts */
|
|
74995
|
+
function plainCreateObject(statement) {
|
|
74996
|
+
if (!(statement.get() instanceof Statements.CreateObject) || statement.getColon() !== undefined
|
|
74997
|
+
|| statement.getPragmas().length > 0) {
|
|
74998
|
+
return undefined;
|
|
74999
|
+
}
|
|
75000
|
+
const children = statement.getChildren();
|
|
75001
|
+
const target = children[2];
|
|
75002
|
+
if (!(target instanceof nodes_1.ExpressionNode) || !(target.get() instanceof Expressions.Target)) {
|
|
75003
|
+
return undefined;
|
|
75004
|
+
}
|
|
75005
|
+
let type;
|
|
75006
|
+
// the last child is the period
|
|
75007
|
+
for (let i = 3; i < children.length - 1; i += 2) {
|
|
75008
|
+
const word = children[i] instanceof nodes_1.TokenNode ? children[i].getFirstToken().getStr().toUpperCase() : "";
|
|
75009
|
+
const value = children[i + 1];
|
|
75010
|
+
if (word === "TYPE" && value instanceof nodes_1.ExpressionNode && value.get() instanceof Expressions.ClassName) {
|
|
75011
|
+
type = value;
|
|
75012
|
+
}
|
|
75013
|
+
else if (!(word === "EXPORTING" && (value === null || value === void 0 ? void 0 : value.get()) instanceof Expressions.ParameterListS)) {
|
|
75014
|
+
return undefined;
|
|
75015
|
+
}
|
|
75016
|
+
}
|
|
75017
|
+
return { target, type };
|
|
75018
|
+
}
|
|
73813
75019
|
/** the source is a single field, ie. one token */
|
|
73814
75020
|
function singleField(source) {
|
|
73815
75021
|
var _a;
|
|
@@ -73844,6 +75050,49 @@ function plainData(statement) {
|
|
|
73844
75050
|
return statement.get() instanceof Statements.Data
|
|
73845
75051
|
&& ((_a = statement.findDirectExpression(Expressions.DataDefinition)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Value)) === undefined;
|
|
73846
75052
|
}
|
|
75053
|
+
/** VALUE type( ) with an explicit type and an empty body, ie. the initial value of the type */
|
|
75054
|
+
function initialValue(source) {
|
|
75055
|
+
const tokens = source.getTokens();
|
|
75056
|
+
return tokens.length === 4 && tokens[0].getStr().toUpperCase() === "VALUE"
|
|
75057
|
+
&& source.findDirectExpression(Expressions.TypeNameOrInfer) !== undefined
|
|
75058
|
+
&& tokens[1].getStr() !== "#" && tokens[2].getStr() === "(" && tokens[3].getStr() === ")";
|
|
75059
|
+
}
|
|
75060
|
+
var InitialDeclaration;
|
|
75061
|
+
(function (InitialDeclaration) {
|
|
75062
|
+
/** DATA v TYPE ... without VALUE: v is initial when the procedure starts, the statement is not executed */
|
|
75063
|
+
InitialDeclaration["Data"] = "data";
|
|
75064
|
+
/** DATA(v) = VALUE t( ).: sets v to the initial value of t every time it is executed, also in each loop iteration */
|
|
75065
|
+
InitialDeclaration["Value"] = "value";
|
|
75066
|
+
})(InitialDeclaration || (exports.InitialDeclaration = InitialDeclaration = {}));
|
|
75067
|
+
/** how the declaration of a local variable makes it initial, undefined if it does not */
|
|
75068
|
+
function initialDeclaration(variable) {
|
|
75069
|
+
const declaration = variable.declaration;
|
|
75070
|
+
if (declaration === undefined) {
|
|
75071
|
+
return undefined;
|
|
75072
|
+
}
|
|
75073
|
+
else if (variable.inline === false) {
|
|
75074
|
+
return plainData(declaration) ? InitialDeclaration.Data : undefined;
|
|
75075
|
+
}
|
|
75076
|
+
const move = plainMove(declaration);
|
|
75077
|
+
return move !== undefined && move.operator === "=" && move.target.getChildren().length === 1
|
|
75078
|
+
&& move.target.findDirectExpression(Expressions.InlineData) !== undefined && initialValue(move.source)
|
|
75079
|
+
? InitialDeclaration.Value : undefined;
|
|
75080
|
+
}
|
|
75081
|
+
/** the variable is initial at the statement, which is its first reference after the declaration */
|
|
75082
|
+
function initialAtFirstReference(procedure, variable, statement) {
|
|
75083
|
+
const declaration = variable.declaration;
|
|
75084
|
+
const kind = initialDeclaration(variable);
|
|
75085
|
+
// neither the declaration nor the statement in a loop: nothing can change the variable before the statement
|
|
75086
|
+
const noLoop = procedure.loop(declaration) === undefined && procedure.loop(statement) === undefined;
|
|
75087
|
+
if (kind === InitialDeclaration.Data) {
|
|
75088
|
+
return noLoop;
|
|
75089
|
+
}
|
|
75090
|
+
else if (kind === InitialDeclaration.Value) {
|
|
75091
|
+
// executed before the statement in the same iteration
|
|
75092
|
+
return noLoop || (procedure.dominates(declaration, statement) && procedure.sameLoop(declaration, statement));
|
|
75093
|
+
}
|
|
75094
|
+
return false;
|
|
75095
|
+
}
|
|
73847
75096
|
/** constants of the class or program, builtin constants like abap_true, and me: never change */
|
|
73848
75097
|
function isImmutable(identifier) {
|
|
73849
75098
|
if (!(identifier instanceof _typed_identifier_1.TypedIdentifier)) {
|
|
@@ -73971,7 +75220,7 @@ var SourceKind;
|
|
|
73971
75220
|
(function (SourceKind) {
|
|
73972
75221
|
/** constants and me, never change */
|
|
73973
75222
|
SourceKind["Immutable"] = "immutable";
|
|
73974
|
-
/** a local variable, or a component of it, changes only by references to the variable */
|
|
75223
|
+
/** a local variable or a pass-by-value parameter, or a component of it, changes only by references to the variable */
|
|
73975
75224
|
SourceKind["Local"] = "local";
|
|
73976
75225
|
/** attributes, parameters, globals, anything reached via a reference: may change by other code */
|
|
73977
75226
|
SourceKind["Volatile"] = "volatile";
|
|
@@ -73980,6 +75229,7 @@ var SourceKind;
|
|
|
73980
75229
|
* expressions, field symbols or dereferencing with ->* */
|
|
73981
75230
|
function dataSource(procedure, source) {
|
|
73982
75231
|
var _a;
|
|
75232
|
+
var _b;
|
|
73983
75233
|
if (source.getChildren().length !== 1) {
|
|
73984
75234
|
return undefined;
|
|
73985
75235
|
}
|
|
@@ -74035,7 +75285,7 @@ function dataSource(procedure, source) {
|
|
|
74035
75285
|
if (type === undefined || type.isGeneric() || (type instanceof basic_1.TableType && type.isWithHeader())) {
|
|
74036
75286
|
return undefined;
|
|
74037
75287
|
}
|
|
74038
|
-
const local = next === 1 ? procedure.local(first) : undefined;
|
|
75288
|
+
const local = next === 1 ? (_b = procedure.local(first)) !== null && _b !== void 0 ? _b : procedure.private(first) : undefined;
|
|
74039
75289
|
let kind = SourceKind.Volatile;
|
|
74040
75290
|
if (deref === false && isImmutable(first)) {
|
|
74041
75291
|
kind = SourceKind.Immutable;
|
|
@@ -74116,7 +75366,8 @@ function unchangedBetween(procedure, source, from, to, read) {
|
|
|
74116
75366
|
const statement = procedure.statements[index];
|
|
74117
75367
|
if (index === end && read !== undefined) {
|
|
74118
75368
|
if (isReceiver(statement, read)
|
|
74119
|
-
|| (statement.get() instanceof Statements.Move && procedure.isCallFree(statement))
|
|
75369
|
+
|| (statement.get() instanceof Statements.Move && procedure.isCallFree(statement))
|
|
75370
|
+
|| passedByValue(procedure, statement, read)) {
|
|
74120
75371
|
continue;
|
|
74121
75372
|
}
|
|
74122
75373
|
}
|
|
@@ -74142,6 +75393,229 @@ function isReceiver(statement, token) {
|
|
|
74142
75393
|
&& receiver.countTokens() === 1 && receiver.getFirstToken().getStart().equals(token.getStart())
|
|
74143
75394
|
&& ((_b = chain === null || chain === void 0 ? void 0 : chain.getChildren()[1]) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr()) === "->";
|
|
74144
75395
|
}
|
|
75396
|
+
/** the token is the complete actual parameter for an importing parameter: m( v ), m( p = v ),
|
|
75397
|
+
* CALL METHOD m EXPORTING p = v, NEW c( p = v ) or CREATE OBJECT o EXPORTING p = v */
|
|
75398
|
+
function formalParameter(procedure, statement, token) {
|
|
75399
|
+
var _a, _b, _c;
|
|
75400
|
+
const path = expressionPath(statement, token);
|
|
75401
|
+
const index = path.findIndex(e => e.get() instanceof Expressions.Source && e.countTokens() === 1);
|
|
75402
|
+
const source = path[index];
|
|
75403
|
+
if (source === undefined || source.findDirectExpression(Expressions.FieldChain) === undefined
|
|
75404
|
+
|| !source.getFirstToken().getStart().equals(token.getStart())) {
|
|
75405
|
+
return undefined;
|
|
75406
|
+
}
|
|
75407
|
+
const parent = index > 0 ? path[index - 1] : undefined;
|
|
75408
|
+
let name;
|
|
75409
|
+
let call;
|
|
75410
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.get()) instanceof Expressions.MethodCallParam) {
|
|
75411
|
+
call = path[index - 2];
|
|
75412
|
+
}
|
|
75413
|
+
else if ((parent === null || parent === void 0 ? void 0 : parent.get()) instanceof Expressions.NewObject) {
|
|
75414
|
+
call = parent;
|
|
75415
|
+
}
|
|
75416
|
+
else if ((parent === null || parent === void 0 ? void 0 : parent.get()) instanceof Expressions.ParameterS && ((_a = path[index - 2]) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.ParameterListS) {
|
|
75417
|
+
name = (_b = parent.findDirectExpression(Expressions.ParameterName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
|
|
75418
|
+
const list = path[index - 3];
|
|
75419
|
+
const above = path[index - 4];
|
|
75420
|
+
if (list === undefined && statement.get() instanceof Statements.CreateObject) {
|
|
75421
|
+
call = statement;
|
|
75422
|
+
}
|
|
75423
|
+
else if ((list === null || list === void 0 ? void 0 : list.get()) instanceof Expressions.MethodCallParam) {
|
|
75424
|
+
call = above;
|
|
75425
|
+
}
|
|
75426
|
+
else if ((list === null || list === void 0 ? void 0 : list.get()) instanceof Expressions.NewObject) {
|
|
75427
|
+
call = list;
|
|
75428
|
+
}
|
|
75429
|
+
else if ((list === null || list === void 0 ? void 0 : list.get()) instanceof Expressions.MethodParameters && (above === null || above === void 0 ? void 0 : above.get()) instanceof Expressions.MethodCallParam) {
|
|
75430
|
+
call = path[index - 5];
|
|
75431
|
+
}
|
|
75432
|
+
else if ((list === null || list === void 0 ? void 0 : list.get()) instanceof Expressions.MethodParameters && (above === null || above === void 0 ? void 0 : above.get()) instanceof Expressions.MethodCallBody
|
|
75433
|
+
&& index === 4 && statement.get() instanceof Statements.Call) {
|
|
75434
|
+
call = statement;
|
|
75435
|
+
}
|
|
75436
|
+
}
|
|
75437
|
+
if (call === undefined) {
|
|
75438
|
+
return undefined;
|
|
75439
|
+
}
|
|
75440
|
+
let method;
|
|
75441
|
+
if (call instanceof nodes_1.ExpressionNode && call.get() instanceof Expressions.MethodCall) {
|
|
75442
|
+
const methodName = (_c = call.findDirectExpression(Expressions.MethodName)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
|
|
75443
|
+
method = methodName === undefined ? undefined : procedure.methodAt(methodName);
|
|
75444
|
+
}
|
|
75445
|
+
else if (call instanceof nodes_1.StatementNode && call.get() instanceof Statements.Call) {
|
|
75446
|
+
const methodSource = call.findDirectExpression(Expressions.MethodSource);
|
|
75447
|
+
method = methodSource === undefined ? undefined : procedure.methodAt(methodSource.getLastToken());
|
|
75448
|
+
}
|
|
75449
|
+
else if (!(call.get() instanceof Expressions.NewObject) && !(call.get() instanceof Statements.CreateObject)) {
|
|
75450
|
+
return undefined;
|
|
75451
|
+
}
|
|
75452
|
+
const parameters = method === null || method === void 0 ? void 0 : method.getParameters();
|
|
75453
|
+
const formal = name !== null && name !== void 0 ? name : parameters === null || parameters === void 0 ? void 0 : parameters.getDefaultImporting();
|
|
75454
|
+
const parameter = formal === undefined ? undefined
|
|
75455
|
+
: parameters === null || parameters === void 0 ? void 0 : parameters.getImporting().find(p => p.getName().toUpperCase() === formal.toUpperCase());
|
|
75456
|
+
return { call, method, parameter };
|
|
75457
|
+
}
|
|
75458
|
+
/** the token is the complete actual parameter for a pass-by-value importing parameter of the only call in the
|
|
75459
|
+
* statement, so the method gets a copy of the value when it is called, and nothing else runs before */
|
|
75460
|
+
function passedByValue(procedure, statement, token) {
|
|
75461
|
+
var _a, _b;
|
|
75462
|
+
if (!(statement.get() instanceof Statements.Call) && plainMove(statement) === undefined) {
|
|
75463
|
+
return false;
|
|
75464
|
+
}
|
|
75465
|
+
const formal = formalParameter(procedure, statement, token);
|
|
75466
|
+
if ((formal === null || formal === void 0 ? void 0 : formal.method) === undefined || ((_a = formal.parameter) === null || _a === void 0 ? void 0 : _a.getMeta().includes("pass_by_value" /* IdentifierMeta.PassByValue */)) !== true
|
|
75467
|
+
|| statement.findFirstExpression(Expressions.NewObject) !== undefined) {
|
|
75468
|
+
return false;
|
|
75469
|
+
}
|
|
75470
|
+
for (const call of statement.findAllExpressionsRecursive(Expressions.MethodCall)) {
|
|
75471
|
+
const name = (_b = call.findDirectExpression(Expressions.MethodName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
75472
|
+
const builtin = name === undefined ? false : procedure.analysis.referencesAt(procedure.file.getFilename(), name)
|
|
75473
|
+
.some(r => r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference);
|
|
75474
|
+
if (call !== formal.call && builtin === false) {
|
|
75475
|
+
return false;
|
|
75476
|
+
}
|
|
75477
|
+
}
|
|
75478
|
+
return true;
|
|
75479
|
+
}
|
|
75480
|
+
/** builtin functions whose result type follows the type of the argument */
|
|
75481
|
+
exports.NUMERIC_FUNCTIONS = new Set(["abs", "sign", "ceil", "floor", "trunc", "frac", "ipow", "nmax", "nmin",
|
|
75482
|
+
"round", "rescale"]);
|
|
75483
|
+
/** type of a literal: 'abc' is c LENGTH 3, `abc` is string, 12 is i */
|
|
75484
|
+
function literalType(constant) {
|
|
75485
|
+
var _a;
|
|
75486
|
+
var _b;
|
|
75487
|
+
if (constant.countTokens() !== 1) {
|
|
75488
|
+
return undefined;
|
|
75489
|
+
}
|
|
75490
|
+
const text = constant.getFirstToken().getStr();
|
|
75491
|
+
if (constant.findDirectExpression(Expressions.Integer) !== undefined) {
|
|
75492
|
+
const value = Number(text);
|
|
75493
|
+
return Number.isInteger(value) && Math.abs(value) <= 2147483647 ? basic_1.IntegerType.get() : undefined;
|
|
75494
|
+
}
|
|
75495
|
+
else if (text.startsWith("'") && text.endsWith("'") && text.length >= 2) {
|
|
75496
|
+
return new basic_1.CharacterType(Math.max(1, text.length - 2 - ((_b = (_a = text.match(/''/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0)));
|
|
75497
|
+
}
|
|
75498
|
+
else if (text.startsWith("`") && text.endsWith("`")) {
|
|
75499
|
+
return basic_1.StringType.get();
|
|
75500
|
+
}
|
|
75501
|
+
return undefined;
|
|
75502
|
+
}
|
|
75503
|
+
/** Static type of an expression whose type does not depend on where it is used: literals, string templates,
|
|
75504
|
+
* concatenations, xsdbool( ), boolc( ), data objects, method calls and attributes after method calls.
|
|
75505
|
+
* Undefined if not known, e.g. for constructor expressions, arithmetic or builtin functions typed by their argument */
|
|
75506
|
+
function expressionType(procedure, source) {
|
|
75507
|
+
var _a, _b, _c;
|
|
75508
|
+
const children = source.getChildren();
|
|
75509
|
+
const first = children[0];
|
|
75510
|
+
const keyword = first instanceof nodes_1.TokenNode ? first.getFirstToken().getStr().toUpperCase() : "";
|
|
75511
|
+
if (children.length === 4 && keyword === "XSDBOOL" && source.findDirectExpression(Expressions.Cond) !== undefined) {
|
|
75512
|
+
return new basic_1.CharacterType(1);
|
|
75513
|
+
}
|
|
75514
|
+
else if (children.length === 4 && keyword === "BOOLC" && source.findDirectExpression(Expressions.Cond) !== undefined) {
|
|
75515
|
+
return basic_1.StringType.get();
|
|
75516
|
+
}
|
|
75517
|
+
else if (children.length === 3 && children[1] instanceof nodes_1.TokenNode && children[1].getFirstToken().getStr() === "&&") {
|
|
75518
|
+
return basic_1.StringType.get();
|
|
75519
|
+
}
|
|
75520
|
+
else if (!(first instanceof nodes_1.ExpressionNode)) {
|
|
75521
|
+
return undefined;
|
|
75522
|
+
}
|
|
75523
|
+
if (children.length === 1 && first.get() instanceof Expressions.Constant) {
|
|
75524
|
+
return literalType(first);
|
|
75525
|
+
}
|
|
75526
|
+
else if (children.length === 1 && first.get() instanceof Expressions.StringTemplate) {
|
|
75527
|
+
return basic_1.StringType.get();
|
|
75528
|
+
}
|
|
75529
|
+
else if (children.length === 1 && first.get() instanceof Expressions.FieldChain) {
|
|
75530
|
+
return (_a = dataSource(procedure, source)) === null || _a === void 0 ? void 0 : _a.type;
|
|
75531
|
+
}
|
|
75532
|
+
else if (!(first.get() instanceof Expressions.MethodCallChain)) {
|
|
75533
|
+
return undefined;
|
|
75534
|
+
}
|
|
75535
|
+
// the last call of the chain, optionally followed by ->attribute
|
|
75536
|
+
let type;
|
|
75537
|
+
const last = first.getChildren()[first.getChildren().length - 1];
|
|
75538
|
+
if (last instanceof nodes_1.ExpressionNode && last.get() instanceof Expressions.MethodCall) {
|
|
75539
|
+
const name = (_b = last.findDirectExpression(Expressions.MethodName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
75540
|
+
const method = name === undefined ? undefined : procedure.methodAt(name);
|
|
75541
|
+
if (name === undefined || method === undefined || exports.NUMERIC_FUNCTIONS.has(name.getStr().toLowerCase())) {
|
|
75542
|
+
return undefined;
|
|
75543
|
+
}
|
|
75544
|
+
type = (_c = method.getParameters().getReturning()) === null || _c === void 0 ? void 0 : _c.getType();
|
|
75545
|
+
}
|
|
75546
|
+
else {
|
|
75547
|
+
return undefined;
|
|
75548
|
+
}
|
|
75549
|
+
if (children.length === 1) {
|
|
75550
|
+
return type;
|
|
75551
|
+
}
|
|
75552
|
+
const attribute = children[2];
|
|
75553
|
+
if (children.length === 3 && children[1].get() instanceof Expressions.Arrow && attribute instanceof nodes_1.ExpressionNode
|
|
75554
|
+
&& attribute.get() instanceof Expressions.AttributeChain && attribute.getChildren().length === 1) {
|
|
75555
|
+
const identifier = procedure.identifierAt(attribute.getFirstToken());
|
|
75556
|
+
return identifier instanceof _typed_identifier_1.TypedIdentifier ? identifier.getType() : undefined;
|
|
75557
|
+
}
|
|
75558
|
+
return undefined;
|
|
75559
|
+
}
|
|
75560
|
+
////////////////////////////////////////
|
|
75561
|
+
// classes and interfaces
|
|
75562
|
+
/** classes and interfaces by name: local ones in the scope of the procedure, global ones in the registry */
|
|
75563
|
+
class Hierarchy {
|
|
75564
|
+
constructor(reg, procedure) {
|
|
75565
|
+
this.reg = reg;
|
|
75566
|
+
this.procedure = procedure;
|
|
75567
|
+
}
|
|
75568
|
+
find(name) {
|
|
75569
|
+
var _a;
|
|
75570
|
+
const scope = this.procedure.analysis.spaghetti.lookupPosition(this.procedure.getStart(), this.procedure.file.getFilename());
|
|
75571
|
+
const local = (_a = scope === null || scope === void 0 ? void 0 : scope.findClassDefinition(name)) !== null && _a !== void 0 ? _a : scope === null || scope === void 0 ? void 0 : scope.findInterfaceDefinition(name);
|
|
75572
|
+
if (local !== undefined) {
|
|
75573
|
+
return local;
|
|
75574
|
+
}
|
|
75575
|
+
const clas = this.reg.getObject("CLAS", name);
|
|
75576
|
+
if (clas instanceof class_1.Class) {
|
|
75577
|
+
return clas.getDefinition();
|
|
75578
|
+
}
|
|
75579
|
+
const intf = this.reg.getObject("INTF", name);
|
|
75580
|
+
return intf instanceof interface_1.Interface ? intf.getDefinition() : undefined;
|
|
75581
|
+
}
|
|
75582
|
+
/** the class or interface definition of an object reference type, undefined if it is not known */
|
|
75583
|
+
definition(type) {
|
|
75584
|
+
if (!(type instanceof basic_1.ObjectReferenceType)) {
|
|
75585
|
+
return undefined;
|
|
75586
|
+
}
|
|
75587
|
+
const identifier = type.getIdentifier();
|
|
75588
|
+
const found = identifier instanceof class_definition_1.ClassDefinition || identifier instanceof interface_definition_1.InterfaceDefinition
|
|
75589
|
+
? identifier : this.find(identifier.getName());
|
|
75590
|
+
return found instanceof class_definition_1.ClassDefinition || found instanceof interface_definition_1.InterfaceDefinition ? found : undefined;
|
|
75591
|
+
}
|
|
75592
|
+
/** sub is sup, or inherits from it or implements it; false if a definition on the way is not known */
|
|
75593
|
+
isSubtype(sub, sup) {
|
|
75594
|
+
const target = sup.toUpperCase();
|
|
75595
|
+
const visited = new Set();
|
|
75596
|
+
const stack = [sub.toUpperCase()];
|
|
75597
|
+
while (stack.length > 0) {
|
|
75598
|
+
const name = stack.pop();
|
|
75599
|
+
if (name === target) {
|
|
75600
|
+
return true;
|
|
75601
|
+
}
|
|
75602
|
+
else if (visited.has(name)) {
|
|
75603
|
+
continue;
|
|
75604
|
+
}
|
|
75605
|
+
visited.add(name);
|
|
75606
|
+
const definition = this.find(name);
|
|
75607
|
+
const superClass = definition === null || definition === void 0 ? void 0 : definition.getSuperClass();
|
|
75608
|
+
if (superClass !== undefined) {
|
|
75609
|
+
stack.push(superClass.toUpperCase());
|
|
75610
|
+
}
|
|
75611
|
+
for (const implementing of (definition === null || definition === void 0 ? void 0 : definition.getImplementing()) || []) {
|
|
75612
|
+
stack.push(implementing.name.toUpperCase());
|
|
75613
|
+
}
|
|
75614
|
+
}
|
|
75615
|
+
return false;
|
|
75616
|
+
}
|
|
75617
|
+
}
|
|
75618
|
+
exports.Hierarchy = Hierarchy;
|
|
74145
75619
|
////////////////////////////////////////
|
|
74146
75620
|
// edits
|
|
74147
75621
|
const rowCache = new WeakMap();
|
|
@@ -74897,6 +76371,104 @@ exports.AbapdocParameterNames = AbapdocParameterNames;
|
|
|
74897
76371
|
|
|
74898
76372
|
/***/ },
|
|
74899
76373
|
|
|
76374
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/abapdoc_shorttext_length.js"
|
|
76375
|
+
/*!*********************************************************************************!*\
|
|
76376
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/abapdoc_shorttext_length.js ***!
|
|
76377
|
+
\*********************************************************************************/
|
|
76378
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
76379
|
+
|
|
76380
|
+
"use strict";
|
|
76381
|
+
|
|
76382
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
76383
|
+
exports.AbapdocShorttextLength = exports.AbapdocShorttextLengthConf = void 0;
|
|
76384
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
76385
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
76386
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
76387
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
76388
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
|
|
76389
|
+
class AbapdocShorttextLengthConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
76390
|
+
}
|
|
76391
|
+
exports.AbapdocShorttextLengthConf = AbapdocShorttextLengthConf;
|
|
76392
|
+
const MAX_LENGTH = 60;
|
|
76393
|
+
class AbapdocShorttextLength extends _abap_rule_1.ABAPRule {
|
|
76394
|
+
constructor() {
|
|
76395
|
+
super(...arguments);
|
|
76396
|
+
this.conf = new AbapdocShorttextLengthConf();
|
|
76397
|
+
}
|
|
76398
|
+
getMetadata() {
|
|
76399
|
+
return {
|
|
76400
|
+
key: "abapdoc_shorttext_length",
|
|
76401
|
+
title: "ABAP Doc shorttext too long",
|
|
76402
|
+
shortDescription: `Reports ABAP Doc shorttexts longer than 60 characters.`,
|
|
76403
|
+
extendedInformation: `A shorttext is written as <p class="shorttext">...</p> or
|
|
76404
|
+
<p class="shorttext synchronized">...</p>, the system warns "Shorttext must not exceed 60 characters."
|
|
76405
|
+
if the text is longer.
|
|
76406
|
+
|
|
76407
|
+
The text may span several "! lines, line breaks count as one blank. Leading and trailing blanks are not counted,
|
|
76408
|
+
an entity like < counts as one character.`,
|
|
76409
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
76410
|
+
badExample: `INTERFACE zif_foo PUBLIC.
|
|
76411
|
+
"! <p class="shorttext synchronized">Returns the name of the selected row in the table of the view</p>
|
|
76412
|
+
METHODS name RETURNING VALUE(result) TYPE string.
|
|
76413
|
+
ENDINTERFACE.`,
|
|
76414
|
+
goodExample: `INTERFACE zif_foo PUBLIC.
|
|
76415
|
+
"! <p class="shorttext synchronized">Returns the name of the selected row</p>
|
|
76416
|
+
METHODS name RETURNING VALUE(result) TYPE string.
|
|
76417
|
+
ENDINTERFACE.`,
|
|
76418
|
+
};
|
|
76419
|
+
}
|
|
76420
|
+
getConfig() {
|
|
76421
|
+
return this.conf;
|
|
76422
|
+
}
|
|
76423
|
+
setConfig(conf) {
|
|
76424
|
+
this.conf = conf;
|
|
76425
|
+
}
|
|
76426
|
+
runParsed(file) {
|
|
76427
|
+
const issues = [];
|
|
76428
|
+
let block = [];
|
|
76429
|
+
for (const statement of file.getStatements()) {
|
|
76430
|
+
const token = statement.getFirstToken();
|
|
76431
|
+
const doc = statement.get() instanceof _statement_1.Comment && token.getStr().startsWith(`"!`);
|
|
76432
|
+
const previous = block[block.length - 1];
|
|
76433
|
+
if (doc === false || (previous !== undefined && token.getStart().getRow() !== previous.getStart().getRow() + 1)) {
|
|
76434
|
+
issues.push(...this.checkBlock(file, block));
|
|
76435
|
+
block = [];
|
|
76436
|
+
}
|
|
76437
|
+
if (doc === true) {
|
|
76438
|
+
block.push(token);
|
|
76439
|
+
}
|
|
76440
|
+
}
|
|
76441
|
+
issues.push(...this.checkBlock(file, block));
|
|
76442
|
+
return issues;
|
|
76443
|
+
}
|
|
76444
|
+
checkBlock(file, block) {
|
|
76445
|
+
const issues = [];
|
|
76446
|
+
if (block.length === 0) {
|
|
76447
|
+
return issues;
|
|
76448
|
+
}
|
|
76449
|
+
const text = block.map(t => t.getStr().substring(2)).join("\n");
|
|
76450
|
+
const regex = /<p\s[^>]*class\s*=\s*"shorttext(?:\s+synchronized)?"[^>]*>([\s\S]*?)<\/p>/gi;
|
|
76451
|
+
let match;
|
|
76452
|
+
while ((match = regex.exec(text)) !== null) {
|
|
76453
|
+
const length = this.decode(match[1].replace(/\s+/g, " ").trim()).length;
|
|
76454
|
+
if (length <= MAX_LENGTH) {
|
|
76455
|
+
continue;
|
|
76456
|
+
}
|
|
76457
|
+
const token = block[text.substring(0, match.index).split("\n").length - 1];
|
|
76458
|
+
const message = `Shorttext must not exceed ${MAX_LENGTH} characters, found ${length}`;
|
|
76459
|
+
issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
|
|
76460
|
+
}
|
|
76461
|
+
return issues;
|
|
76462
|
+
}
|
|
76463
|
+
decode(text) {
|
|
76464
|
+
return text.replace(/&(#\d+|#x[0-9a-fA-F]+|[a-zA-Z]+);/g, "_");
|
|
76465
|
+
}
|
|
76466
|
+
}
|
|
76467
|
+
exports.AbapdocShorttextLength = AbapdocShorttextLength;
|
|
76468
|
+
//# sourceMappingURL=abapdoc_shorttext_length.js.map
|
|
76469
|
+
|
|
76470
|
+
/***/ },
|
|
76471
|
+
|
|
74900
76472
|
/***/ "./node_modules/@abaplint/core/build/src/rules/add_test_attributes.js"
|
|
74901
76473
|
/*!****************************************************************************!*\
|
|
74902
76474
|
!*** ./node_modules/@abaplint/core/build/src/rules/add_test_attributes.js ***!
|
|
@@ -76350,8 +77922,28 @@ TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md
|
|
|
76350
77922
|
|
|
76351
77923
|
BREAK points`,
|
|
76352
77924
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
76353
|
-
badExample: `
|
|
76354
|
-
|
|
77925
|
+
badExample: `DEFINE _hello.
|
|
77926
|
+
WRITE 'hello'.
|
|
77927
|
+
END-OF-DEFINITION.
|
|
77928
|
+
|
|
77929
|
+
STATICS count TYPE i.
|
|
77930
|
+
|
|
77931
|
+
TYPES ty_items TYPE STANDARD TABLE OF i WITH DEFAULT KEY.
|
|
77932
|
+
|
|
77933
|
+
BREAK-POINT.
|
|
77934
|
+
|
|
77935
|
+
TEST-SEAM seam_name.
|
|
77936
|
+
count = 1.
|
|
77937
|
+
END-TEST-SEAM.
|
|
77938
|
+
|
|
77939
|
+
DESCRIBE TABLE items LINES count.
|
|
77940
|
+
|
|
77941
|
+
EXPORT data = items TO MEMORY ID 'ZFOO'.
|
|
77942
|
+
|
|
77943
|
+
EXPORT data = items TO DATABASE indx(zz) ID 'ZFOO'.`,
|
|
77944
|
+
goodExample: `count = lines( items ).
|
|
77945
|
+
|
|
77946
|
+
TYPES ty_items TYPE STANDARD TABLE OF i WITH EMPTY KEY.`,
|
|
76355
77947
|
};
|
|
76356
77948
|
}
|
|
76357
77949
|
getDescription(statement) {
|
|
@@ -76448,6 +78040,161 @@ exports.AvoidUse = AvoidUse;
|
|
|
76448
78040
|
|
|
76449
78041
|
/***/ },
|
|
76450
78042
|
|
|
78043
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/bdef_check_syntax.js"
|
|
78044
|
+
/*!**************************************************************************!*\
|
|
78045
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/bdef_check_syntax.js ***!
|
|
78046
|
+
\**************************************************************************/
|
|
78047
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
78048
|
+
|
|
78049
|
+
"use strict";
|
|
78050
|
+
|
|
78051
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78052
|
+
exports.BDEFCheckSyntax = exports.BDEFCheckSyntaxConf = void 0;
|
|
78053
|
+
const expressions_1 = __webpack_require__(/*! ../bdef/expressions */ "./node_modules/@abaplint/core/build/src/bdef/expressions/index.js");
|
|
78054
|
+
const ddic_1 = __webpack_require__(/*! ../ddic */ "./node_modules/@abaplint/core/build/src/ddic.js");
|
|
78055
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
78056
|
+
const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
78057
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
78058
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
78059
|
+
class BDEFCheckSyntaxConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
78060
|
+
}
|
|
78061
|
+
exports.BDEFCheckSyntaxConf = BDEFCheckSyntaxConf;
|
|
78062
|
+
class BDEFCheckSyntax {
|
|
78063
|
+
constructor() {
|
|
78064
|
+
this.conf = new BDEFCheckSyntaxConf();
|
|
78065
|
+
}
|
|
78066
|
+
getMetadata() {
|
|
78067
|
+
return {
|
|
78068
|
+
key: "bdef_check_syntax",
|
|
78069
|
+
title: "BDEF Check Syntax",
|
|
78070
|
+
shortDescription: "Checks behavior definition references to entities and implementation classes",
|
|
78071
|
+
extendedInformation: `Performs semantic checks which require other objects to be available.
|
|
78072
|
+
|
|
78073
|
+
Missing objects are only reported when their names match the configured errorNamespace.`,
|
|
78074
|
+
tags: [_irule_1.RuleTag.Syntax],
|
|
78075
|
+
};
|
|
78076
|
+
}
|
|
78077
|
+
getConfig() {
|
|
78078
|
+
return this.conf;
|
|
78079
|
+
}
|
|
78080
|
+
setConfig(conf) {
|
|
78081
|
+
this.conf = conf;
|
|
78082
|
+
}
|
|
78083
|
+
initialize(reg) {
|
|
78084
|
+
this.reg = reg;
|
|
78085
|
+
return this;
|
|
78086
|
+
}
|
|
78087
|
+
run(object) {
|
|
78088
|
+
if (!(object instanceof objects_1.BehaviorDefinition)) {
|
|
78089
|
+
return [];
|
|
78090
|
+
}
|
|
78091
|
+
const tree = object.getTree();
|
|
78092
|
+
const file = object.findSourceFile();
|
|
78093
|
+
if (tree === undefined || file === undefined) {
|
|
78094
|
+
return [];
|
|
78095
|
+
}
|
|
78096
|
+
const issues = [];
|
|
78097
|
+
this.checkImplementationClasses(tree, issues, file);
|
|
78098
|
+
this.checkEntities(tree, issues, file);
|
|
78099
|
+
return issues;
|
|
78100
|
+
}
|
|
78101
|
+
checkImplementationClasses(tree, issues, file) {
|
|
78102
|
+
for (const implementation of tree.findAllExpressions(expressions_1.BDEFImplementationIn)) {
|
|
78103
|
+
const nameNode = implementation.findDirectExpression(expressions_1.BDEFName);
|
|
78104
|
+
if (nameNode === undefined) {
|
|
78105
|
+
continue;
|
|
78106
|
+
}
|
|
78107
|
+
const name = this.name(nameNode);
|
|
78108
|
+
if (this.reg.getObject("CLAS", name) === undefined && this.reg.inErrorNamespace(name)) {
|
|
78109
|
+
issues.push(issue_1.Issue.atToken(file, nameNode.getFirstToken(), `Implementation class "${name}" not found`, this.getMetadata().key, this.conf.severity));
|
|
78110
|
+
}
|
|
78111
|
+
}
|
|
78112
|
+
}
|
|
78113
|
+
checkEntities(tree, issues, file) {
|
|
78114
|
+
const ddic = new ddic_1.DDIC(this.reg);
|
|
78115
|
+
for (const define of tree.findDirectExpressions(expressions_1.BDEFDefineBehavior)) {
|
|
78116
|
+
if (define.getFirstToken().getStr().toUpperCase() !== "DEFINE") {
|
|
78117
|
+
// "extend behavior for" refers to entities of the extended BDEF
|
|
78118
|
+
continue;
|
|
78119
|
+
}
|
|
78120
|
+
const nameNode = define.findDirectExpression(expressions_1.BDEFName);
|
|
78121
|
+
if (nameNode === undefined) {
|
|
78122
|
+
continue;
|
|
78123
|
+
}
|
|
78124
|
+
const name = this.name(nameNode);
|
|
78125
|
+
if (this.reg.inErrorNamespace(name)
|
|
78126
|
+
&& this.reg.getObject("DDLS", name) === undefined
|
|
78127
|
+
&& ddic.lookupDDLS(name) === undefined) {
|
|
78128
|
+
issues.push(issue_1.Issue.atToken(file, nameNode.getFirstToken(), `Entity "${name}" not found`, this.getMetadata().key, this.conf.severity));
|
|
78129
|
+
}
|
|
78130
|
+
}
|
|
78131
|
+
}
|
|
78132
|
+
name(node) {
|
|
78133
|
+
return node.concatTokens().replace(/ /g, "");
|
|
78134
|
+
}
|
|
78135
|
+
}
|
|
78136
|
+
exports.BDEFCheckSyntax = BDEFCheckSyntax;
|
|
78137
|
+
//# sourceMappingURL=bdef_check_syntax.js.map
|
|
78138
|
+
|
|
78139
|
+
/***/ },
|
|
78140
|
+
|
|
78141
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/bdef_parser_error.js"
|
|
78142
|
+
/*!**************************************************************************!*\
|
|
78143
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/bdef_parser_error.js ***!
|
|
78144
|
+
\**************************************************************************/
|
|
78145
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
78146
|
+
|
|
78147
|
+
"use strict";
|
|
78148
|
+
|
|
78149
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78150
|
+
exports.BDEFParserError = exports.BDEFParserErrorConf = void 0;
|
|
78151
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
78152
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
78153
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
78154
|
+
const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
78155
|
+
class BDEFParserErrorConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
78156
|
+
}
|
|
78157
|
+
exports.BDEFParserErrorConf = BDEFParserErrorConf;
|
|
78158
|
+
class BDEFParserError {
|
|
78159
|
+
constructor() {
|
|
78160
|
+
this.conf = new BDEFParserErrorConf();
|
|
78161
|
+
}
|
|
78162
|
+
getMetadata() {
|
|
78163
|
+
return {
|
|
78164
|
+
key: "bdef_parser_error",
|
|
78165
|
+
title: "BDEF Parser Error",
|
|
78166
|
+
shortDescription: `BDEF parsing`,
|
|
78167
|
+
extendedInformation: `Parses behavior definitions and issues parser errors`,
|
|
78168
|
+
tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],
|
|
78169
|
+
};
|
|
78170
|
+
}
|
|
78171
|
+
getConfig() {
|
|
78172
|
+
return this.conf;
|
|
78173
|
+
}
|
|
78174
|
+
setConfig(conf) {
|
|
78175
|
+
this.conf = conf;
|
|
78176
|
+
}
|
|
78177
|
+
initialize(_reg) {
|
|
78178
|
+
return this;
|
|
78179
|
+
}
|
|
78180
|
+
run(object) {
|
|
78181
|
+
const issues = [];
|
|
78182
|
+
if (object instanceof objects_1.BehaviorDefinition) {
|
|
78183
|
+
const file = object.findSourceFile();
|
|
78184
|
+
if (object.hasParserError() === true && file) {
|
|
78185
|
+
const empty = file.getRaw().length === 0 ? ", empty file" : "";
|
|
78186
|
+
const message = "BDEF Parser error" + empty;
|
|
78187
|
+
issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.getConfig().severity));
|
|
78188
|
+
}
|
|
78189
|
+
}
|
|
78190
|
+
return issues;
|
|
78191
|
+
}
|
|
78192
|
+
}
|
|
78193
|
+
exports.BDEFParserError = BDEFParserError;
|
|
78194
|
+
//# sourceMappingURL=bdef_parser_error.js.map
|
|
78195
|
+
|
|
78196
|
+
/***/ },
|
|
78197
|
+
|
|
76451
78198
|
/***/ "./node_modules/@abaplint/core/build/src/rules/begin_end_names.js"
|
|
76452
78199
|
/*!************************************************************************!*\
|
|
76453
78200
|
!*** ./node_modules/@abaplint/core/build/src/rules/begin_end_names.js ***!
|
|
@@ -76897,14 +78644,7 @@ ENDIF.`,
|
|
|
76897
78644
|
return false;
|
|
76898
78645
|
}
|
|
76899
78646
|
const constant = (0, _procedure_analysis_1.characterConstant)(procedure, move.source);
|
|
76900
|
-
return (constant !== undefined && (0, _procedure_analysis_1.sameCharacters)(constant, "")) ||
|
|
76901
|
-
}
|
|
76902
|
-
/** VALUE type( ) */
|
|
76903
|
-
initialValue(source) {
|
|
76904
|
-
const tokens = source.getTokens();
|
|
76905
|
-
return tokens.length === 4 && tokens[0].getStr().toUpperCase() === "VALUE"
|
|
76906
|
-
&& source.findDirectExpression(Expressions.TypeNameOrInfer) !== undefined
|
|
76907
|
-
&& tokens[1].getStr() !== "#" && tokens[2].getStr() === "(" && tokens[3].getStr() === ")";
|
|
78647
|
+
return (constant !== undefined && (0, _procedure_analysis_1.sameCharacters)(constant, "")) || (0, _procedure_analysis_1.initialValue)(move.source);
|
|
76908
78648
|
}
|
|
76909
78649
|
}
|
|
76910
78650
|
exports.BooleanFlagViaIf = BooleanFlagViaIf;
|
|
@@ -77289,6 +79029,205 @@ exports.CallTransactionAuthorityCheck = CallTransactionAuthorityCheck;
|
|
|
77289
79029
|
|
|
77290
79030
|
/***/ },
|
|
77291
79031
|
|
|
79032
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/cast_via_generic_reference.js"
|
|
79033
|
+
/*!***********************************************************************************!*\
|
|
79034
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/cast_via_generic_reference.js ***!
|
|
79035
|
+
\***********************************************************************************/
|
|
79036
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
79037
|
+
|
|
79038
|
+
"use strict";
|
|
79039
|
+
|
|
79040
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
79041
|
+
if (k2 === undefined) k2 = k;
|
|
79042
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
79043
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
79044
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
79045
|
+
}
|
|
79046
|
+
Object.defineProperty(o, k2, desc);
|
|
79047
|
+
}) : (function(o, m, k, k2) {
|
|
79048
|
+
if (k2 === undefined) k2 = k;
|
|
79049
|
+
o[k2] = m[k];
|
|
79050
|
+
}));
|
|
79051
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
79052
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
79053
|
+
}) : function(o, v) {
|
|
79054
|
+
o["default"] = v;
|
|
79055
|
+
});
|
|
79056
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
79057
|
+
var ownKeys = function(o) {
|
|
79058
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
79059
|
+
var ar = [];
|
|
79060
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
79061
|
+
return ar;
|
|
79062
|
+
};
|
|
79063
|
+
return ownKeys(o);
|
|
79064
|
+
};
|
|
79065
|
+
return function (mod) {
|
|
79066
|
+
if (mod && mod.__esModule) return mod;
|
|
79067
|
+
var result = {};
|
|
79068
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
79069
|
+
__setModuleDefault(result, mod);
|
|
79070
|
+
return result;
|
|
79071
|
+
};
|
|
79072
|
+
})();
|
|
79073
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
79074
|
+
exports.CastViaGenericReference = exports.CastViaGenericReferenceConf = void 0;
|
|
79075
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
79076
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
79077
|
+
const interface_definition_1 = __webpack_require__(/*! ../abap/types/interface_definition */ "./node_modules/@abaplint/core/build/src/abap/types/interface_definition.js");
|
|
79078
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
79079
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
79080
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
79081
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
79082
|
+
const _procedure_analysis_1 = __webpack_require__(/*! ./_procedure_analysis */ "./node_modules/@abaplint/core/build/src/rules/_procedure_analysis.js");
|
|
79083
|
+
class CastViaGenericReferenceConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
79084
|
+
}
|
|
79085
|
+
exports.CastViaGenericReferenceConf = CastViaGenericReferenceConf;
|
|
79086
|
+
class CastViaGenericReference {
|
|
79087
|
+
constructor() {
|
|
79088
|
+
this.conf = new CastViaGenericReferenceConf();
|
|
79089
|
+
}
|
|
79090
|
+
getMetadata() {
|
|
79091
|
+
return {
|
|
79092
|
+
key: "cast_via_generic_reference",
|
|
79093
|
+
title: "Cast via generic reference",
|
|
79094
|
+
shortDescription: `Finds a down cast from a local reference variable that only holds a copy of another reference`,
|
|
79095
|
+
extendedInformation: `Reports DATA o TYPE REF TO object. o = r. ... x ?= o. when all of the following hold:
|
|
79096
|
+
|
|
79097
|
+
* o is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE and not chained,
|
|
79098
|
+
typed REF TO object, or REF TO a class or interface that is the static type of r or a supertype of it
|
|
79099
|
+
* o has exactly one write, o = r., exactly one read, the complete source of x ?= o., and its address is never
|
|
79100
|
+
taken. x is not an inline declaration
|
|
79101
|
+
* r is a plain object reference: a variable, or a chain of attributes and components without calls,
|
|
79102
|
+
offsets, table expressions, field symbols or ->*
|
|
79103
|
+
* r keeps its value from o = r. until the read, as in unnecessary_copy: for a local r, no write to it and its
|
|
79104
|
+
address is never taken; for other r, in addition no method, function or form call and no write except to
|
|
79105
|
+
local variables, by value parameters and RETURNING in between
|
|
79106
|
+
* o = r. is executed before x ?= o. on every path: the read is in the same block or a nested block, and both
|
|
79107
|
+
are in the same loop
|
|
79108
|
+
* x ?= r. is valid: x or r is typed REF TO object or an interface, or the class of x and the class of r
|
|
79109
|
+
are in the same inheritance line
|
|
79110
|
+
|
|
79111
|
+
The object is the same, so the cast succeeds or raises cx_sy_move_cast_error the same way.
|
|
79112
|
+
try_cast_empty_catch can then replace a TRY around the cast.
|
|
79113
|
+
Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
|
|
79114
|
+
INCLUDE, test seams, enhancements or native SQL.
|
|
79115
|
+
|
|
79116
|
+
The quick fix deletes the declaration and o = r., and casts r directly. No release requirement.`,
|
|
79117
|
+
tags: [_irule_1.RuleTag.Quickfix],
|
|
79118
|
+
badExample: `DATA lo_object TYPE REF TO object.
|
|
79119
|
+
lo_object = io_node.
|
|
79120
|
+
TRY.
|
|
79121
|
+
lo_leaf ?= lo_object.
|
|
79122
|
+
CATCH cx_sy_move_cast_error.
|
|
79123
|
+
ENDTRY.`,
|
|
79124
|
+
goodExample: `TRY.
|
|
79125
|
+
lo_leaf ?= io_node.
|
|
79126
|
+
CATCH cx_sy_move_cast_error.
|
|
79127
|
+
ENDTRY.`,
|
|
79128
|
+
};
|
|
79129
|
+
}
|
|
79130
|
+
getConfig() {
|
|
79131
|
+
return this.conf;
|
|
79132
|
+
}
|
|
79133
|
+
setConfig(conf) {
|
|
79134
|
+
this.conf = conf;
|
|
79135
|
+
}
|
|
79136
|
+
initialize(reg) {
|
|
79137
|
+
this.reg = reg;
|
|
79138
|
+
return this;
|
|
79139
|
+
}
|
|
79140
|
+
run(obj) {
|
|
79141
|
+
var _a, _b;
|
|
79142
|
+
const analysis = _procedure_analysis_1.ObjectAnalysis.run(this.reg, obj);
|
|
79143
|
+
if (analysis === undefined) {
|
|
79144
|
+
return [];
|
|
79145
|
+
}
|
|
79146
|
+
const issues = [];
|
|
79147
|
+
for (const procedure of analysis.procedures) {
|
|
79148
|
+
if (procedure.supported === false) {
|
|
79149
|
+
continue;
|
|
79150
|
+
}
|
|
79151
|
+
const hierarchy = new _procedure_analysis_1.Hierarchy(this.reg, procedure);
|
|
79152
|
+
for (const variable of procedure.locals()) {
|
|
79153
|
+
const declaration = variable.declaration;
|
|
79154
|
+
const type = variable.identifier.getType();
|
|
79155
|
+
const writes = variable.writes();
|
|
79156
|
+
const reads = variable.reads();
|
|
79157
|
+
if (variable.inline || !(0, _procedure_analysis_1.plainData)(declaration) || declaration.getColon() !== undefined || variable.escapes()
|
|
79158
|
+
|| !this.isObjectReference(type) || writes.length !== 1 || reads.length !== 1) {
|
|
79159
|
+
continue;
|
|
79160
|
+
}
|
|
79161
|
+
const write = writes[0];
|
|
79162
|
+
const read = reads[0];
|
|
79163
|
+
const assign = (0, _procedure_analysis_1.plainMove)(write.statement);
|
|
79164
|
+
const cast = (0, _procedure_analysis_1.plainMove)(read.statement);
|
|
79165
|
+
if (assign === undefined || cast === undefined || assign.operator !== "=" || cast.operator !== "?="
|
|
79166
|
+
|| ((_a = (0, _procedure_analysis_1.singleTarget)(assign.target)) === null || _a === void 0 ? void 0 : _a.getStart().equals(write.token.getStart())) !== true
|
|
79167
|
+
|| ((_b = (0, _procedure_analysis_1.singleField)(cast.source)) === null || _b === void 0 ? void 0 : _b.getStart().equals(read.token.getStart())) !== true
|
|
79168
|
+
|| cast.target.findFirstExpression(Expressions.InlineData) !== undefined
|
|
79169
|
+
|| !procedure.dominates(write.statement, read.statement)
|
|
79170
|
+
|| !procedure.sameLoop(write.statement, read.statement)) {
|
|
79171
|
+
continue;
|
|
79172
|
+
}
|
|
79173
|
+
const source = (0, _procedure_analysis_1.dataSource)(procedure, assign.source);
|
|
79174
|
+
const target = (0, _procedure_analysis_1.targetType)(procedure, cast.target);
|
|
79175
|
+
if (source === undefined || source.base === variable || target === undefined
|
|
79176
|
+
|| !this.isObjectReference(source.type)
|
|
79177
|
+
|| !this.isSupertype(hierarchy, type, source.type)
|
|
79178
|
+
|| !this.castable(hierarchy, source.type, target)
|
|
79179
|
+
|| !(0, _procedure_analysis_1.unchangedBetween)(procedure, source, write.statement, read.statement, read.token)) {
|
|
79180
|
+
continue;
|
|
79181
|
+
}
|
|
79182
|
+
const fix = (0, _procedure_analysis_1.mergeEdits)(procedure.file, [
|
|
79183
|
+
(0, _procedure_analysis_1.deleteStatement)(procedure.file, declaration),
|
|
79184
|
+
(0, _procedure_analysis_1.deleteStatement)(procedure.file, write.statement),
|
|
79185
|
+
edit_helper_1.EditHelper.replaceToken(procedure.file, read.token, source.text)
|
|
79186
|
+
]);
|
|
79187
|
+
const message = "Cast " + source.text + " directly instead of via " + variable.identifier.getName();
|
|
79188
|
+
issues.push(issue_1.Issue.atStatement(procedure.file, read.statement, message, this.getMetadata().key, this.conf.severity, fix));
|
|
79189
|
+
}
|
|
79190
|
+
}
|
|
79191
|
+
return issues;
|
|
79192
|
+
}
|
|
79193
|
+
isObjectReference(type) {
|
|
79194
|
+
return type instanceof basic_1.GenericObjectReferenceType || type instanceof basic_1.ObjectReferenceType;
|
|
79195
|
+
}
|
|
79196
|
+
/** every reference of type sub can be assigned to type sup without a cast */
|
|
79197
|
+
isSupertype(hierarchy, sup, sub) {
|
|
79198
|
+
if (sup instanceof basic_1.GenericObjectReferenceType) {
|
|
79199
|
+
return true;
|
|
79200
|
+
}
|
|
79201
|
+
else if (!(sup instanceof basic_1.ObjectReferenceType) || !(sub instanceof basic_1.ObjectReferenceType)) {
|
|
79202
|
+
return false;
|
|
79203
|
+
}
|
|
79204
|
+
return hierarchy.isSubtype(sub.getIdentifierName(), sup.getIdentifierName());
|
|
79205
|
+
}
|
|
79206
|
+
/** target ?= source. is statically valid */
|
|
79207
|
+
castable(hierarchy, source, target) {
|
|
79208
|
+
if (source instanceof basic_1.GenericObjectReferenceType || target instanceof basic_1.GenericObjectReferenceType) {
|
|
79209
|
+
return true;
|
|
79210
|
+
}
|
|
79211
|
+
else if (!(source instanceof basic_1.ObjectReferenceType) || !(target instanceof basic_1.ObjectReferenceType)) {
|
|
79212
|
+
return false;
|
|
79213
|
+
}
|
|
79214
|
+
const sourceDefinition = hierarchy.definition(source);
|
|
79215
|
+
const targetDefinition = hierarchy.definition(target);
|
|
79216
|
+
if (sourceDefinition === undefined || targetDefinition === undefined) {
|
|
79217
|
+
return false;
|
|
79218
|
+
}
|
|
79219
|
+
else if (sourceDefinition instanceof interface_definition_1.InterfaceDefinition || targetDefinition instanceof interface_definition_1.InterfaceDefinition) {
|
|
79220
|
+
return true;
|
|
79221
|
+
}
|
|
79222
|
+
return hierarchy.isSubtype(source.getIdentifierName(), target.getIdentifierName())
|
|
79223
|
+
|| hierarchy.isSubtype(target.getIdentifierName(), source.getIdentifierName());
|
|
79224
|
+
}
|
|
79225
|
+
}
|
|
79226
|
+
exports.CastViaGenericReference = CastViaGenericReference;
|
|
79227
|
+
//# sourceMappingURL=cast_via_generic_reference.js.map
|
|
79228
|
+
|
|
79229
|
+
/***/ },
|
|
79230
|
+
|
|
77292
79231
|
/***/ "./node_modules/@abaplint/core/build/src/rules/catch_and_raise.js"
|
|
77293
79232
|
/*!************************************************************************!*\
|
|
77294
79233
|
!*** ./node_modules/@abaplint/core/build/src/rules/catch_and_raise.js ***!
|
|
@@ -80210,10 +82149,13 @@ class ClearAfterDeclaration {
|
|
|
80210
82149
|
shortDescription: `Finds CLEAR of a local variable that is still initial since its declaration`,
|
|
80211
82150
|
extendedInformation: `Reports CLEAR x. when all of the following hold:
|
|
80212
82151
|
|
|
80213
|
-
* x is a local variable of a METHOD, FORM or FUNCTION, declared with DATA x TYPE/LIKE ... without VALUE
|
|
82152
|
+
* x is a local variable of a METHOD, FORM or FUNCTION, declared with DATA x TYPE/LIKE ... without VALUE,
|
|
82153
|
+
or with DATA(x) = VALUE t( ). with an explicit type and nothing in the parentheses
|
|
80214
82154
|
* the CLEAR is the first reference to x after the declaration, it has no WITH addition
|
|
80215
|
-
* neither the
|
|
80216
|
-
RETRY, RESUME or CATCH BEFORE UNWIND. DATA is not executed per iteration, so a CLEAR in a loop can be needed
|
|
82155
|
+
* neither the declaration nor the CLEAR is inside a LOOP, DO, WHILE, SELECT loop, PROVIDE, or a TRY block with
|
|
82156
|
+
RETRY, RESUME or CATCH BEFORE UNWIND. DATA is not executed per iteration, so a CLEAR in a loop can be needed.
|
|
82157
|
+
DATA(x) = VALUE t( ). is executed per iteration, it may also be in the same loop as the CLEAR, if the CLEAR is
|
|
82158
|
+
in the block of the declaration or a nested block
|
|
80217
82159
|
|
|
80218
82160
|
Any later use of x does not matter, the CLEAR can only be reached with x still initial.
|
|
80219
82161
|
Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
|
|
@@ -80248,13 +82190,11 @@ CLEAR lv_count.`,
|
|
|
80248
82190
|
continue;
|
|
80249
82191
|
}
|
|
80250
82192
|
for (const variable of procedure.locals()) {
|
|
80251
|
-
const declaration = variable.declaration;
|
|
80252
82193
|
const first = variable.occurrences[0];
|
|
80253
|
-
if (
|
|
82194
|
+
if (first === undefined
|
|
80254
82195
|
|| first.kind !== _procedure_analysis_1.OccurrenceKind.Write
|
|
80255
82196
|
|| ((_a = (0, _procedure_analysis_1.plainClear)(first.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(first.token.getStart())) !== true
|
|
80256
|
-
|| procedure.
|
|
80257
|
-
|| procedure.loop(first.statement) !== undefined) {
|
|
82197
|
+
|| !(0, _procedure_analysis_1.initialAtFirstReference)(procedure, variable, first.statement)) {
|
|
80258
82198
|
continue;
|
|
80259
82199
|
}
|
|
80260
82200
|
const fix = (0, _procedure_analysis_1.deleteStatement)(procedure.file, first.statement);
|
|
@@ -80269,6 +82209,195 @@ exports.ClearAfterDeclaration = ClearAfterDeclaration;
|
|
|
80269
82209
|
|
|
80270
82210
|
/***/ },
|
|
80271
82211
|
|
|
82212
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/clear_before_overwrite.js"
|
|
82213
|
+
/*!*******************************************************************************!*\
|
|
82214
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/clear_before_overwrite.js ***!
|
|
82215
|
+
\*******************************************************************************/
|
|
82216
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
82217
|
+
|
|
82218
|
+
"use strict";
|
|
82219
|
+
|
|
82220
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
82221
|
+
if (k2 === undefined) k2 = k;
|
|
82222
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
82223
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
82224
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
82225
|
+
}
|
|
82226
|
+
Object.defineProperty(o, k2, desc);
|
|
82227
|
+
}) : (function(o, m, k, k2) {
|
|
82228
|
+
if (k2 === undefined) k2 = k;
|
|
82229
|
+
o[k2] = m[k];
|
|
82230
|
+
}));
|
|
82231
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
82232
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
82233
|
+
}) : function(o, v) {
|
|
82234
|
+
o["default"] = v;
|
|
82235
|
+
});
|
|
82236
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
82237
|
+
var ownKeys = function(o) {
|
|
82238
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
82239
|
+
var ar = [];
|
|
82240
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
82241
|
+
return ar;
|
|
82242
|
+
};
|
|
82243
|
+
return ownKeys(o);
|
|
82244
|
+
};
|
|
82245
|
+
return function (mod) {
|
|
82246
|
+
if (mod && mod.__esModule) return mod;
|
|
82247
|
+
var result = {};
|
|
82248
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
82249
|
+
__setModuleDefault(result, mod);
|
|
82250
|
+
return result;
|
|
82251
|
+
};
|
|
82252
|
+
})();
|
|
82253
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
82254
|
+
exports.ClearBeforeOverwrite = exports.ClearBeforeOverwriteConf = void 0;
|
|
82255
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
82256
|
+
const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js"));
|
|
82257
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
82258
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
|
|
82259
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
82260
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
82261
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
82262
|
+
const _procedure_analysis_1 = __webpack_require__(/*! ./_procedure_analysis */ "./node_modules/@abaplint/core/build/src/rules/_procedure_analysis.js");
|
|
82263
|
+
class ClearBeforeOverwriteConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
82264
|
+
}
|
|
82265
|
+
exports.ClearBeforeOverwriteConf = ClearBeforeOverwriteConf;
|
|
82266
|
+
class ClearBeforeOverwrite {
|
|
82267
|
+
constructor() {
|
|
82268
|
+
this.conf = new ClearBeforeOverwriteConf();
|
|
82269
|
+
}
|
|
82270
|
+
getMetadata() {
|
|
82271
|
+
return {
|
|
82272
|
+
key: "clear_before_overwrite",
|
|
82273
|
+
title: "CLEAR before overwrite",
|
|
82274
|
+
shortDescription: `Finds CLEAR of a local variable whose next use overwrites it completely`,
|
|
82275
|
+
extendedInformation: `Reports CLEAR v. when all of the following hold:
|
|
82276
|
+
|
|
82277
|
+
* v is a local variable of a METHOD, FORM or FUNCTION, its address is never taken: no field symbol,
|
|
82278
|
+
REF #( ), GET REFERENCE, and it is not passed to a parameter by reference
|
|
82279
|
+
* the CLEAR is not chained and has no WITH addition
|
|
82280
|
+
* the next reference to v is a full overwrite in the same block: v = <expression>., including v = NEW ...,
|
|
82281
|
+
or CREATE OBJECT v. with optional TYPE and EXPORTING, where nothing else in the statement references v.
|
|
82282
|
+
Not ?=, READ TABLE INTO, offset/length or component writes, CREATE OBJECT with EXCEPTIONS, or other
|
|
82283
|
+
statements that can leave v unchanged
|
|
82284
|
+
* every statement between the CLEAR and the overwrite is a direct statement of the block, not a nested structure,
|
|
82285
|
+
and does not reference v
|
|
82286
|
+
* v is not a table with header line
|
|
82287
|
+
* if a TRY or CATCH SYSTEM-EXCEPTIONS encloses the CLEAR, nothing from the CLEAR to the overwrite can raise
|
|
82288
|
+
an exception, a CATCH could see the old value: the overwrite directly follows the CLEAR and assigns a variable
|
|
82289
|
+
or a literal of identical type, or a reference variable
|
|
82290
|
+
|
|
82291
|
+
Unlike clear_after_declaration, the CLEAR can be in a loop.
|
|
82292
|
+
Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
|
|
82293
|
+
INCLUDE, test seams, enhancements or native SQL.
|
|
82294
|
+
|
|
82295
|
+
The quick fix deletes the CLEAR. No release requirement.`,
|
|
82296
|
+
tags: [_irule_1.RuleTag.Quickfix],
|
|
82297
|
+
badExample: `CLEAR lv_name.
|
|
82298
|
+
lv_name = iv_name.`,
|
|
82299
|
+
goodExample: `lv_name = iv_name.`,
|
|
82300
|
+
};
|
|
82301
|
+
}
|
|
82302
|
+
getConfig() {
|
|
82303
|
+
return this.conf;
|
|
82304
|
+
}
|
|
82305
|
+
setConfig(conf) {
|
|
82306
|
+
this.conf = conf;
|
|
82307
|
+
}
|
|
82308
|
+
initialize(reg) {
|
|
82309
|
+
this.reg = reg;
|
|
82310
|
+
return this;
|
|
82311
|
+
}
|
|
82312
|
+
run(obj) {
|
|
82313
|
+
var _a;
|
|
82314
|
+
const analysis = _procedure_analysis_1.ObjectAnalysis.run(this.reg, obj);
|
|
82315
|
+
if (analysis === undefined) {
|
|
82316
|
+
return [];
|
|
82317
|
+
}
|
|
82318
|
+
const issues = [];
|
|
82319
|
+
for (const procedure of analysis.procedures) {
|
|
82320
|
+
if (procedure.supported === false) {
|
|
82321
|
+
continue;
|
|
82322
|
+
}
|
|
82323
|
+
for (const variable of procedure.locals()) {
|
|
82324
|
+
const type = variable.identifier.getType();
|
|
82325
|
+
if (variable.escapes() || (type instanceof basic_1.TableType && type.isWithHeader())
|
|
82326
|
+
|| this.passedByReference(procedure, variable)) {
|
|
82327
|
+
continue;
|
|
82328
|
+
}
|
|
82329
|
+
const occurrences = variable.occurrences;
|
|
82330
|
+
for (let i = 0; i < occurrences.length - 1; i++) {
|
|
82331
|
+
const clear = occurrences[i];
|
|
82332
|
+
const next = occurrences[i + 1];
|
|
82333
|
+
if (((_a = (0, _procedure_analysis_1.plainClear)(clear.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(clear.token.getStart())) !== true
|
|
82334
|
+
|| clear.statement.getColon() !== undefined
|
|
82335
|
+
|| occurrences.some(o => o !== next && o.statement === next.statement)
|
|
82336
|
+
|| !this.overwrites(next)) {
|
|
82337
|
+
continue;
|
|
82338
|
+
}
|
|
82339
|
+
const between = procedure.straightBetween(clear.statement, next.statement);
|
|
82340
|
+
if (between === undefined
|
|
82341
|
+
|| (procedure.enclosedBy(clear.statement, [Structures.Try, Structures.CatchSystemExceptions])
|
|
82342
|
+
&& (between.length > 0 || !this.cannotRaise(procedure, variable, next.statement)))) {
|
|
82343
|
+
continue;
|
|
82344
|
+
}
|
|
82345
|
+
const message = "CLEAR of " + variable.identifier.getName() + ", which is overwritten before it is read";
|
|
82346
|
+
issues.push(issue_1.Issue.atStatement(procedure.file, clear.statement, message, this.getMetadata().key, this.conf.severity, (0, _procedure_analysis_1.deleteStatement)(procedure.file, clear.statement)));
|
|
82347
|
+
}
|
|
82348
|
+
}
|
|
82349
|
+
}
|
|
82350
|
+
return issues;
|
|
82351
|
+
}
|
|
82352
|
+
/** passed to a method, NEW, CREATE OBJECT or RAISE EXCEPTION, other than to a pass-by-value parameter;
|
|
82353
|
+
* the called code could keep a reference to the parameter */
|
|
82354
|
+
passedByReference(procedure, variable) {
|
|
82355
|
+
var _a;
|
|
82356
|
+
for (const read of variable.reads()) {
|
|
82357
|
+
const path = (0, _procedure_analysis_1.expressionPath)(read.statement, read.token);
|
|
82358
|
+
if (!path.some(e => e.get() instanceof Expressions.MethodCallParam || e.get() instanceof Expressions.ParameterListS
|
|
82359
|
+
|| e.get() instanceof Expressions.MethodParameters)) {
|
|
82360
|
+
continue;
|
|
82361
|
+
}
|
|
82362
|
+
const formal = (0, _procedure_analysis_1.formalParameter)(procedure, read.statement, read.token);
|
|
82363
|
+
if (((_a = formal === null || formal === void 0 ? void 0 : formal.parameter) === null || _a === void 0 ? void 0 : _a.getMeta().includes("pass_by_value" /* IdentifierMeta.PassByValue */)) !== true) {
|
|
82364
|
+
return true;
|
|
82365
|
+
}
|
|
82366
|
+
}
|
|
82367
|
+
return false;
|
|
82368
|
+
}
|
|
82369
|
+
/** v = <expression>. or CREATE OBJECT v [TYPE c] [EXPORTING ...]. */
|
|
82370
|
+
overwrites(occurrence) {
|
|
82371
|
+
var _a, _b;
|
|
82372
|
+
const statement = occurrence.statement;
|
|
82373
|
+
const move = (0, _procedure_analysis_1.plainMove)(statement);
|
|
82374
|
+
if (move !== undefined) {
|
|
82375
|
+
return move.operator === "=" && ((_a = (0, _procedure_analysis_1.singleTarget)(move.target)) === null || _a === void 0 ? void 0 : _a.getStart().equals(occurrence.token.getStart())) === true;
|
|
82376
|
+
}
|
|
82377
|
+
const create = (0, _procedure_analysis_1.plainCreateObject)(statement);
|
|
82378
|
+
return create !== undefined && ((_b = (0, _procedure_analysis_1.singleTarget)(create.target)) === null || _b === void 0 ? void 0 : _b.getStart().equals(occurrence.token.getStart())) === true;
|
|
82379
|
+
}
|
|
82380
|
+
/** v = w. or v = literal. without conversion */
|
|
82381
|
+
cannotRaise(procedure, variable, statement) {
|
|
82382
|
+
const move = (0, _procedure_analysis_1.plainMove)(statement);
|
|
82383
|
+
if (move === undefined) {
|
|
82384
|
+
return false;
|
|
82385
|
+
}
|
|
82386
|
+
const type = variable.identifier.getType();
|
|
82387
|
+
const field = (0, _procedure_analysis_1.singleField)(move.source);
|
|
82388
|
+
const constant = move.source.getChildren().length === 1 ? move.source.findDirectExpression(Expressions.Constant) : undefined;
|
|
82389
|
+
const identifier = field === undefined ? undefined : procedure.identifierAt(field);
|
|
82390
|
+
const source = identifier instanceof _typed_identifier_1.TypedIdentifier ? identifier.getType()
|
|
82391
|
+
: constant === undefined ? undefined : (0, _procedure_analysis_1.literalType)(constant);
|
|
82392
|
+
return source !== undefined
|
|
82393
|
+
&& ((0, _procedure_analysis_1.identicalTypes)(source, type) || ((0, _procedure_analysis_1.isReferenceType)(source) && (0, _procedure_analysis_1.isReferenceType)(type) && field !== undefined));
|
|
82394
|
+
}
|
|
82395
|
+
}
|
|
82396
|
+
exports.ClearBeforeOverwrite = ClearBeforeOverwrite;
|
|
82397
|
+
//# sourceMappingURL=clear_before_overwrite.js.map
|
|
82398
|
+
|
|
82399
|
+
/***/ },
|
|
82400
|
+
|
|
80272
82401
|
/***/ "./node_modules/@abaplint/core/build/src/rules/clear_exporting_parameters.js"
|
|
80273
82402
|
/*!***********************************************************************************!*\
|
|
80274
82403
|
!*** ./node_modules/@abaplint/core/build/src/rules/clear_exporting_parameters.js ***!
|
|
@@ -81108,8 +83237,9 @@ c = <constant>, c <> <constant>, EQ, NE, c IS INITIAL, c IS NOT INITIAL, optiona
|
|
|
81108
83237
|
The declaration must be executed before the condition on every path: the IF is in the block of the
|
|
81109
83238
|
declaration or a nested block. The quick fix deletes the declaration.
|
|
81110
83239
|
|
|
81111
|
-
2. DATA v TYPE ... without VALUE,
|
|
81112
|
-
|
|
83240
|
+
2. DATA v TYPE ... without VALUE, or DATA(v) = VALUE t( ). with an explicit type and nothing in the parentheses,
|
|
83241
|
+
where v is never changed, except by CLEAR v., and its address is never taken, in a condition v IS [NOT] INITIAL
|
|
83242
|
+
or v IS [NOT] BOUND. The declaration is kept.
|
|
81113
83243
|
|
|
81114
83244
|
The quick fix removes the IF branch that is never taken, or keeps the branch that is always taken and
|
|
81115
83245
|
removes the rest, also in ELSEIF chains: a first IF branch that is never taken turns the next ELSEIF into IF,
|
|
@@ -81150,12 +83280,12 @@ ENDIF.`,
|
|
|
81150
83280
|
}
|
|
81151
83281
|
const candidates = [];
|
|
81152
83282
|
for (const variable of procedure.locals()) {
|
|
81153
|
-
if (
|
|
81154
|
-
this.constantVariable(procedure, variable, candidates);
|
|
81155
|
-
}
|
|
81156
|
-
else {
|
|
83283
|
+
if ((0, _procedure_analysis_1.initialDeclaration)(variable) !== undefined) {
|
|
81157
83284
|
this.initialVariable(procedure, variable, candidates);
|
|
81158
83285
|
}
|
|
83286
|
+
else if (variable.inline) {
|
|
83287
|
+
this.constantVariable(procedure, variable, candidates);
|
|
83288
|
+
}
|
|
81159
83289
|
}
|
|
81160
83290
|
issues.push(...(0, _procedure_analysis_1.foldIssues)(procedure.file, candidates, this.getMetadata().key, this.conf.severity));
|
|
81161
83291
|
}
|
|
@@ -81191,9 +83321,9 @@ ENDIF.`,
|
|
|
81191
83321
|
fix: (0, _procedure_analysis_1.mergeEdits)(procedure.file, [fold, (0, _procedure_analysis_1.deleteStatement)(procedure.file, declaration)]),
|
|
81192
83322
|
});
|
|
81193
83323
|
}
|
|
81194
|
-
/** DATA v TYPE ... never changed: IF v IS INITIAL / IS BOUND */
|
|
83324
|
+
/** DATA v TYPE ... or DATA(v) = VALUE t( ). never changed: IF v IS INITIAL / IS BOUND */
|
|
81195
83325
|
initialVariable(procedure, variable, candidates) {
|
|
81196
|
-
if (
|
|
83326
|
+
if (variable.escapes()
|
|
81197
83327
|
|| variable.writes().some(w => { var _a; return ((_a = (0, _procedure_analysis_1.plainClear)(w.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(w.token.getStart())) !== true; })) {
|
|
81198
83328
|
return;
|
|
81199
83329
|
}
|
|
@@ -81456,6 +83586,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
81456
83586
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
81457
83587
|
exports.CopyChain = exports.CopyChainConf = void 0;
|
|
81458
83588
|
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
83589
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
|
|
83590
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
81459
83591
|
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
81460
83592
|
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
81461
83593
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
@@ -81473,28 +83605,49 @@ class CopyChain {
|
|
|
81473
83605
|
key: "copy_chain",
|
|
81474
83606
|
title: "Copy chain",
|
|
81475
83607
|
shortDescription: `Finds a local variable that only passes a value on from one variable to another`,
|
|
81476
|
-
extendedInformation: `Reports
|
|
83608
|
+
extendedInformation: `Reports a local variable that only passes a value on, in two cases.
|
|
83609
|
+
|
|
83610
|
+
1. DATA v TYPE ... [CLEAR v.] v = src. ... y = v. when all of the following hold:
|
|
81477
83611
|
|
|
81478
|
-
* v is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE
|
|
83612
|
+
* v is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE, or with
|
|
83613
|
+
DATA(v) = VALUE t( ). with an explicit type and nothing in the parentheses
|
|
81479
83614
|
* v has exactly one write besides CLEAR: v = src., and all CLEARs are before it
|
|
81480
83615
|
* v has exactly one read, the complete source of y = v.
|
|
81481
|
-
* src is a local variable,
|
|
83616
|
+
* src is a local variable, or a pass-by-value or RETURNING parameter of a method or form, its address is never
|
|
83617
|
+
taken, and it is not written from v = src. until y = v.
|
|
81482
83618
|
* v = src. is executed before y = v. on every path: y = v. is in the same block or a nested block,
|
|
81483
83619
|
and both are in the same loop
|
|
81484
83620
|
* v and src are both reference types, or have identical types; for other types the copy into v can convert,
|
|
81485
83621
|
e.g. truncate a string into a c field. For DATA(y) = v. the types must be identical, else y changes its type
|
|
81486
83622
|
* the declaration, the CLEARs and v = src. are not chained
|
|
81487
83623
|
|
|
81488
|
-
Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
|
|
81489
|
-
INCLUDE, test seams, enhancements or native SQL.
|
|
81490
|
-
|
|
81491
83624
|
The quick fix deletes the declaration, the CLEARs and v = src., and changes the read to y = src.
|
|
81492
|
-
|
|
83625
|
+
|
|
83626
|
+
2. DATA a TYPE REF TO c. CREATE OBJECT a. b = a. when all of the following hold:
|
|
83627
|
+
|
|
83628
|
+
* a is a local variable, declared with DATA without VALUE and not chained, its address is never taken
|
|
83629
|
+
* the only other references to a are CREATE OBJECT a. and the complete source of b = a., which is the next
|
|
83630
|
+
statement in the same block, apart from declarations like DATA in between
|
|
83631
|
+
* CREATE OBJECT has at most TYPE and EXPORTING, it is not chained. With EXCEPTIONS, a classic exception in the
|
|
83632
|
+
constructor would leave b unchanged instead of initial
|
|
83633
|
+
* b is a local variable, or a pass-by-value or RETURNING parameter, whose address is never taken, it is
|
|
83634
|
+
declared before the CREATE OBJECT and not used in its parameters, so the constructor cannot see b
|
|
83635
|
+
* b = a. passes the syntax check, so the static type of b accepts the class of a
|
|
83636
|
+
|
|
83637
|
+
The quick fix deletes the declaration of a and b = a., and creates the object in b, keeping TYPE and EXPORTING.
|
|
83638
|
+
If the static types of a and b differ, it adds TYPE with the class of a.
|
|
83639
|
+
|
|
83640
|
+
Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
|
|
83641
|
+
INCLUDE, test seams, enhancements or native SQL. No release requirement.`,
|
|
81493
83642
|
tags: [_irule_1.RuleTag.Quickfix],
|
|
81494
83643
|
badExample: `DATA lo_copy TYPE REF TO zcl_node.
|
|
81495
83644
|
lo_copy = lo_node.
|
|
81496
|
-
ro_result = lo_copy
|
|
81497
|
-
|
|
83645
|
+
ro_result = lo_copy.
|
|
83646
|
+
DATA lo_new TYPE REF TO zcl_node.
|
|
83647
|
+
CREATE OBJECT lo_new.
|
|
83648
|
+
ro_other = lo_new.`,
|
|
83649
|
+
goodExample: `ro_result = lo_node.
|
|
83650
|
+
CREATE OBJECT ro_other.`,
|
|
81498
83651
|
};
|
|
81499
83652
|
}
|
|
81500
83653
|
getConfig() {
|
|
@@ -81520,7 +83673,7 @@ ro_result = lo_copy.`,
|
|
|
81520
83673
|
}
|
|
81521
83674
|
for (const variable of procedure.locals()) {
|
|
81522
83675
|
const declaration = variable.declaration;
|
|
81523
|
-
if (
|
|
83676
|
+
if ((0, _procedure_analysis_1.initialDeclaration)(variable) === undefined || declaration.getColon() !== undefined
|
|
81524
83677
|
|| variable.escapes()) {
|
|
81525
83678
|
continue;
|
|
81526
83679
|
}
|
|
@@ -81541,6 +83694,13 @@ ro_result = lo_copy.`,
|
|
|
81541
83694
|
}
|
|
81542
83695
|
const write = writes[0];
|
|
81543
83696
|
const read = reads[0];
|
|
83697
|
+
if (write.statement.get() instanceof Statements.CreateObject) {
|
|
83698
|
+
const issue = clears.length === 0 ? this.createObject(procedure, variable, write, read) : undefined;
|
|
83699
|
+
if (issue !== undefined) {
|
|
83700
|
+
issues.push(issue);
|
|
83701
|
+
}
|
|
83702
|
+
continue;
|
|
83703
|
+
}
|
|
81544
83704
|
const assign = (0, _procedure_analysis_1.plainMove)(write.statement);
|
|
81545
83705
|
const use = (0, _procedure_analysis_1.plainMove)(read.statement);
|
|
81546
83706
|
if (assign === undefined || use === undefined || assign.operator !== "=" || use.operator !== "="
|
|
@@ -81578,6 +83738,46 @@ ro_result = lo_copy.`,
|
|
|
81578
83738
|
}
|
|
81579
83739
|
return issues;
|
|
81580
83740
|
}
|
|
83741
|
+
/** DATA a TYPE REF TO c. CREATE OBJECT a. b = a. */
|
|
83742
|
+
createObject(procedure, variable, write, read) {
|
|
83743
|
+
var _a, _b, _c;
|
|
83744
|
+
const create = (0, _procedure_analysis_1.plainCreateObject)(write.statement);
|
|
83745
|
+
const use = (0, _procedure_analysis_1.plainMove)(read.statement);
|
|
83746
|
+
const token = use === undefined ? undefined : (0, _procedure_analysis_1.singleTarget)(use.target);
|
|
83747
|
+
const target = token === undefined ? undefined : procedure.private(procedure.identifierAt(token));
|
|
83748
|
+
if (create === undefined || use === undefined || use.operator !== "=" || target === undefined
|
|
83749
|
+
|| ((_a = (0, _procedure_analysis_1.singleTarget)(create.target)) === null || _a === void 0 ? void 0 : _a.getStart().equals(write.token.getStart())) !== true
|
|
83750
|
+
|| ((_b = (0, _procedure_analysis_1.singleField)(use.source)) === null || _b === void 0 ? void 0 : _b.getStart().equals(read.token.getStart())) !== true
|
|
83751
|
+
|| read.statement !== procedure.nextExecuted(write.statement) || !procedure.isSimple(read.statement)
|
|
83752
|
+
|| target.occurrences.some(o => o.statement === write.statement)
|
|
83753
|
+
|| (target.declaration !== undefined && procedure.index(target.declaration) > write.index)) {
|
|
83754
|
+
return undefined;
|
|
83755
|
+
}
|
|
83756
|
+
const type = variable.identifier.getType();
|
|
83757
|
+
const targetType = target.identifier.getType();
|
|
83758
|
+
let text = (0, _procedure_analysis_1.nodeText)(procedure.file, use.target);
|
|
83759
|
+
if (!(type instanceof basic_1.ObjectReferenceType)
|
|
83760
|
+
|| !(targetType instanceof basic_1.ObjectReferenceType || targetType instanceof basic_1.GenericObjectReferenceType)) {
|
|
83761
|
+
return undefined;
|
|
83762
|
+
}
|
|
83763
|
+
else if (create.type === undefined && !(0, _procedure_analysis_1.identicalTypes)(type, targetType)) {
|
|
83764
|
+
// the class of a, as written in its declaration
|
|
83765
|
+
const declared = (_c = variable.declaration.findDirectExpression(Expressions.DataDefinition)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(Expressions.Type);
|
|
83766
|
+
const name = declared === null || declared === void 0 ? void 0 : declared.findDirectExpression(Expressions.TypeName);
|
|
83767
|
+
if (name === undefined || (declared === null || declared === void 0 ? void 0 : declared.getTokens().length) !== 4) {
|
|
83768
|
+
return undefined;
|
|
83769
|
+
}
|
|
83770
|
+
text = text + " TYPE " + (0, _procedure_analysis_1.nodeText)(procedure.file, name);
|
|
83771
|
+
}
|
|
83772
|
+
const fix = (0, _procedure_analysis_1.mergeEdits)(procedure.file, [
|
|
83773
|
+
(0, _procedure_analysis_1.deleteStatement)(procedure.file, variable.declaration),
|
|
83774
|
+
edit_helper_1.EditHelper.replaceToken(procedure.file, write.token, text),
|
|
83775
|
+
(0, _procedure_analysis_1.deleteStatement)(procedure.file, read.statement)
|
|
83776
|
+
]);
|
|
83777
|
+
const message = "Copy chain via " + variable.identifier.getName() + ", create the object in "
|
|
83778
|
+
+ (0, _procedure_analysis_1.nodeText)(procedure.file, use.target) + " directly";
|
|
83779
|
+
return issue_1.Issue.atStatement(procedure.file, read.statement, message, this.getMetadata().key, this.conf.severity, fix);
|
|
83780
|
+
}
|
|
81581
83781
|
}
|
|
81582
83782
|
exports.CopyChain = CopyChain;
|
|
81583
83783
|
//# sourceMappingURL=copy_chain.js.map
|
|
@@ -81647,7 +83847,9 @@ class CopyOfInitialVariable {
|
|
|
81647
83847
|
shortDescription: `Finds assignments from a local variable that is always initial`,
|
|
81648
83848
|
extendedInformation: `Reports DATA v TYPE ... [CLEAR v.] x = v. when all of the following hold:
|
|
81649
83849
|
|
|
81650
|
-
* v is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE
|
|
83850
|
+
* v is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE, or with
|
|
83851
|
+
DATA(v) = VALUE t( ). with an explicit type and nothing in the parentheses. Both make v initial, the latter
|
|
83852
|
+
every time it is executed, so v is initial wherever it is read, also in loops
|
|
81651
83853
|
* v is never changed, except by CLEAR v., and its address is never taken
|
|
81652
83854
|
* v has exactly one read, the complete source of x = v., where x is not an inline declaration
|
|
81653
83855
|
* x and v are both reference types, or have identical types. Initial values convert differently between
|
|
@@ -81690,7 +83892,7 @@ ro_result = lo_empty.`,
|
|
|
81690
83892
|
const declaration = variable.declaration;
|
|
81691
83893
|
const reads = variable.reads();
|
|
81692
83894
|
const writes = variable.writes();
|
|
81693
|
-
if (
|
|
83895
|
+
if ((0, _procedure_analysis_1.initialDeclaration)(variable) === undefined || declaration.getColon() !== undefined
|
|
81694
83896
|
|| variable.escapes() || reads.length !== 1
|
|
81695
83897
|
|| writes.some(w => { var _a; return ((_a = (0, _procedure_analysis_1.plainClear)(w.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(w.token.getStart())) !== true
|
|
81696
83898
|
|| w.statement.getColon() !== undefined; })) {
|
|
@@ -90694,6 +92896,7 @@ __exportStar(__webpack_require__(/*! ./abapdoc */ "./node_modules/@abaplint/core
|
|
|
90694
92896
|
__exportStar(__webpack_require__(/*! ./abapdoc_html_tag */ "./node_modules/@abaplint/core/build/src/rules/abapdoc_html_tag.js"), exports);
|
|
90695
92897
|
__exportStar(__webpack_require__(/*! ./abapdoc_leading_at */ "./node_modules/@abaplint/core/build/src/rules/abapdoc_leading_at.js"), exports);
|
|
90696
92898
|
__exportStar(__webpack_require__(/*! ./abapdoc_parameter_names */ "./node_modules/@abaplint/core/build/src/rules/abapdoc_parameter_names.js"), exports);
|
|
92899
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_shorttext_length */ "./node_modules/@abaplint/core/build/src/rules/abapdoc_shorttext_length.js"), exports);
|
|
90697
92900
|
__exportStar(__webpack_require__(/*! ./add_test_attributes */ "./node_modules/@abaplint/core/build/src/rules/add_test_attributes.js"), exports);
|
|
90698
92901
|
__exportStar(__webpack_require__(/*! ./aff_and_xml */ "./node_modules/@abaplint/core/build/src/rules/aff_and_xml.js"), exports);
|
|
90699
92902
|
__exportStar(__webpack_require__(/*! ./alias_never_reassigned */ "./node_modules/@abaplint/core/build/src/rules/alias_never_reassigned.js"), exports);
|
|
@@ -90704,11 +92907,14 @@ __exportStar(__webpack_require__(/*! ./allowed_object_naming */ "./node_modules/
|
|
|
90704
92907
|
__exportStar(__webpack_require__(/*! ./allowed_object_types */ "./node_modules/@abaplint/core/build/src/rules/allowed_object_types.js"), exports);
|
|
90705
92908
|
__exportStar(__webpack_require__(/*! ./ambiguous_statement */ "./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js"), exports);
|
|
90706
92909
|
__exportStar(__webpack_require__(/*! ./avoid_use */ "./node_modules/@abaplint/core/build/src/rules/avoid_use.js"), exports);
|
|
92910
|
+
__exportStar(__webpack_require__(/*! ./bdef_check_syntax */ "./node_modules/@abaplint/core/build/src/rules/bdef_check_syntax.js"), exports);
|
|
92911
|
+
__exportStar(__webpack_require__(/*! ./bdef_parser_error */ "./node_modules/@abaplint/core/build/src/rules/bdef_parser_error.js"), exports);
|
|
90707
92912
|
__exportStar(__webpack_require__(/*! ./begin_end_names */ "./node_modules/@abaplint/core/build/src/rules/begin_end_names.js"), exports);
|
|
90708
92913
|
__exportStar(__webpack_require__(/*! ./begin_single_include */ "./node_modules/@abaplint/core/build/src/rules/begin_single_include.js"), exports);
|
|
90709
92914
|
__exportStar(__webpack_require__(/*! ./boolean_flag_via_if */ "./node_modules/@abaplint/core/build/src/rules/boolean_flag_via_if.js"), exports);
|
|
90710
92915
|
__exportStar(__webpack_require__(/*! ./bound_check_after_create */ "./node_modules/@abaplint/core/build/src/rules/bound_check_after_create.js"), exports);
|
|
90711
92916
|
__exportStar(__webpack_require__(/*! ./call_transaction_authority_check */ "./node_modules/@abaplint/core/build/src/rules/call_transaction_authority_check.js"), exports);
|
|
92917
|
+
__exportStar(__webpack_require__(/*! ./cast_via_generic_reference */ "./node_modules/@abaplint/core/build/src/rules/cast_via_generic_reference.js"), exports);
|
|
90712
92918
|
__exportStar(__webpack_require__(/*! ./catch_and_raise */ "./node_modules/@abaplint/core/build/src/rules/catch_and_raise.js"), exports);
|
|
90713
92919
|
__exportStar(__webpack_require__(/*! ./cds_association_name */ "./node_modules/@abaplint/core/build/src/rules/cds_association_name.js"), exports);
|
|
90714
92920
|
__exportStar(__webpack_require__(/*! ./cds_check_syntax */ "./node_modules/@abaplint/core/build/src/rules/cds_check_syntax.js"), exports);
|
|
@@ -90729,6 +92935,7 @@ __exportStar(__webpack_require__(/*! ./check_syntax */ "./node_modules/@abaplint
|
|
|
90729
92935
|
__exportStar(__webpack_require__(/*! ./check_text_elements */ "./node_modules/@abaplint/core/build/src/rules/check_text_elements.js"), exports);
|
|
90730
92936
|
__exportStar(__webpack_require__(/*! ./check_transformation_exists */ "./node_modules/@abaplint/core/build/src/rules/check_transformation_exists.js"), exports);
|
|
90731
92937
|
__exportStar(__webpack_require__(/*! ./clear_after_declaration */ "./node_modules/@abaplint/core/build/src/rules/clear_after_declaration.js"), exports);
|
|
92938
|
+
__exportStar(__webpack_require__(/*! ./clear_before_overwrite */ "./node_modules/@abaplint/core/build/src/rules/clear_before_overwrite.js"), exports);
|
|
90732
92939
|
__exportStar(__webpack_require__(/*! ./clear_exporting_parameters */ "./node_modules/@abaplint/core/build/src/rules/clear_exporting_parameters.js"), exports);
|
|
90733
92940
|
__exportStar(__webpack_require__(/*! ./class_attribute_names */ "./node_modules/@abaplint/core/build/src/rules/class_attribute_names.js"), exports);
|
|
90734
92941
|
__exportStar(__webpack_require__(/*! ./classic_exceptions_overlap */ "./node_modules/@abaplint/core/build/src/rules/classic_exceptions_overlap.js"), exports);
|
|
@@ -90844,6 +93051,7 @@ __exportStar(__webpack_require__(/*! ./prefer_pragmas */ "./node_modules/@abapli
|
|
|
90844
93051
|
__exportStar(__webpack_require__(/*! ./prefer_abap_bool */ "./node_modules/@abaplint/core/build/src/rules/prefer_abap_bool.js"), exports);
|
|
90845
93052
|
__exportStar(__webpack_require__(/*! ./prefer_abap_bool_values */ "./node_modules/@abaplint/core/build/src/rules/prefer_abap_bool_values.js"), exports);
|
|
90846
93053
|
__exportStar(__webpack_require__(/*! ./prefer_raise_exception_new */ "./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js"), exports);
|
|
93054
|
+
__exportStar(__webpack_require__(/*! ./prefer_raise_message */ "./node_modules/@abaplint/core/build/src/rules/prefer_raise_message.js"), exports);
|
|
90847
93055
|
__exportStar(__webpack_require__(/*! ./prefer_string_template */ "./node_modules/@abaplint/core/build/src/rules/prefer_string_template.js"), exports);
|
|
90848
93056
|
__exportStar(__webpack_require__(/*! ./prefer_returning_to_exporting */ "./node_modules/@abaplint/core/build/src/rules/prefer_returning_to_exporting.js"), exports);
|
|
90849
93057
|
__exportStar(__webpack_require__(/*! ./prefer_xsdbool */ "./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js"), exports);
|
|
@@ -100208,36 +102416,153 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
100208
102416
|
};
|
|
100209
102417
|
})();
|
|
100210
102418
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
100211
|
-
exports.PreferRaiseExceptionNew = exports.PreferRaiseExceptionNewConf = void 0;
|
|
102419
|
+
exports.PreferRaiseExceptionNew = exports.PreferRaiseExceptionNewConf = void 0;
|
|
102420
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
102421
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
102422
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
102423
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
102424
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
102425
|
+
const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
102426
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
|
|
102427
|
+
class PreferRaiseExceptionNewConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
102428
|
+
}
|
|
102429
|
+
exports.PreferRaiseExceptionNewConf = PreferRaiseExceptionNewConf;
|
|
102430
|
+
class PreferRaiseExceptionNew extends _abap_rule_1.ABAPRule {
|
|
102431
|
+
constructor() {
|
|
102432
|
+
super(...arguments);
|
|
102433
|
+
this.conf = new PreferRaiseExceptionNewConf();
|
|
102434
|
+
}
|
|
102435
|
+
getMetadata() {
|
|
102436
|
+
return {
|
|
102437
|
+
key: "prefer_raise_exception_new",
|
|
102438
|
+
title: "Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE",
|
|
102439
|
+
shortDescription: `Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE`,
|
|
102440
|
+
extendedInformation: `
|
|
102441
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type
|
|
102442
|
+
|
|
102443
|
+
From 752 and up`,
|
|
102444
|
+
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Upport],
|
|
102445
|
+
goodExample: `RAISE EXCEPTION NEW cx_generation_error( previous = exception ).`,
|
|
102446
|
+
badExample: `RAISE EXCEPTION TYPE cx_generation_error
|
|
102447
|
+
EXPORTING
|
|
102448
|
+
previous = exception.`,
|
|
102449
|
+
};
|
|
102450
|
+
}
|
|
102451
|
+
getConfig() {
|
|
102452
|
+
return this.conf;
|
|
102453
|
+
}
|
|
102454
|
+
setConfig(conf) {
|
|
102455
|
+
this.conf = conf;
|
|
102456
|
+
}
|
|
102457
|
+
runParsed(file) {
|
|
102458
|
+
if (!(0, version_1.releaseAtLeast)(this.reg.getConfig().getRelease(), version_1.Release.v752)) {
|
|
102459
|
+
return [];
|
|
102460
|
+
}
|
|
102461
|
+
const issues = [];
|
|
102462
|
+
for (const statement of file.getStatements()) {
|
|
102463
|
+
if (statement.get() instanceof Statements.Raise) {
|
|
102464
|
+
const concat = statement.concatTokens().toUpperCase();
|
|
102465
|
+
if (concat.includes(" MESSAGE")) {
|
|
102466
|
+
continue;
|
|
102467
|
+
}
|
|
102468
|
+
if (concat.startsWith("RAISE EXCEPTION TYPE ")) {
|
|
102469
|
+
const message = "Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE";
|
|
102470
|
+
const fix = this.getFix(file, statement, concat.includes(" EXPORTING") ? true : false);
|
|
102471
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));
|
|
102472
|
+
}
|
|
102473
|
+
}
|
|
102474
|
+
}
|
|
102475
|
+
return issues;
|
|
102476
|
+
}
|
|
102477
|
+
getFix(file, statement, withExporting) {
|
|
102478
|
+
const children = statement.getChildren();
|
|
102479
|
+
const fixText = withExporting ? "( " + children[5].concatTokens() + " )." : "( ).";
|
|
102480
|
+
const contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), fixText);
|
|
102481
|
+
const replaceType = edit_helper_1.EditHelper.replaceToken(file, children[2].getFirstToken(), "NEW");
|
|
102482
|
+
return edit_helper_1.EditHelper.merge(contentFix, replaceType);
|
|
102483
|
+
}
|
|
102484
|
+
}
|
|
102485
|
+
exports.PreferRaiseExceptionNew = PreferRaiseExceptionNew;
|
|
102486
|
+
//# sourceMappingURL=prefer_raise_exception_new.js.map
|
|
102487
|
+
|
|
102488
|
+
/***/ },
|
|
102489
|
+
|
|
102490
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/prefer_raise_message.js"
|
|
102491
|
+
/*!*****************************************************************************!*\
|
|
102492
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/prefer_raise_message.js ***!
|
|
102493
|
+
\*****************************************************************************/
|
|
102494
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
102495
|
+
|
|
102496
|
+
"use strict";
|
|
102497
|
+
|
|
102498
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
102499
|
+
if (k2 === undefined) k2 = k;
|
|
102500
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
102501
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
102502
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
102503
|
+
}
|
|
102504
|
+
Object.defineProperty(o, k2, desc);
|
|
102505
|
+
}) : (function(o, m, k, k2) {
|
|
102506
|
+
if (k2 === undefined) k2 = k;
|
|
102507
|
+
o[k2] = m[k];
|
|
102508
|
+
}));
|
|
102509
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
102510
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
102511
|
+
}) : function(o, v) {
|
|
102512
|
+
o["default"] = v;
|
|
102513
|
+
});
|
|
102514
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
102515
|
+
var ownKeys = function(o) {
|
|
102516
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
102517
|
+
var ar = [];
|
|
102518
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
102519
|
+
return ar;
|
|
102520
|
+
};
|
|
102521
|
+
return ownKeys(o);
|
|
102522
|
+
};
|
|
102523
|
+
return function (mod) {
|
|
102524
|
+
if (mod && mod.__esModule) return mod;
|
|
102525
|
+
var result = {};
|
|
102526
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
102527
|
+
__setModuleDefault(result, mod);
|
|
102528
|
+
return result;
|
|
102529
|
+
};
|
|
102530
|
+
})();
|
|
102531
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
102532
|
+
exports.PreferRaiseMessage = exports.PreferRaiseMessageConf = void 0;
|
|
100212
102533
|
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
100213
102534
|
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
100214
102535
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
100215
|
-
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
100216
102536
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
100217
|
-
const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
100218
102537
|
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
|
|
100219
|
-
|
|
102538
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
102539
|
+
class PreferRaiseMessageConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
102540
|
+
constructor() {
|
|
102541
|
+
super(...arguments);
|
|
102542
|
+
/** List of exception class names to ignore, case insensitive */
|
|
102543
|
+
this.ignoreExceptionClasses = [];
|
|
102544
|
+
}
|
|
100220
102545
|
}
|
|
100221
|
-
exports.
|
|
100222
|
-
class
|
|
102546
|
+
exports.PreferRaiseMessageConf = PreferRaiseMessageConf;
|
|
102547
|
+
class PreferRaiseMessage extends _abap_rule_1.ABAPRule {
|
|
100223
102548
|
constructor() {
|
|
100224
102549
|
super(...arguments);
|
|
100225
|
-
this.conf = new
|
|
102550
|
+
this.conf = new PreferRaiseMessageConf();
|
|
100226
102551
|
}
|
|
100227
102552
|
getMetadata() {
|
|
100228
102553
|
return {
|
|
100229
|
-
key: "
|
|
100230
|
-
title: "Prefer RAISE EXCEPTION
|
|
100231
|
-
shortDescription: `Prefer RAISE EXCEPTION
|
|
100232
|
-
extendedInformation: `
|
|
100233
|
-
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type
|
|
102554
|
+
key: "prefer_raise_message",
|
|
102555
|
+
title: "Prefer RAISE EXCEPTION with MESSAGE",
|
|
102556
|
+
shortDescription: `Prefer RAISE EXCEPTION with MESSAGE instead of supplying parameter TEXT or TEXTID`,
|
|
102557
|
+
extendedInformation: `Reports RAISE EXCEPTION statements where parameter TEXT or TEXTID is supplied.
|
|
100234
102558
|
|
|
100235
|
-
|
|
100236
|
-
|
|
100237
|
-
|
|
100238
|
-
|
|
100239
|
-
|
|
100240
|
-
|
|
102559
|
+
Use a message class instead, so the text is translatable and can be found via where-used.
|
|
102560
|
+
|
|
102561
|
+
Exception classes can be excluded via configuration "ignoreExceptionClasses".`,
|
|
102562
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
102563
|
+
goodExample: `RAISE EXCEPTION TYPE zcx_error MESSAGE e001(zclass).`,
|
|
102564
|
+
badExample: `RAISE EXCEPTION TYPE zcx_error
|
|
102565
|
+
EXPORTING text = 'hello world'.`,
|
|
100241
102566
|
};
|
|
100242
102567
|
}
|
|
100243
102568
|
getConfig() {
|
|
@@ -100247,35 +102572,46 @@ From 752 and up`,
|
|
|
100247
102572
|
this.conf = conf;
|
|
100248
102573
|
}
|
|
100249
102574
|
runParsed(file) {
|
|
100250
|
-
|
|
100251
|
-
|
|
100252
|
-
}
|
|
102575
|
+
var _a, _b, _c, _d;
|
|
102576
|
+
var _e;
|
|
100253
102577
|
const issues = [];
|
|
102578
|
+
const ignore = ((_e = this.conf.ignoreExceptionClasses) !== null && _e !== void 0 ? _e : []).map(c => c.toUpperCase());
|
|
100254
102579
|
for (const statement of file.getStatements()) {
|
|
100255
|
-
if (statement.get() instanceof Statements.Raise) {
|
|
100256
|
-
|
|
100257
|
-
|
|
100258
|
-
|
|
100259
|
-
|
|
100260
|
-
|
|
100261
|
-
|
|
100262
|
-
|
|
100263
|
-
|
|
100264
|
-
|
|
102580
|
+
if (!(statement.get() instanceof Statements.Raise)) {
|
|
102581
|
+
continue;
|
|
102582
|
+
}
|
|
102583
|
+
const concat = statement.concatTokens().toUpperCase();
|
|
102584
|
+
if (!concat.startsWith("RAISE EXCEPTION ") && !concat.startsWith("RAISE RESUMABLE EXCEPTION ")) {
|
|
102585
|
+
continue;
|
|
102586
|
+
}
|
|
102587
|
+
else if (concat.includes(" MESSAGE")) {
|
|
102588
|
+
continue;
|
|
102589
|
+
}
|
|
102590
|
+
let className;
|
|
102591
|
+
let parameters;
|
|
102592
|
+
const newObject = (_b = (_a = statement.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.MethodCallChain)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.NewObject);
|
|
102593
|
+
if (newObject) {
|
|
102594
|
+
className = (_c = newObject.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
102595
|
+
parameters = newObject.findDirectExpression(Expressions.ParameterListS);
|
|
102596
|
+
}
|
|
102597
|
+
else {
|
|
102598
|
+
className = (_d = statement.findDirectExpression(Expressions.ClassName)) === null || _d === void 0 ? void 0 : _d.concatTokens();
|
|
102599
|
+
parameters = statement.findDirectExpression(Expressions.ParameterListS);
|
|
102600
|
+
}
|
|
102601
|
+
if (className === undefined || ignore.includes(className.toUpperCase())) {
|
|
102602
|
+
continue;
|
|
102603
|
+
}
|
|
102604
|
+
const name = parameters === null || parameters === void 0 ? void 0 : parameters.findDirectExpressions(Expressions.ParameterS).map(p => { var _a; return (_a = p.findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase(); }).find(n => n === "TEXT" || n === "TEXTID");
|
|
102605
|
+
if (name) {
|
|
102606
|
+
const message = "Prefer RAISE EXCEPTION with MESSAGE, " + className + " raised with parameter " + name;
|
|
102607
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
|
|
100265
102608
|
}
|
|
100266
102609
|
}
|
|
100267
102610
|
return issues;
|
|
100268
102611
|
}
|
|
100269
|
-
getFix(file, statement, withExporting) {
|
|
100270
|
-
const children = statement.getChildren();
|
|
100271
|
-
const fixText = withExporting ? "( " + children[5].concatTokens() + " )." : "( ).";
|
|
100272
|
-
const contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), fixText);
|
|
100273
|
-
const replaceType = edit_helper_1.EditHelper.replaceToken(file, children[2].getFirstToken(), "NEW");
|
|
100274
|
-
return edit_helper_1.EditHelper.merge(contentFix, replaceType);
|
|
100275
|
-
}
|
|
100276
102612
|
}
|
|
100277
|
-
exports.
|
|
100278
|
-
//# sourceMappingURL=
|
|
102613
|
+
exports.PreferRaiseMessage = PreferRaiseMessage;
|
|
102614
|
+
//# sourceMappingURL=prefer_raise_message.js.map
|
|
100279
102615
|
|
|
100280
102616
|
/***/ },
|
|
100281
102617
|
|
|
@@ -103647,21 +105983,51 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
103647
105983
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
103648
105984
|
exports.SingleUseExpressionTemp = exports.SingleUseExpressionTempConf = void 0;
|
|
103649
105985
|
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
105986
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
|
|
103650
105987
|
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
103651
105988
|
const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
|
|
103652
105989
|
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
103653
105990
|
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
105991
|
+
const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
103654
105992
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
103655
105993
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
103656
105994
|
const _procedure_analysis_1 = __webpack_require__(/*! ./_procedure_analysis */ "./node_modules/@abaplint/core/build/src/rules/_procedure_analysis.js");
|
|
103657
105995
|
class SingleUseExpressionTempConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
103658
105996
|
}
|
|
103659
105997
|
exports.SingleUseExpressionTempConf = SingleUseExpressionTempConf;
|
|
103660
|
-
/** builtin functions whose result type follows the type of the argument */
|
|
103661
|
-
const NUMERIC_FUNCTIONS = new Set(["abs", "sign", "ceil", "floor", "trunc", "frac", "ipow", "nmax", "nmin",
|
|
103662
|
-
"round", "rescale"]);
|
|
103663
105998
|
/** constructor expressions that can build the result directly in the target */
|
|
103664
105999
|
const IN_PLACE = new Set(["VALUE", "CORRESPONDING", "COND", "SWITCH", "REDUCE", "FILTER"]);
|
|
106000
|
+
/** constructor expressions with an explicit type: KEYWORD type( ... ) */
|
|
106001
|
+
const CONSTRUCTORS = new Set(["VALUE", "CORRESPONDING", "COND", "SWITCH", "REDUCE", "FILTER", "CONV", "EXACT", "REF"]);
|
|
106002
|
+
/** types that an integer literal converts to without an exception */
|
|
106003
|
+
const LITERAL_CONVERSIONS = new Set(["I", "INT8", "F", "DECFLOAT16", "DECFLOAT34", "STRING"]);
|
|
106004
|
+
/** where the variable is read */
|
|
106005
|
+
var Placement;
|
|
106006
|
+
(function (Placement) {
|
|
106007
|
+
/** y = v. */
|
|
106008
|
+
Placement["Move"] = "move";
|
|
106009
|
+
/** v->m( ) or v->attr */
|
|
106010
|
+
Placement["Receiver"] = "receiver";
|
|
106011
|
+
/** m( v ), m( p = v ), CALL METHOD m EXPORTING p = v, NEW c( p = v ), CREATE OBJECT o EXPORTING p = v */
|
|
106012
|
+
Placement["Parameter"] = "parameter";
|
|
106013
|
+
/** APPEND v TO itab. */
|
|
106014
|
+
Placement["Append"] = "append";
|
|
106015
|
+
/** IF v = x., ELSEIF v = x., xsdbool( v = x ) */
|
|
106016
|
+
Placement["Comparison"] = "comparison";
|
|
106017
|
+
/** |{ v }| */
|
|
106018
|
+
Placement["Template"] = "template";
|
|
106019
|
+
})(Placement || (Placement = {}));
|
|
106020
|
+
var ExpressionKind;
|
|
106021
|
+
(function (ExpressionKind) {
|
|
106022
|
+
/** literal, string template without embeddings, CONV t( literal ) or a constant: the same value everywhere */
|
|
106023
|
+
ExpressionKind["Constant"] = "constant";
|
|
106024
|
+
/** reads only private variables and constants, cannot raise an exception or run other code */
|
|
106025
|
+
ExpressionKind["Pure"] = "pure";
|
|
106026
|
+
/** a data object that other code can change */
|
|
106027
|
+
ExpressionKind["Data"] = "data";
|
|
106028
|
+
/** method calls, NEW and everything else */
|
|
106029
|
+
ExpressionKind["Other"] = "other";
|
|
106030
|
+
})(ExpressionKind || (ExpressionKind = {}));
|
|
103665
106031
|
class SingleUseExpressionTemp {
|
|
103666
106032
|
constructor() {
|
|
103667
106033
|
this.conf = new SingleUseExpressionTempConf();
|
|
@@ -103670,28 +106036,62 @@ class SingleUseExpressionTemp {
|
|
|
103670
106036
|
return {
|
|
103671
106037
|
key: "single_use_expression_temp",
|
|
103672
106038
|
title: "Single use expression temporary",
|
|
103673
|
-
shortDescription: `Finds
|
|
103674
|
-
extendedInformation: `Reports DATA(
|
|
103675
|
-
|
|
103676
|
-
|
|
103677
|
-
|
|
106039
|
+
shortDescription: `Finds a local variable that only passes the value of an expression on to its single use`,
|
|
106040
|
+
extendedInformation: `Reports DATA(v) = <expression>. and DATA v TYPE t. [CLEAR v.] v = <expression>.
|
|
106041
|
+
when all of the following hold:
|
|
106042
|
+
|
|
106043
|
+
* v is a local variable of a METHOD, FORM or FUNCTION, its address is never taken. DATA(v) has no other
|
|
106044
|
+
reference than its single read; DATA v TYPE t. without VALUE and not chained, or DATA(v) = VALUE t( ). with
|
|
106045
|
+
nothing in the parentheses, has exactly one write besides CLEARs, v = <expression>., all CLEARs are before it,
|
|
106046
|
+
and exactly one read after it
|
|
106047
|
+
* the read is one of
|
|
106048
|
+
* the complete source of y = v.
|
|
106049
|
+
* the receiver of a method call or attribute access: v->m( ), v->attr
|
|
106050
|
+
* an actual parameter for an importing parameter: m( v ), m( p = v ), CALL METHOD m EXPORTING p = v,
|
|
106051
|
+
NEW c( p = v ) or CREATE OBJECT o EXPORTING p = v
|
|
106052
|
+
* APPEND v TO itab.
|
|
106053
|
+
* an operand of a comparison with =, <>, <, >, <=, >= or their word forms, in IF, ELSEIF or xsdbool( )
|
|
106054
|
+
* an embedding in a string template: |{ v }|
|
|
106055
|
+
* the read is in the statement directly after the assignment, in the same block, ignoring declarations like
|
|
106056
|
+
DATA and TYPES in between, unless the expression is
|
|
106057
|
+
constant: a literal, a string template without embeddings, CONV t( <integer literal> ) to a type that cannot
|
|
106058
|
+
overflow, or a constant. Then the assignment must be executed before the read on every path: the read is in
|
|
106059
|
+
the block of the assignment or a nested block
|
|
103678
106060
|
* the result type of the expression does not depend on the target: no arithmetic or bit operators, no unary
|
|
103679
|
-
minus, no numeric functions like abs( ) or trunc( ) whose type follows the argument, no CONV or EXACT
|
|
103680
|
-
no # type inference at the top. String templates, && concatenations, literals, method calls, NEW, CAST,
|
|
106061
|
+
minus, no numeric functions like abs( ) or trunc( ) whose type follows the argument, no CONV or EXACT except
|
|
106062
|
+
the constant CONV t( literal ), no # type inference at the top. String templates, && concatenations, literals, method calls, NEW, CAST,
|
|
103681
106063
|
constructor expressions with explicit type and table expressions are fine
|
|
106064
|
+
* for DATA v TYPE t. and DATA(v) = VALUE t( )., the static type of the expression is identical to t. Into y = v. also a reference whose
|
|
106065
|
+
static type is a subtype of t, unless y is an inline declaration, and an expression whose type depends on the
|
|
106066
|
+
target, like arithmetic, if y has a type identical to t
|
|
103682
106067
|
* VALUE, CORRESPONDING, COND, SWITCH, REDUCE and FILTER can build their result directly in the target,
|
|
103683
|
-
they are only
|
|
106068
|
+
they are only moved into a new variable, or a local variable that they do not read and whose address
|
|
103684
106069
|
is never taken
|
|
103685
|
-
*
|
|
106070
|
+
* the order of evaluation does not change: if the expression is not constant, nothing that is evaluated before the
|
|
106071
|
+
read in the same statement calls a method or function, constructs an object, accesses a table or an attribute
|
|
106072
|
+
via a reference, does arithmetic, or reads data other than local variables, pass-by-value parameters and
|
|
106073
|
+
constants; the read is not inside COND, SWITCH, VALUE or other constructor expressions except NEW, and not
|
|
106074
|
+
after AND, OR or EQUIV, where it might not be evaluated. This does not apply to expressions that only read
|
|
106075
|
+
local variables and cannot raise an exception
|
|
106076
|
+
* a data object that other code can change is only moved if it keeps its value until the read, see
|
|
106077
|
+
unnecessary_copy, a data object read by DATA(v) = <data object>. is left for unnecessary_copy, and a local
|
|
106078
|
+
variable copied into y = v. for copy_chain
|
|
106079
|
+
* a character constant in IF, ELSEIF, WHILE, CHECK, CASE or WHEN is left for constant_condition
|
|
103686
106080
|
|
|
103687
106081
|
Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
|
|
103688
106082
|
INCLUDE, test seams, enhancements or native SQL.
|
|
103689
106083
|
|
|
103690
|
-
The quick fix deletes the declaration and
|
|
106084
|
+
The quick fix deletes the declaration, the CLEARs and the assignment, and replaces the read of v with the
|
|
106085
|
+
expression. Moving the expression of DATA v TYPE t. into other places than y = v. requires 7.40 SP02 or above,
|
|
106086
|
+
ABAP Cloud or open-abap.`,
|
|
103691
106087
|
tags: [_irule_1.RuleTag.Quickfix],
|
|
103692
106088
|
badExample: `DATA(lo_conf) = NEW zcl_conf( ).
|
|
103693
|
-
mo_conf = lo_conf
|
|
103694
|
-
|
|
106089
|
+
mo_conf = lo_conf.
|
|
106090
|
+
DATA lv_key TYPE string.
|
|
106091
|
+
lv_key = |abapdoc|.
|
|
106092
|
+
lo_meta = NEW zcl_meta( iv_key = lv_key ).`,
|
|
106093
|
+
goodExample: `mo_conf = NEW zcl_conf( ).
|
|
106094
|
+
lo_meta = NEW zcl_meta( iv_key = |abapdoc| ).`,
|
|
103695
106095
|
};
|
|
103696
106096
|
}
|
|
103697
106097
|
getConfig() {
|
|
@@ -103710,61 +106110,501 @@ mo_conf = lo_conf.`,
|
|
|
103710
106110
|
if (analysis === undefined) {
|
|
103711
106111
|
return [];
|
|
103712
106112
|
}
|
|
106113
|
+
const config = this.reg.getConfig();
|
|
106114
|
+
const expressions = (0, version_1.releaseAtLeast)(config.getRelease(), version_1.Release.v740sp02)
|
|
106115
|
+
|| config.getLanguageVersion() === version_1.LanguageVersion.Cloud || config.isOpenABAP();
|
|
103713
106116
|
const issues = [];
|
|
103714
106117
|
for (const procedure of analysis.procedures) {
|
|
103715
106118
|
if (procedure.supported === false) {
|
|
103716
106119
|
continue;
|
|
103717
106120
|
}
|
|
103718
106121
|
for (const variable of procedure.locals()) {
|
|
103719
|
-
const
|
|
103720
|
-
const
|
|
103721
|
-
|
|
103722
|
-
if (move === undefined || move.operator !== "="
|
|
103723
|
-
|| move.target.getChildren().length !== 1
|
|
103724
|
-
|| move.target.findDirectExpression(Expressions.InlineData) === undefined
|
|
103725
|
-
|| variable.occurrences.length !== 1 || read.kind !== _procedure_analysis_1.OccurrenceKind.Read
|
|
103726
|
-
|| read.statement !== procedure.statements[procedure.index(declaration) + 1]
|
|
103727
|
-
|| procedure.block(read.statement) !== procedure.block(declaration)
|
|
103728
|
-
|| !procedure.isSimple(read.statement)) {
|
|
106122
|
+
const temp = (_a = (variable.inline ? this.inlineTemp(procedure, variable) : undefined)) !== null && _a !== void 0 ? _a : this.declaredTemp(variable);
|
|
106123
|
+
const read = variable.reads()[0];
|
|
106124
|
+
if (temp === undefined || read === undefined) {
|
|
103729
106125
|
continue;
|
|
103730
106126
|
}
|
|
103731
|
-
const
|
|
103732
|
-
if (
|
|
103733
|
-
|| (
|
|
103734
|
-
||
|
|
103735
|
-
|| !this.targetIndependent(procedure, move.source)
|
|
103736
|
-
|| !this.noAliasing(procedure, move.source, use.target)) {
|
|
106127
|
+
const placement = this.placement(procedure, read.statement, read.token);
|
|
106128
|
+
if (placement === undefined
|
|
106129
|
+
|| (!variable.inline && placement !== Placement.Move && expressions === false)
|
|
106130
|
+
|| !this.valid(procedure, temp, read, placement)) {
|
|
103737
106131
|
continue;
|
|
103738
106132
|
}
|
|
103739
|
-
const
|
|
103740
|
-
|
|
103741
|
-
(0, _procedure_analysis_1.deleteStatement)(procedure.file,
|
|
103742
|
-
|
|
103743
|
-
const
|
|
103744
|
-
|
|
106133
|
+
const edits = [edit_helper_1.EditHelper.replaceToken(procedure.file, read.token, (0, _procedure_analysis_1.nodeText)(procedure.file, temp.source))];
|
|
106134
|
+
for (const statement of temp.remove) {
|
|
106135
|
+
edits.push((0, _procedure_analysis_1.deleteStatement)(procedure.file, statement));
|
|
106136
|
+
}
|
|
106137
|
+
const fix = (0, _procedure_analysis_1.mergeEdits)(procedure.file, edits);
|
|
106138
|
+
const message = "Use the expression directly instead of via " + variable.identifier.getName();
|
|
106139
|
+
issues.push(issue_1.Issue.atStatement(procedure.file, temp.write, message, this.getMetadata().key, this.conf.severity, fix));
|
|
103745
106140
|
}
|
|
103746
106141
|
}
|
|
103747
106142
|
return issues;
|
|
103748
106143
|
}
|
|
106144
|
+
/** DATA(v) = <expression>. with a single read, plain data objects are left for unnecessary_copy */
|
|
106145
|
+
inlineTemp(procedure, variable) {
|
|
106146
|
+
const declaration = variable.declaration;
|
|
106147
|
+
const move = (0, _procedure_analysis_1.plainMove)(declaration);
|
|
106148
|
+
if (move === undefined || move.operator !== "="
|
|
106149
|
+
|| move.target.getChildren().length !== 1
|
|
106150
|
+
|| move.target.findDirectExpression(Expressions.InlineData) === undefined
|
|
106151
|
+
|| variable.occurrences.length !== 1 || variable.occurrences[0].kind !== _procedure_analysis_1.OccurrenceKind.Read
|
|
106152
|
+
|| (0, _procedure_analysis_1.dataSource)(procedure, move.source) !== undefined
|
|
106153
|
+
|| !this.targetIndependent(procedure, move.source)) {
|
|
106154
|
+
return undefined;
|
|
106155
|
+
}
|
|
106156
|
+
return { variable, write: declaration, source: move.source, remove: [declaration], typed: false };
|
|
106157
|
+
}
|
|
106158
|
+
/** DATA v TYPE t. or DATA(v) = VALUE t( )., [CLEAR v.] v = <expression>. with a single read after it */
|
|
106159
|
+
declaredTemp(variable) {
|
|
106160
|
+
var _a, _b;
|
|
106161
|
+
const declaration = variable.declaration;
|
|
106162
|
+
if ((0, _procedure_analysis_1.initialDeclaration)(variable) === undefined || declaration.getColon() !== undefined || variable.escapes()) {
|
|
106163
|
+
return undefined;
|
|
106164
|
+
}
|
|
106165
|
+
const clears = [];
|
|
106166
|
+
const writes = [];
|
|
106167
|
+
for (const write of variable.writes()) {
|
|
106168
|
+
if (((_a = (0, _procedure_analysis_1.plainClear)(write.statement)) === null || _a === void 0 ? void 0 : _a.getStart().equals(write.token.getStart())) === true
|
|
106169
|
+
&& write.statement.getColon() === undefined) {
|
|
106170
|
+
clears.push(write);
|
|
106171
|
+
}
|
|
106172
|
+
else {
|
|
106173
|
+
writes.push(write);
|
|
106174
|
+
}
|
|
106175
|
+
}
|
|
106176
|
+
const reads = variable.reads();
|
|
106177
|
+
if (writes.length !== 1 || reads.length !== 1) {
|
|
106178
|
+
return undefined;
|
|
106179
|
+
}
|
|
106180
|
+
const write = writes[0];
|
|
106181
|
+
const move = (0, _procedure_analysis_1.plainMove)(write.statement);
|
|
106182
|
+
if (move === undefined || move.operator !== "="
|
|
106183
|
+
|| ((_b = (0, _procedure_analysis_1.singleTarget)(move.target)) === null || _b === void 0 ? void 0 : _b.getStart().equals(write.token.getStart())) !== true
|
|
106184
|
+
|| clears.some(c => c.index > write.index)
|
|
106185
|
+
|| reads[0].index <= write.index) {
|
|
106186
|
+
return undefined;
|
|
106187
|
+
}
|
|
106188
|
+
return { variable, write: write.statement, source: move.source,
|
|
106189
|
+
remove: [declaration, ...clears.map(c => c.statement), write.statement], typed: true };
|
|
106190
|
+
}
|
|
106191
|
+
placement(procedure, statement, token) {
|
|
106192
|
+
var _a, _b, _c, _d;
|
|
106193
|
+
if (statement.getColon() !== undefined) {
|
|
106194
|
+
return undefined;
|
|
106195
|
+
}
|
|
106196
|
+
const move = (0, _procedure_analysis_1.plainMove)(statement);
|
|
106197
|
+
if (move !== undefined && move.operator === "=" && ((_a = (0, _procedure_analysis_1.singleField)(move.source)) === null || _a === void 0 ? void 0 : _a.getStart().equals(token.getStart())) === true) {
|
|
106198
|
+
return Placement.Move;
|
|
106199
|
+
}
|
|
106200
|
+
const path = (0, _procedure_analysis_1.expressionPath)(statement, token);
|
|
106201
|
+
if (path.some(e => e.get() instanceof Expressions.Target || e.get() instanceof Expressions.MethodSource
|
|
106202
|
+
|| e.get() instanceof Expressions.Dereference)) {
|
|
106203
|
+
return undefined;
|
|
106204
|
+
}
|
|
106205
|
+
const tokens = procedure.tokensOf(statement);
|
|
106206
|
+
const index = tokens.findIndex(t => t.getStart().equals(token.getStart()));
|
|
106207
|
+
if (((_b = tokens[index + 1]) === null || _b === void 0 ? void 0 : _b.getStr()) === "->") {
|
|
106208
|
+
return ((_c = tokens[index + 2]) === null || _c === void 0 ? void 0 : _c.getStr()) === "*" ? undefined : Placement.Receiver;
|
|
106209
|
+
}
|
|
106210
|
+
let sourceIndex = path.length - 1;
|
|
106211
|
+
while (sourceIndex >= 0 && !(path[sourceIndex].get() instanceof Expressions.Source)
|
|
106212
|
+
&& !(path[sourceIndex].get() instanceof Expressions.SimpleSource4)) {
|
|
106213
|
+
sourceIndex--;
|
|
106214
|
+
}
|
|
106215
|
+
const source = path[sourceIndex];
|
|
106216
|
+
if (source === undefined || source.countTokens() !== 1
|
|
106217
|
+
|| source.findDirectExpression(Expressions.FieldChain) === undefined) {
|
|
106218
|
+
return undefined;
|
|
106219
|
+
}
|
|
106220
|
+
const parent = path[sourceIndex - 1];
|
|
106221
|
+
if (parent === undefined) {
|
|
106222
|
+
return statement.get() instanceof Statements.Append && statement.getChildren()[1] === source
|
|
106223
|
+
? Placement.Append : undefined;
|
|
106224
|
+
}
|
|
106225
|
+
else if (parent.get() instanceof Expressions.StringTemplateSource) {
|
|
106226
|
+
return Placement.Template;
|
|
106227
|
+
}
|
|
106228
|
+
else if (parent.get() instanceof Expressions.Compare) {
|
|
106229
|
+
if (parent.findDirectExpression(Expressions.CompareOperator) === undefined) {
|
|
106230
|
+
return undefined;
|
|
106231
|
+
}
|
|
106232
|
+
let owner = sourceIndex - 2;
|
|
106233
|
+
while (((_d = path[owner]) === null || _d === void 0 ? void 0 : _d.get()) instanceof Expressions.Cond) {
|
|
106234
|
+
owner--;
|
|
106235
|
+
}
|
|
106236
|
+
if (owner === sourceIndex - 2) {
|
|
106237
|
+
return undefined;
|
|
106238
|
+
}
|
|
106239
|
+
else if (owner < 0) {
|
|
106240
|
+
const type = statement.get();
|
|
106241
|
+
return type instanceof Statements.If || type instanceof Statements.ElseIf ? Placement.Comparison : undefined;
|
|
106242
|
+
}
|
|
106243
|
+
const keyword = path[owner].getFirstToken().getStr().toUpperCase();
|
|
106244
|
+
return path[owner].get() instanceof Expressions.Source && (keyword === "XSDBOOL" || keyword === "BOOLC")
|
|
106245
|
+
? Placement.Comparison : undefined;
|
|
106246
|
+
}
|
|
106247
|
+
return (0, _procedure_analysis_1.formalParameter)(procedure, statement, token) !== undefined ? Placement.Parameter : undefined;
|
|
106248
|
+
}
|
|
106249
|
+
valid(procedure, temp, read, placement) {
|
|
106250
|
+
const statement = read.statement;
|
|
106251
|
+
const kind = this.kind(procedure, temp.source);
|
|
106252
|
+
if (kind === ExpressionKind.Constant) {
|
|
106253
|
+
if (!procedure.dominates(temp.write, statement)
|
|
106254
|
+
|| (!temp.typed && (0, _procedure_analysis_1.isCondition)(statement) && (0, _procedure_analysis_1.characterConstant)(procedure, temp.source) !== undefined)) {
|
|
106255
|
+
return false;
|
|
106256
|
+
}
|
|
106257
|
+
}
|
|
106258
|
+
else if (statement !== procedure.nextExecuted(temp.write)
|
|
106259
|
+
|| !(procedure.isSimple(statement) || statement.get() instanceof Statements.If)) {
|
|
106260
|
+
return false;
|
|
106261
|
+
}
|
|
106262
|
+
if (!this.typeMatches(procedure, temp, statement, placement)) {
|
|
106263
|
+
return false;
|
|
106264
|
+
}
|
|
106265
|
+
else if (placement === Placement.Receiver && !this.chainable(temp.source)) {
|
|
106266
|
+
return false;
|
|
106267
|
+
}
|
|
106268
|
+
const data = (0, _procedure_analysis_1.dataSource)(procedure, temp.source);
|
|
106269
|
+
if (kind === ExpressionKind.Constant) {
|
|
106270
|
+
return true;
|
|
106271
|
+
}
|
|
106272
|
+
else if ((data === null || data === void 0 ? void 0 : data.kind) === _procedure_analysis_1.SourceKind.Local && (0, _procedure_analysis_1.singleField)(temp.source) !== undefined && placement === Placement.Move) {
|
|
106273
|
+
// left for copy_chain
|
|
106274
|
+
return false;
|
|
106275
|
+
}
|
|
106276
|
+
else if (!this.notWrittenIn(procedure, temp.source, statement)) {
|
|
106277
|
+
return false;
|
|
106278
|
+
}
|
|
106279
|
+
else if (kind === ExpressionKind.Pure) {
|
|
106280
|
+
return true;
|
|
106281
|
+
}
|
|
106282
|
+
else if (!this.evaluatedFirst(procedure, statement, read.token) || !this.alwaysEvaluated(statement, read.token)) {
|
|
106283
|
+
return false;
|
|
106284
|
+
}
|
|
106285
|
+
return data === undefined || (0, _procedure_analysis_1.unchangedBetween)(procedure, data, temp.write, statement, read.token);
|
|
106286
|
+
}
|
|
106287
|
+
kind(procedure, source) {
|
|
106288
|
+
var _a;
|
|
106289
|
+
const data = (0, _procedure_analysis_1.dataSource)(procedure, source);
|
|
106290
|
+
if (this.constant(source) || (data === null || data === void 0 ? void 0 : data.kind) === _procedure_analysis_1.SourceKind.Immutable) {
|
|
106291
|
+
return ExpressionKind.Constant;
|
|
106292
|
+
}
|
|
106293
|
+
else if (((data === null || data === void 0 ? void 0 : data.kind) === _procedure_analysis_1.SourceKind.Local && ((_a = data.base) === null || _a === void 0 ? void 0 : _a.escapes()) === false) || this.pure(procedure, source)) {
|
|
106294
|
+
return ExpressionKind.Pure;
|
|
106295
|
+
}
|
|
106296
|
+
else if (data !== undefined) {
|
|
106297
|
+
return ExpressionKind.Data;
|
|
106298
|
+
}
|
|
106299
|
+
return ExpressionKind.Other;
|
|
106300
|
+
}
|
|
106301
|
+
/** a literal, a string template without embeddings, or CONV t( literal ) that cannot raise an exception */
|
|
106302
|
+
constant(source) {
|
|
106303
|
+
var _a;
|
|
106304
|
+
const children = source.getChildren();
|
|
106305
|
+
const first = children[0];
|
|
106306
|
+
if (children.length === 1 && first instanceof nodes_1.ExpressionNode) {
|
|
106307
|
+
return first.get() instanceof Expressions.Constant
|
|
106308
|
+
|| (first.get() instanceof Expressions.StringTemplate
|
|
106309
|
+
&& first.findDirectExpression(Expressions.StringTemplateSource) === undefined);
|
|
106310
|
+
}
|
|
106311
|
+
if (children.length !== 5 || source.getFirstToken().getStr().toUpperCase() !== "CONV") {
|
|
106312
|
+
return false;
|
|
106313
|
+
}
|
|
106314
|
+
const type = ((_a = source.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) || "";
|
|
106315
|
+
const body = source.findDirectExpression(Expressions.ConvBody);
|
|
106316
|
+
const value = (body === null || body === void 0 ? void 0 : body.getChildren().length) === 1 ? body.findDirectExpression(Expressions.Source) : undefined;
|
|
106317
|
+
const literal = (value === null || value === void 0 ? void 0 : value.getChildren().length) === 1 ? value.findDirectExpression(Expressions.Constant) : undefined;
|
|
106318
|
+
return literal !== undefined && LITERAL_CONVERSIONS.has(type)
|
|
106319
|
+
&& (literal.findDirectExpression(Expressions.Integer) !== undefined || type === "STRING");
|
|
106320
|
+
}
|
|
106321
|
+
/** reads only private variables and constants, and cannot raise an exception: string templates and
|
|
106322
|
+
* concatenations of such fields, xsdbool( ) and boolc( ) of IS INITIAL, IS BOUND, IS INSTANCE OF and
|
|
106323
|
+
* comparisons without conversion */
|
|
106324
|
+
pure(procedure, source) {
|
|
106325
|
+
const children = source.getChildren();
|
|
106326
|
+
const first = children[0];
|
|
106327
|
+
const keyword = first instanceof nodes_1.TokenNode ? first.getFirstToken().getStr().toUpperCase() : "";
|
|
106328
|
+
if (children.length === 1 && first instanceof nodes_1.ExpressionNode) {
|
|
106329
|
+
return this.pureOperand(procedure, first);
|
|
106330
|
+
}
|
|
106331
|
+
else if (children.length === 3 && children[1] instanceof nodes_1.TokenNode && children[1].getFirstToken().getStr() === "&&"
|
|
106332
|
+
&& children[0] instanceof nodes_1.ExpressionNode && children[2] instanceof nodes_1.ExpressionNode) {
|
|
106333
|
+
return this.pureOperand(procedure, children[0]) && this.pure(procedure, children[2]);
|
|
106334
|
+
}
|
|
106335
|
+
else if (children.length === 4 && (keyword === "XSDBOOL" || keyword === "BOOLC")) {
|
|
106336
|
+
const cond = source.findDirectExpression(Expressions.Cond);
|
|
106337
|
+
return cond !== undefined && this.pureCondition(procedure, cond);
|
|
106338
|
+
}
|
|
106339
|
+
return false;
|
|
106340
|
+
}
|
|
106341
|
+
/** a literal, a private variable or constant, or a string template that embeds only those, without formatting */
|
|
106342
|
+
pureOperand(procedure, operand) {
|
|
106343
|
+
if (operand.get() instanceof Expressions.Constant) {
|
|
106344
|
+
return true;
|
|
106345
|
+
}
|
|
106346
|
+
else if (operand.get() instanceof Expressions.FieldChain) {
|
|
106347
|
+
return operand.countTokens() === 1 && this.privateField(procedure, operand.getFirstToken());
|
|
106348
|
+
}
|
|
106349
|
+
else if (operand.get() instanceof Expressions.StringTemplate) {
|
|
106350
|
+
return operand.findDirectExpressions(Expressions.StringTemplateSource).every(s => s.getChildren().length === 1
|
|
106351
|
+
&& this.operandType(procedure, s.findDirectExpression(Expressions.Source)) !== undefined);
|
|
106352
|
+
}
|
|
106353
|
+
return false;
|
|
106354
|
+
}
|
|
106355
|
+
pureCondition(procedure, cond) {
|
|
106356
|
+
for (const child of cond.getChildren()) {
|
|
106357
|
+
if (child instanceof nodes_1.TokenNode) {
|
|
106358
|
+
continue;
|
|
106359
|
+
}
|
|
106360
|
+
else if (child.get() instanceof Expressions.Cond) {
|
|
106361
|
+
if (!this.pureCondition(procedure, child)) {
|
|
106362
|
+
return false;
|
|
106363
|
+
}
|
|
106364
|
+
}
|
|
106365
|
+
else if (child.get() instanceof Expressions.Compare) {
|
|
106366
|
+
const operands = child.findDirectExpressions(Expressions.Source);
|
|
106367
|
+
const words = child.getChildren().filter(c => c instanceof nodes_1.TokenNode).map(c => c.getFirstToken().getStr().toUpperCase());
|
|
106368
|
+
const operator = child.findDirectExpression(Expressions.CompareOperator);
|
|
106369
|
+
const types = operands.map(o => this.operandType(procedure, o));
|
|
106370
|
+
if (types.some(t => t === undefined)) {
|
|
106371
|
+
return false;
|
|
106372
|
+
}
|
|
106373
|
+
else if (operands.length === 1 && words[words.length - 1] !== "SUPPLIED" && words[words.length - 1] !== "REQUESTED"
|
|
106374
|
+
&& words.includes("IS") && child.findDirectExpression(Expressions.CompareOperator) === undefined) {
|
|
106375
|
+
// IS [NOT] INITIAL, IS [NOT] BOUND, IS [NOT] INSTANCE OF
|
|
106376
|
+
continue;
|
|
106377
|
+
}
|
|
106378
|
+
else if (operands.length === 2 && operator !== undefined
|
|
106379
|
+
&& ((0, _procedure_analysis_1.identicalTypes)(types[0], types[1]) || ((0, _procedure_analysis_1.isReferenceType)(types[0]) && (0, _procedure_analysis_1.isReferenceType)(types[1])))) {
|
|
106380
|
+
continue;
|
|
106381
|
+
}
|
|
106382
|
+
return false;
|
|
106383
|
+
}
|
|
106384
|
+
else {
|
|
106385
|
+
return false;
|
|
106386
|
+
}
|
|
106387
|
+
}
|
|
106388
|
+
return true;
|
|
106389
|
+
}
|
|
106390
|
+
/** type of a private variable, a constant or a literal, which can be read without side effects */
|
|
106391
|
+
operandType(procedure, source) {
|
|
106392
|
+
if (source.getChildren().length !== 1 || source.countTokens() !== 1) {
|
|
106393
|
+
return undefined;
|
|
106394
|
+
}
|
|
106395
|
+
const constant = source.findDirectExpression(Expressions.Constant);
|
|
106396
|
+
if (constant !== undefined) {
|
|
106397
|
+
return (0, _procedure_analysis_1.literalType)(constant);
|
|
106398
|
+
}
|
|
106399
|
+
const field = (0, _procedure_analysis_1.singleField)(source);
|
|
106400
|
+
if (field === undefined || !this.privateField(procedure, field)) {
|
|
106401
|
+
return undefined;
|
|
106402
|
+
}
|
|
106403
|
+
return procedure.identifierAt(field).getType();
|
|
106404
|
+
}
|
|
106405
|
+
privateField(procedure, token) {
|
|
106406
|
+
const identifier = procedure.identifierAt(token);
|
|
106407
|
+
return (0, _procedure_analysis_1.isImmutable)(identifier) || procedure.private(identifier) !== undefined;
|
|
106408
|
+
}
|
|
106409
|
+
/** the variables read by the expression are not changed by the statement that reads the temporary,
|
|
106410
|
+
* except as the target of a move, which is written after its source is evaluated */
|
|
106411
|
+
notWrittenIn(procedure, source, statement) {
|
|
106412
|
+
var _a;
|
|
106413
|
+
const target = (_a = (0, _procedure_analysis_1.plainMove)(statement)) === null || _a === void 0 ? void 0 : _a.target;
|
|
106414
|
+
const inTarget = (token) => target !== undefined
|
|
106415
|
+
&& !token.getStart().isBefore(target.getFirstToken().getStart()) && !target.getLastToken().getStart().isBefore(token.getStart());
|
|
106416
|
+
for (const token of source.getTokens()) {
|
|
106417
|
+
const variable = procedure.variable(procedure.identifierAt(token));
|
|
106418
|
+
if ((variable === null || variable === void 0 ? void 0 : variable.occurrences.some(o => o.statement === statement && o.kind !== _procedure_analysis_1.OccurrenceKind.Read && !inTarget(o.token))) === true) {
|
|
106419
|
+
return false;
|
|
106420
|
+
}
|
|
106421
|
+
}
|
|
106422
|
+
return true;
|
|
106423
|
+
}
|
|
106424
|
+
/** nothing evaluated before the token in the statement can run other code, raise an exception or read data that
|
|
106425
|
+
* other code changes. The target of a move is evaluated after its source */
|
|
106426
|
+
evaluatedFirst(procedure, statement, token) {
|
|
106427
|
+
var _a, _b;
|
|
106428
|
+
const position = token.getStart();
|
|
106429
|
+
const before = (node) => node.getLastToken().getStart().isBefore(position);
|
|
106430
|
+
for (const type of [Expressions.MethodCall, Expressions.NewObject, Expressions.Cast, Expressions.TableExpression,
|
|
106431
|
+
Expressions.ArithOperator, Expressions.Dereference]) {
|
|
106432
|
+
if (statement.findAllExpressionsRecursive(type).some(before)) {
|
|
106433
|
+
return false;
|
|
106434
|
+
}
|
|
106435
|
+
}
|
|
106436
|
+
for (const source of statement.findAllExpressionsRecursive(Expressions.Source)) {
|
|
106437
|
+
const keyword = source.getFirstToken().getStr().toUpperCase();
|
|
106438
|
+
if (before(source) && CONSTRUCTORS.has(keyword) && source.findDirectExpression(Expressions.TypeNameOrInfer) !== undefined) {
|
|
106439
|
+
return false;
|
|
106440
|
+
}
|
|
106441
|
+
}
|
|
106442
|
+
// the target of a move or CREATE OBJECT is written after the source and the parameters are evaluated
|
|
106443
|
+
let target = (_a = (0, _procedure_analysis_1.plainMove)(statement)) === null || _a === void 0 ? void 0 : _a.target;
|
|
106444
|
+
if (statement.get() instanceof Statements.CreateObject) {
|
|
106445
|
+
target = statement.findDirectExpression(Expressions.Target);
|
|
106446
|
+
if ((target === null || target === void 0 ? void 0 : target.countTokens()) !== 1) {
|
|
106447
|
+
return false;
|
|
106448
|
+
}
|
|
106449
|
+
}
|
|
106450
|
+
const tokens = procedure.tokensOf(statement);
|
|
106451
|
+
for (let i = 0; i < tokens.length && tokens[i].getStart().isBefore(position); i++) {
|
|
106452
|
+
if (target !== undefined && !tokens[i].getStart().isBefore(target.getFirstToken().getStart())
|
|
106453
|
+
&& !target.getLastToken().getStart().isBefore(tokens[i].getStart())) {
|
|
106454
|
+
continue;
|
|
106455
|
+
}
|
|
106456
|
+
const references = procedure.analysis.referencesAt(procedure.file.getFilename(), tokens[i]);
|
|
106457
|
+
if (references.some(r => r.referenceType === _reference_1.ReferenceType.DataReadReference
|
|
106458
|
+
|| r.referenceType === _reference_1.ReferenceType.DataWriteReference)) {
|
|
106459
|
+
// a private variable or constant, and a reference only to call a method: v->m( ... token ... )
|
|
106460
|
+
if (!this.privateField(procedure, tokens[i])
|
|
106461
|
+
|| (((_b = tokens[i + 1]) === null || _b === void 0 ? void 0 : _b.getStr()) === "->"
|
|
106462
|
+
&& (tokens[i + 2] === undefined || procedure.methodAt(tokens[i + 2]) === undefined))) {
|
|
106463
|
+
return false;
|
|
106464
|
+
}
|
|
106465
|
+
}
|
|
106466
|
+
}
|
|
106467
|
+
return true;
|
|
106468
|
+
}
|
|
106469
|
+
/** the token is evaluated whenever the statement is: not in a branch of COND or SWITCH, not in an iteration of
|
|
106470
|
+
* VALUE, REDUCE or FILTER, and not after AND, OR or EQUIV */
|
|
106471
|
+
alwaysEvaluated(statement, token) {
|
|
106472
|
+
const position = token.getStart();
|
|
106473
|
+
for (const node of (0, _procedure_analysis_1.expressionPath)(statement, token)) {
|
|
106474
|
+
if (node.get() instanceof Expressions.Source) {
|
|
106475
|
+
const keyword = node.getFirstToken().getStr().toUpperCase();
|
|
106476
|
+
if (CONSTRUCTORS.has(keyword) && node.findDirectExpression(Expressions.TypeNameOrInfer) !== undefined) {
|
|
106477
|
+
return false;
|
|
106478
|
+
}
|
|
106479
|
+
}
|
|
106480
|
+
else if (node.get() instanceof Expressions.Cond) {
|
|
106481
|
+
for (const child of node.getChildren()) {
|
|
106482
|
+
const word = child.getFirstToken().getStr().toUpperCase();
|
|
106483
|
+
if (child instanceof nodes_1.TokenNode && child.getFirstToken().getStart().isBefore(position)
|
|
106484
|
+
&& (word === "AND" || word === "OR" || word === "EQUIV")) {
|
|
106485
|
+
return false;
|
|
106486
|
+
}
|
|
106487
|
+
}
|
|
106488
|
+
}
|
|
106489
|
+
else if (node.get() instanceof Expressions.For || node.get() instanceof Expressions.Let) {
|
|
106490
|
+
return false;
|
|
106491
|
+
}
|
|
106492
|
+
}
|
|
106493
|
+
return true;
|
|
106494
|
+
}
|
|
106495
|
+
/** the expression can be followed by -> */
|
|
106496
|
+
chainable(source) {
|
|
106497
|
+
const children = source.getChildren();
|
|
106498
|
+
return children.length === 1 && (children[0].get() instanceof Expressions.FieldChain
|
|
106499
|
+
|| children[0].get() instanceof Expressions.MethodCallChain);
|
|
106500
|
+
}
|
|
106501
|
+
typeMatches(procedure, temp, statement, placement) {
|
|
106502
|
+
const use = placement === Placement.Move ? (0, _procedure_analysis_1.plainMove)(statement) : undefined;
|
|
106503
|
+
if (use !== undefined && !this.noAliasing(procedure, temp.source, use.target)) {
|
|
106504
|
+
return false;
|
|
106505
|
+
}
|
|
106506
|
+
else if (!temp.typed) {
|
|
106507
|
+
// the variable has the type of the expression
|
|
106508
|
+
return true;
|
|
106509
|
+
}
|
|
106510
|
+
const type = temp.variable.identifier.getType();
|
|
106511
|
+
const independent = this.targetIndependent(procedure, temp.source);
|
|
106512
|
+
if (use === undefined) {
|
|
106513
|
+
return independent && this.sameType(procedure, temp, type);
|
|
106514
|
+
}
|
|
106515
|
+
const inline = use.target.findFirstExpression(Expressions.InlineData) !== undefined;
|
|
106516
|
+
if (independent) {
|
|
106517
|
+
if (this.sameType(procedure, temp, type)) {
|
|
106518
|
+
return true;
|
|
106519
|
+
}
|
|
106520
|
+
// an up cast into v, and v into y, is an up cast into y
|
|
106521
|
+
const expression = (0, _procedure_analysis_1.expressionType)(procedure, temp.source);
|
|
106522
|
+
const constructed = this.constructedType(temp.source);
|
|
106523
|
+
const reference = expression === undefined ? (constructed === null || constructed === void 0 ? void 0 : constructed.reference) === true && constructed.name !== "#"
|
|
106524
|
+
: (0, _procedure_analysis_1.isReferenceType)(expression);
|
|
106525
|
+
return inline === false && reference && (0, _procedure_analysis_1.isReferenceType)(type);
|
|
106526
|
+
}
|
|
106527
|
+
// the type of the expression follows the target
|
|
106528
|
+
const target = inline ? undefined : (0, _procedure_analysis_1.targetType)(procedure, use.target);
|
|
106529
|
+
return target !== undefined && (0, _procedure_analysis_1.identicalTypes)(target, type);
|
|
106530
|
+
}
|
|
106531
|
+
/** the expression has exactly the type of the declaration DATA v TYPE t. */
|
|
106532
|
+
sameType(procedure, temp, type) {
|
|
106533
|
+
const expression = (0, _procedure_analysis_1.expressionType)(procedure, temp.source);
|
|
106534
|
+
if (expression !== undefined) {
|
|
106535
|
+
return (0, _procedure_analysis_1.identicalTypes)(expression, type);
|
|
106536
|
+
}
|
|
106537
|
+
// constructor expressions with an explicit type, compared by the name of the type
|
|
106538
|
+
const declared = this.declaredType(temp.variable);
|
|
106539
|
+
const constructed = this.constructedType(temp.source);
|
|
106540
|
+
return declared !== undefined && constructed !== undefined && constructed.name !== "#"
|
|
106541
|
+
&& constructed.name === declared.name && constructed.reference === declared.reference;
|
|
106542
|
+
}
|
|
106543
|
+
/** the type name of DATA v TYPE t., DATA v TYPE REF TO t. or DATA(v) = VALUE t( ). */
|
|
106544
|
+
declaredType(variable) {
|
|
106545
|
+
var _a, _b;
|
|
106546
|
+
const declaration = variable.declaration;
|
|
106547
|
+
if ((0, _procedure_analysis_1.initialDeclaration)(variable) === _procedure_analysis_1.InitialDeclaration.Value) {
|
|
106548
|
+
return this.constructedType((0, _procedure_analysis_1.plainMove)(declaration).source);
|
|
106549
|
+
}
|
|
106550
|
+
const type = (_a = declaration.findDirectExpression(Expressions.DataDefinition)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Type);
|
|
106551
|
+
const name = (_b = type === null || type === void 0 ? void 0 : type.findDirectExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
|
|
106552
|
+
const words = type === null || type === void 0 ? void 0 : type.getTokens().map(t => t.getStr().toUpperCase()).join(" ");
|
|
106553
|
+
if (name === undefined) {
|
|
106554
|
+
return undefined;
|
|
106555
|
+
}
|
|
106556
|
+
else if (words === "TYPE " + name) {
|
|
106557
|
+
return { name, reference: false };
|
|
106558
|
+
}
|
|
106559
|
+
else if (words === "TYPE REF TO " + name) {
|
|
106560
|
+
return { name, reference: true };
|
|
106561
|
+
}
|
|
106562
|
+
return undefined;
|
|
106563
|
+
}
|
|
106564
|
+
/** VALUE t( ... ), CONV t( ... ) etc., NEW c( ... ) and CAST c( ... ) with an explicit type */
|
|
106565
|
+
constructedType(source) {
|
|
106566
|
+
const children = source.getChildren();
|
|
106567
|
+
const last = children[children.length - 1];
|
|
106568
|
+
const keyword = source.getFirstToken().getStr().toUpperCase();
|
|
106569
|
+
let name;
|
|
106570
|
+
let reference = false;
|
|
106571
|
+
if (CONSTRUCTORS.has(keyword) && keyword !== "REF" && last instanceof nodes_1.TokenNode && last.getFirstToken().getStr() === ")") {
|
|
106572
|
+
name = source.findDirectExpression(Expressions.TypeNameOrInfer);
|
|
106573
|
+
}
|
|
106574
|
+
else if (children.length === 1 && children[0].get() instanceof Expressions.MethodCallChain
|
|
106575
|
+
&& children[0].getChildren().length === 1) {
|
|
106576
|
+
const constructor = children[0].getChildren()[0];
|
|
106577
|
+
if (constructor.get() instanceof Expressions.NewObject || constructor.get() instanceof Expressions.Cast) {
|
|
106578
|
+
name = constructor.findDirectExpression(Expressions.TypeNameOrInfer);
|
|
106579
|
+
reference = true;
|
|
106580
|
+
}
|
|
106581
|
+
}
|
|
106582
|
+
const text = name === null || name === void 0 ? void 0 : name.concatTokens().toUpperCase();
|
|
106583
|
+
return text === undefined ? undefined : { name: text, reference };
|
|
106584
|
+
}
|
|
103749
106585
|
/** the type of the expression does not depend on where it is assigned to */
|
|
103750
106586
|
targetIndependent(procedure, source) {
|
|
103751
|
-
var _a, _b;
|
|
106587
|
+
var _a, _b, _c;
|
|
103752
106588
|
const first = source.getFirstToken().getStr().toUpperCase();
|
|
103753
|
-
if (
|
|
106589
|
+
if (this.constant(source)) {
|
|
106590
|
+
return true;
|
|
106591
|
+
}
|
|
106592
|
+
else if (first === "CONV" || first === "EXACT"
|
|
103754
106593
|
|| ((_a = source.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === "#"
|
|
106594
|
+
|| ((_b = this.constructedType(source)) === null || _b === void 0 ? void 0 : _b.name) === "#"
|
|
103755
106595
|
|| source.findFirstExpression(Expressions.ArithOperator) !== undefined
|
|
103756
106596
|
|| source.getTokens().some(t => t.getStr().toUpperCase().startsWith("BIT-"))
|
|
103757
106597
|
|| !this.concatenationOnly(source)) {
|
|
103758
106598
|
return false;
|
|
103759
106599
|
}
|
|
103760
106600
|
for (const call of source.findAllExpressionsRecursive(Expressions.MethodCall)) {
|
|
103761
|
-
const name = (
|
|
106601
|
+
const name = (_c = call.findDirectExpression(Expressions.MethodName)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
|
|
103762
106602
|
if (name === undefined) {
|
|
103763
106603
|
return false;
|
|
103764
106604
|
}
|
|
103765
106605
|
const builtin = procedure.analysis.referencesAt(procedure.file.getFilename(), name)
|
|
103766
106606
|
.some(r => r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference);
|
|
103767
|
-
if (builtin && NUMERIC_FUNCTIONS.has(name.getStr().toLowerCase())) {
|
|
106607
|
+
if (builtin && _procedure_analysis_1.NUMERIC_FUNCTIONS.has(name.getStr().toLowerCase())) {
|
|
103768
106608
|
return false;
|
|
103769
106609
|
}
|
|
103770
106610
|
}
|
|
@@ -107032,14 +109872,17 @@ class UnnecessaryCopy {
|
|
|
107032
109872
|
extendedInformation: `Reports DATA(a) = b. when all of the following hold:
|
|
107033
109873
|
|
|
107034
109874
|
* a is a local variable of a METHOD, FORM or FUNCTION, and has exactly one more reference: a read,
|
|
107035
|
-
which does not take its address, bind a field symbol to it, or pass it to USING
|
|
109875
|
+
which does not take its address, bind a field symbol to it, or pass it to USING or CHANGING
|
|
107036
109876
|
* b is a plain data object: variable, constant, attribute, or a chain of components and attributes,
|
|
107037
109877
|
without calls, offsets, table expressions, field symbols or ->*
|
|
107038
109878
|
* the declaration is executed before the read on every path: the read is in the block of the declaration
|
|
107039
109879
|
or a nested block, and both are in the same loop
|
|
107040
|
-
* b keeps its value from the declaration until the read: for a local b,
|
|
107041
|
-
|
|
107042
|
-
variables, by value parameters and RETURNING in
|
|
109880
|
+
* b keeps its value from the declaration until the read: for a local b, or a pass-by-value or RETURNING
|
|
109881
|
+
parameter b of a method or form, no write to it and its address is never taken; for other b, in addition no
|
|
109882
|
+
method, function or form call and no write except to local variables, by value parameters and RETURNING in
|
|
109883
|
+
between, and in the statement of the read no call before the read. A method called in that statement could
|
|
109884
|
+
change b while it reads the parameter that b is passed to by reference, so the read may only be the receiver
|
|
109885
|
+
of the call, or the actual parameter of a pass-by-value parameter of the only method called in the statement
|
|
107043
109886
|
|
|
107044
109887
|
a has the type of b, so reading b instead does not change any conversion.
|
|
107045
109888
|
A constant b read in IF, ELSEIF, WHILE, CHECK, CASE or WHEN is not reported, see constant_condition.
|
|
@@ -113279,14 +116122,42 @@ exports.ArithOperatorTranspiler = ArithOperatorTranspiler;
|
|
|
113279
116122
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
113280
116123
|
exports.AttributeChainTranspiler = void 0;
|
|
113281
116124
|
const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
116125
|
+
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
113282
116126
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
116127
|
+
const attribute_name_1 = __webpack_require__(/*! ./attribute_name */ "./node_modules/@abaplint/transpiler/build/src/expressions/attribute_name.js");
|
|
113283
116128
|
class AttributeChainTranspiler {
|
|
113284
116129
|
transpile(node, traversal) {
|
|
113285
116130
|
const ret = new chunk_1.Chunk();
|
|
116131
|
+
let arrow = "";
|
|
113286
116132
|
for (const c of node.getChildren()) {
|
|
113287
116133
|
if (c.get() instanceof core_1.Expressions.AttributeName) {
|
|
113288
116134
|
ret.appendChunk(traversal.traverse(c));
|
|
113289
116135
|
}
|
|
116136
|
+
else if (c.get() instanceof core_1.Expressions.ArrowOrDash) {
|
|
116137
|
+
arrow = c.concatTokens();
|
|
116138
|
+
if (arrow === "-" || arrow === "->") {
|
|
116139
|
+
ret.append(".get()", c, traversal);
|
|
116140
|
+
}
|
|
116141
|
+
}
|
|
116142
|
+
else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr() === "*") {
|
|
116143
|
+
ret.append(".dereference()", c, traversal);
|
|
116144
|
+
}
|
|
116145
|
+
else if (c instanceof core_1.Nodes.ExpressionNode && c.get() instanceof core_1.Expressions.ComponentName) {
|
|
116146
|
+
if (arrow === "-") {
|
|
116147
|
+
// structure component
|
|
116148
|
+
const name = c.getFirstToken().getStr().toLowerCase();
|
|
116149
|
+
if (traversal_1.Traversal.isBracketComponent(name)) {
|
|
116150
|
+
ret.append(`["` + name + `"]`, c, traversal);
|
|
116151
|
+
}
|
|
116152
|
+
else {
|
|
116153
|
+
ret.append("." + name, c, traversal);
|
|
116154
|
+
}
|
|
116155
|
+
}
|
|
116156
|
+
else {
|
|
116157
|
+
// attribute of an object, eg. "node->get_first_token( )->start->row"
|
|
116158
|
+
ret.appendString(".").appendChunk(new attribute_name_1.AttributeNameTranspiler().transpile(c, traversal));
|
|
116159
|
+
}
|
|
116160
|
+
}
|
|
113290
116161
|
else {
|
|
113291
116162
|
ret.append("AttributeChainTodo", node, traversal);
|
|
113292
116163
|
}
|
|
@@ -113649,7 +116520,7 @@ class CompareTranspiler {
|
|
|
113649
116520
|
return new chunk_1.Chunk().appendString(pre + "abap.compare.in(").join([s0, s1]).appendString(")");
|
|
113650
116521
|
}
|
|
113651
116522
|
else if (sources.length === 2) {
|
|
113652
|
-
const operator = traversal.traverse(node.
|
|
116523
|
+
const operator = traversal.traverse(node.findDirectExpression(core_1.Expressions.CompareOperator));
|
|
113653
116524
|
const s0 = traversal.traverse(sources[0]);
|
|
113654
116525
|
const s1 = traversal.traverse(sources[1]);
|
|
113655
116526
|
return new chunk_1.Chunk().appendString(pre + "abap.compare.").appendChunk(operator).appendString("(").join([s0, s1]).appendString(")");
|
|
@@ -125079,11 +127950,33 @@ class FieldSymbolTranspiler {
|
|
|
125079
127950
|
if (found === undefined) {
|
|
125080
127951
|
throw new Error("FieldSymbolTranspiler, var not found, \"" + token.getStr() + "\"");
|
|
125081
127952
|
}
|
|
127953
|
+
let type = found.getType();
|
|
127954
|
+
// abaplint types TYPE STANDARD TABLE, SORTED TABLE, HASHED TABLE, INDEX TABLE and
|
|
127955
|
+
// ANY TABLE alike, a generic table without a primary key; the kind is in the statement,
|
|
127956
|
+
// and the runtime needs it to refuse an ASSIGN of a table of another kind
|
|
127957
|
+
const typeTable = node.findDirectExpression(abaplint.Expressions.TypeTable);
|
|
127958
|
+
if (typeTable !== undefined
|
|
127959
|
+
&& type instanceof abaplint.BasicTypes.TableType
|
|
127960
|
+
&& type.getOptions().primaryKey === undefined) {
|
|
127961
|
+
const kind = /^TYPE (STANDARD|SORTED|HASHED|INDEX|ANY) TABLE$/i.exec(typeTable.concatTokens());
|
|
127962
|
+
if (kind !== null) {
|
|
127963
|
+
const options = {
|
|
127964
|
+
...type.getOptions(),
|
|
127965
|
+
primaryKey: {
|
|
127966
|
+
name: "primary_key",
|
|
127967
|
+
type: kind[1].toUpperCase(),
|
|
127968
|
+
keyFields: [],
|
|
127969
|
+
isUnique: false,
|
|
127970
|
+
},
|
|
127971
|
+
};
|
|
127972
|
+
type = new abaplint.BasicTypes.TableType(type.getRowType(), options, type.getQualifiedName());
|
|
127973
|
+
}
|
|
127974
|
+
}
|
|
125082
127975
|
if (name) {
|
|
125083
127976
|
return new chunk_1.Chunk()
|
|
125084
127977
|
.appendString("let ")
|
|
125085
127978
|
.appendString(new field_symbol_1.FieldSymbolTranspiler().transpile(name, traversal).getCode())
|
|
125086
|
-
.appendString(" = new abap.types.FieldSymbol(" + traversal.toType(
|
|
127979
|
+
.appendString(" = new abap.types.FieldSymbol(" + traversal.toType(type) + ");");
|
|
125087
127980
|
}
|
|
125088
127981
|
throw new Error("FieldSymbolTranspiler, name not found");
|
|
125089
127982
|
}
|