@abaplint/cli 2.120.75 → 2.120.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +546 -43
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -24995,6 +24995,12 @@ class BuiltIn {
|
|
|
24995
24995
|
}
|
|
24996
24996
|
return BuiltIn.unnamedArgument.has(name.toUpperCase());
|
|
24997
24997
|
}
|
|
24998
|
+
static returnsArgumentType(name) {
|
|
24999
|
+
if (name === undefined) {
|
|
25000
|
+
return false;
|
|
25001
|
+
}
|
|
25002
|
+
return BuiltIn.argumentTypedReturn.has(name.toUpperCase());
|
|
25003
|
+
}
|
|
24998
25004
|
static isPredicate(name) {
|
|
24999
25005
|
if (name === undefined) {
|
|
25000
25006
|
return undefined;
|
|
@@ -26102,6 +26108,8 @@ BuiltIn.unnamedArgument = new Set([
|
|
|
26102
26108
|
"FRAC", "LINES", "LOG", "LOG10", "NUMOFCHAR", "SIGN", "SIN", "SINH", "SQRT", "STRLEN", "TAN", "TANH",
|
|
26103
26109
|
"TRUNC", "XSTRLEN"
|
|
26104
26110
|
]);
|
|
26111
|
+
// numeric functions returning a value of the type of the argument
|
|
26112
|
+
BuiltIn.argumentTypedReturn = new Set(["ABS", "CEIL", "FLOOR", "FRAC", "SIGN", "TRUNC"]);
|
|
26105
26113
|
//# sourceMappingURL=_builtin.js.map
|
|
26106
26114
|
|
|
26107
26115
|
/***/ },
|
|
@@ -26683,6 +26691,142 @@ exports.CurrentScope = CurrentScope;
|
|
|
26683
26691
|
|
|
26684
26692
|
/***/ },
|
|
26685
26693
|
|
|
26694
|
+
/***/ "../core/build/src/abap/5_syntax/_loop_table_change.js"
|
|
26695
|
+
/*!*************************************************************!*\
|
|
26696
|
+
!*** ../core/build/src/abap/5_syntax/_loop_table_change.js ***!
|
|
26697
|
+
\*************************************************************/
|
|
26698
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
26699
|
+
|
|
26700
|
+
"use strict";
|
|
26701
|
+
|
|
26702
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
26703
|
+
if (k2 === undefined) k2 = k;
|
|
26704
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26705
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26706
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26707
|
+
}
|
|
26708
|
+
Object.defineProperty(o, k2, desc);
|
|
26709
|
+
}) : (function(o, m, k, k2) {
|
|
26710
|
+
if (k2 === undefined) k2 = k;
|
|
26711
|
+
o[k2] = m[k];
|
|
26712
|
+
}));
|
|
26713
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26714
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26715
|
+
}) : function(o, v) {
|
|
26716
|
+
o["default"] = v;
|
|
26717
|
+
});
|
|
26718
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26719
|
+
var ownKeys = function(o) {
|
|
26720
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26721
|
+
var ar = [];
|
|
26722
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26723
|
+
return ar;
|
|
26724
|
+
};
|
|
26725
|
+
return ownKeys(o);
|
|
26726
|
+
};
|
|
26727
|
+
return function (mod) {
|
|
26728
|
+
if (mod && mod.__esModule) return mod;
|
|
26729
|
+
var result = {};
|
|
26730
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
26731
|
+
__setModuleDefault(result, mod);
|
|
26732
|
+
return result;
|
|
26733
|
+
};
|
|
26734
|
+
})();
|
|
26735
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26736
|
+
exports.LoopTableChange = void 0;
|
|
26737
|
+
const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
26738
|
+
const Statements = __importStar(__webpack_require__(/*! ../2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
26739
|
+
const nodes_1 = __webpack_require__(/*! ../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
26740
|
+
const basic_1 = __webpack_require__(/*! ../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
26741
|
+
const _scope_type_1 = __webpack_require__(/*! ./_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
|
|
26742
|
+
const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
26743
|
+
/** In a method, the body of the table an enclosing LOOP AT walks cannot be replaced or freed,
|
|
26744
|
+
* "you cannot access the entire table body in change mode in a loop. If this is known statically,
|
|
26745
|
+
* a syntax error occurs in classes", see the ABAP keyword documentation for LOOP AT itab.
|
|
26746
|
+
* Only tables named directly are handled, a field symbol or a reference is a runtime matter. */
|
|
26747
|
+
class LoopTableChange {
|
|
26748
|
+
constructor() {
|
|
26749
|
+
this.tables = [];
|
|
26750
|
+
}
|
|
26751
|
+
/** returns true if the LOOP structure was pushed, then pop() must be called after it */
|
|
26752
|
+
push(node, scope) {
|
|
26753
|
+
var _a, _b;
|
|
26754
|
+
if (scope.getType() !== _scope_type_1.ScopeType.Method) {
|
|
26755
|
+
return false;
|
|
26756
|
+
}
|
|
26757
|
+
const loop = node.findDirectStatement(Statements.Loop);
|
|
26758
|
+
if (loop === undefined || loop.findDirectExpression(Expressions.LoopGroupBy) !== undefined) {
|
|
26759
|
+
return false;
|
|
26760
|
+
}
|
|
26761
|
+
const chain = (_b = (_a = loop.findDirectExpression(Expressions.LoopSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.SimpleSource2)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.FieldChain);
|
|
26762
|
+
const children = (chain === null || chain === void 0 ? void 0 : chain.getChildren()) || [];
|
|
26763
|
+
if (children.length !== 1 && !(children.length === 2 && children[1].get() instanceof Expressions.TableBody)) {
|
|
26764
|
+
return false;
|
|
26765
|
+
}
|
|
26766
|
+
const found = LoopTableChange.findTable(children[0], scope);
|
|
26767
|
+
if (found === undefined) {
|
|
26768
|
+
return false;
|
|
26769
|
+
}
|
|
26770
|
+
this.tables.push(found);
|
|
26771
|
+
return true;
|
|
26772
|
+
}
|
|
26773
|
+
pop() {
|
|
26774
|
+
this.tables.pop();
|
|
26775
|
+
}
|
|
26776
|
+
check(node, input) {
|
|
26777
|
+
if (this.tables.length === 0 || input.scope.getType() !== _scope_type_1.ScopeType.Method) {
|
|
26778
|
+
return;
|
|
26779
|
+
}
|
|
26780
|
+
// DELETE itab WHERE is not refused, abapGit does it in zcl_abapgit_syntax_xml->order_matches,
|
|
26781
|
+
// SORT is left out, it is not certain that it is checked statically
|
|
26782
|
+
const s = node.get();
|
|
26783
|
+
if (!(s instanceof Statements.Clear)
|
|
26784
|
+
&& !(s instanceof Statements.Free)
|
|
26785
|
+
&& !(s instanceof Statements.Refresh)
|
|
26786
|
+
&& !(s instanceof Statements.Move)) {
|
|
26787
|
+
return;
|
|
26788
|
+
}
|
|
26789
|
+
for (const target of node.findDirectExpressions(Expressions.Target)) {
|
|
26790
|
+
const children = target.getChildren();
|
|
26791
|
+
const body = children.length === 2 && children[1].get() instanceof Expressions.TableBody;
|
|
26792
|
+
if (children.length !== 1 && body === false) {
|
|
26793
|
+
continue;
|
|
26794
|
+
}
|
|
26795
|
+
else if (!(children[0].get() instanceof Expressions.TargetField)) {
|
|
26796
|
+
continue;
|
|
26797
|
+
}
|
|
26798
|
+
const found = LoopTableChange.findTable(children[0], input.scope);
|
|
26799
|
+
if (found === undefined || this.tables.includes(found) === false) {
|
|
26800
|
+
continue;
|
|
26801
|
+
}
|
|
26802
|
+
else if (found.getType().isWithHeader() === true && body === false) {
|
|
26803
|
+
// without [] the statement works on the header line
|
|
26804
|
+
continue;
|
|
26805
|
+
}
|
|
26806
|
+
const message = `"${found.getName()}" cannot be changed as a whole inside a LOOP over it`;
|
|
26807
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
26808
|
+
return;
|
|
26809
|
+
}
|
|
26810
|
+
}
|
|
26811
|
+
static findTable(node, scope) {
|
|
26812
|
+
var _a;
|
|
26813
|
+
if (!(node instanceof nodes_1.ExpressionNode)
|
|
26814
|
+
|| node.getChildren().length !== 1
|
|
26815
|
+
|| !(((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Field)) {
|
|
26816
|
+
return undefined;
|
|
26817
|
+
}
|
|
26818
|
+
const found = scope.findVariable(node.concatTokens());
|
|
26819
|
+
if (found === undefined || !(found.getType() instanceof basic_1.TableType)) {
|
|
26820
|
+
return undefined;
|
|
26821
|
+
}
|
|
26822
|
+
return found;
|
|
26823
|
+
}
|
|
26824
|
+
}
|
|
26825
|
+
exports.LoopTableChange = LoopTableChange;
|
|
26826
|
+
//# sourceMappingURL=_loop_table_change.js.map
|
|
26827
|
+
|
|
26828
|
+
/***/ },
|
|
26829
|
+
|
|
26686
26830
|
/***/ "../core/build/src/abap/5_syntax/_object_oriented.js"
|
|
26687
26831
|
/*!***********************************************************!*\
|
|
26688
26832
|
!*** ../core/build/src/abap/5_syntax/_object_oriented.js ***!
|
|
@@ -29936,6 +30080,99 @@ function checkTextSymbol(source, parameterType, input) {
|
|
|
29936
30080
|
|
|
29937
30081
|
/***/ },
|
|
29938
30082
|
|
|
30083
|
+
/***/ "../core/build/src/abap/5_syntax/expressions/_substring.js"
|
|
30084
|
+
/*!*****************************************************************!*\
|
|
30085
|
+
!*** ../core/build/src/abap/5_syntax/expressions/_substring.js ***!
|
|
30086
|
+
\*****************************************************************/
|
|
30087
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
30088
|
+
|
|
30089
|
+
"use strict";
|
|
30090
|
+
|
|
30091
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30092
|
+
if (k2 === undefined) k2 = k;
|
|
30093
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
30094
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30095
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
30096
|
+
}
|
|
30097
|
+
Object.defineProperty(o, k2, desc);
|
|
30098
|
+
}) : (function(o, m, k, k2) {
|
|
30099
|
+
if (k2 === undefined) k2 = k;
|
|
30100
|
+
o[k2] = m[k];
|
|
30101
|
+
}));
|
|
30102
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
30103
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30104
|
+
}) : function(o, v) {
|
|
30105
|
+
o["default"] = v;
|
|
30106
|
+
});
|
|
30107
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30108
|
+
var ownKeys = function(o) {
|
|
30109
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30110
|
+
var ar = [];
|
|
30111
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30112
|
+
return ar;
|
|
30113
|
+
};
|
|
30114
|
+
return ownKeys(o);
|
|
30115
|
+
};
|
|
30116
|
+
return function (mod) {
|
|
30117
|
+
if (mod && mod.__esModule) return mod;
|
|
30118
|
+
var result = {};
|
|
30119
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30120
|
+
__setModuleDefault(result, mod);
|
|
30121
|
+
return result;
|
|
30122
|
+
};
|
|
30123
|
+
})();
|
|
30124
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30125
|
+
exports.substringType = substringType;
|
|
30126
|
+
exports.isFieldSymbolItself = isFieldSymbolItself;
|
|
30127
|
+
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
30128
|
+
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
30129
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
30130
|
+
// The type of a substring with a static offset or length, used for reading and writing positions.
|
|
30131
|
+
// On a character or byte field of fixed length the substring must lie inside the field, else it is
|
|
30132
|
+
// a syntax error. Other types, a dynamic offset or length and "*" (undefined) are left alone, as is
|
|
30133
|
+
// length 0. The offset is applied first, so the length is compared to what remains after the offset.
|
|
30134
|
+
function substringType(context, offset, length, node, input) {
|
|
30135
|
+
if (!(context instanceof basic_1.CharacterType) && !(context instanceof basic_1.HexType)) {
|
|
30136
|
+
return context;
|
|
30137
|
+
}
|
|
30138
|
+
const fieldLength = context.getLength();
|
|
30139
|
+
if (offset !== undefined && offset > 0) {
|
|
30140
|
+
if (offset >= fieldLength) {
|
|
30141
|
+
const message = `Offset ${offset} is outside the field of length ${fieldLength}`;
|
|
30142
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
30143
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
30144
|
+
}
|
|
30145
|
+
return context instanceof basic_1.CharacterType ? new basic_1.CharacterType(fieldLength - offset) : new basic_1.HexType(fieldLength - offset);
|
|
30146
|
+
}
|
|
30147
|
+
if (length !== undefined && length > 0) {
|
|
30148
|
+
if (length > fieldLength) {
|
|
30149
|
+
const message = `Length ${length} exceeds the remaining length ${fieldLength} of the field`;
|
|
30150
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
30151
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
30152
|
+
}
|
|
30153
|
+
return context instanceof basic_1.CharacterType ? new basic_1.CharacterType(length) : new basic_1.HexType(length);
|
|
30154
|
+
}
|
|
30155
|
+
return context;
|
|
30156
|
+
}
|
|
30157
|
+
// A field symbol typed "c" or "x" is generic, but its type is represented with length 1, so the
|
|
30158
|
+
// offset or length at "index" is not checked when it directly follows the field symbol
|
|
30159
|
+
function isFieldSymbolItself(children, index) {
|
|
30160
|
+
var _a;
|
|
30161
|
+
const first = (_a = children[0]) === null || _a === void 0 ? void 0 : _a.get();
|
|
30162
|
+
if (!(first instanceof Expressions.SourceFieldSymbol) && !(first instanceof Expressions.TargetFieldSymbol)) {
|
|
30163
|
+
return false;
|
|
30164
|
+
}
|
|
30165
|
+
for (let i = 1; i < index; i++) {
|
|
30166
|
+
if (!(children[i].get() instanceof Expressions.FieldOffset)) {
|
|
30167
|
+
return false;
|
|
30168
|
+
}
|
|
30169
|
+
}
|
|
30170
|
+
return true;
|
|
30171
|
+
}
|
|
30172
|
+
//# sourceMappingURL=_substring.js.map
|
|
30173
|
+
|
|
30174
|
+
/***/ },
|
|
30175
|
+
|
|
29939
30176
|
/***/ "../core/build/src/abap/5_syntax/expressions/attribute_chain.js"
|
|
29940
30177
|
/*!**********************************************************************!*\
|
|
29941
30178
|
!*** ../core/build/src/abap/5_syntax/expressions/attribute_chain.js ***!
|
|
@@ -29991,6 +30228,7 @@ const attribute_name_1 = __webpack_require__(/*! ./attribute_name */ "../core/bu
|
|
|
29991
30228
|
const table_expression_1 = __webpack_require__(/*! ./table_expression */ "../core/build/src/abap/5_syntax/expressions/table_expression.js");
|
|
29992
30229
|
const field_offset_1 = __webpack_require__(/*! ./field_offset */ "../core/build/src/abap/5_syntax/expressions/field_offset.js");
|
|
29993
30230
|
const field_length_1 = __webpack_require__(/*! ./field_length */ "../core/build/src/abap/5_syntax/expressions/field_length.js");
|
|
30231
|
+
const _substring_1 = __webpack_require__(/*! ./_substring */ "../core/build/src/abap/5_syntax/expressions/_substring.js");
|
|
29994
30232
|
class AttributeChain {
|
|
29995
30233
|
static runSyntax(inputContext, node, input, type) {
|
|
29996
30234
|
if (inputContext instanceof void_type_1.VoidType) {
|
|
@@ -30067,25 +30305,11 @@ class AttributeChain {
|
|
|
30067
30305
|
}
|
|
30068
30306
|
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldOffset) {
|
|
30069
30307
|
const offset = field_offset_1.FieldOffset.runSyntax(child, input);
|
|
30070
|
-
|
|
30071
|
-
if (contextType instanceof basic_1.CharacterType) {
|
|
30072
|
-
contextType = new basic_1.CharacterType(contextType.getLength() - offset);
|
|
30073
|
-
}
|
|
30074
|
-
else if (contextType instanceof basic_1.HexType) {
|
|
30075
|
-
contextType = new basic_1.HexType(contextType.getLength() - offset);
|
|
30076
|
-
}
|
|
30077
|
-
}
|
|
30308
|
+
contextType = (0, _substring_1.substringType)(contextType, offset, undefined, child, input);
|
|
30078
30309
|
}
|
|
30079
30310
|
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldLength) {
|
|
30080
30311
|
const length = field_length_1.FieldLength.runSyntax(child, input);
|
|
30081
|
-
|
|
30082
|
-
if (contextType instanceof basic_1.CharacterType) {
|
|
30083
|
-
contextType = new basic_1.CharacterType(length);
|
|
30084
|
-
}
|
|
30085
|
-
else if (contextType instanceof basic_1.HexType) {
|
|
30086
|
-
contextType = new basic_1.HexType(length);
|
|
30087
|
-
}
|
|
30088
|
-
}
|
|
30312
|
+
contextType = (0, _substring_1.substringType)(contextType, undefined, length, child, input);
|
|
30089
30313
|
}
|
|
30090
30314
|
}
|
|
30091
30315
|
return contextType;
|
|
@@ -30381,6 +30605,11 @@ class Compare {
|
|
|
30381
30605
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), initialMessage));
|
|
30382
30606
|
return;
|
|
30383
30607
|
}
|
|
30608
|
+
const predicateMessage = this.checkPredicateOperand(sources, input);
|
|
30609
|
+
if (predicateMessage !== undefined) {
|
|
30610
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), predicateMessage));
|
|
30611
|
+
return;
|
|
30612
|
+
}
|
|
30384
30613
|
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
30385
30614
|
const compareOperator = (_a = node.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
30386
30615
|
if (compareOperator === "CS"
|
|
@@ -30421,6 +30650,31 @@ class Compare {
|
|
|
30421
30650
|
if ((chain === null || chain === void 0 ? void 0 : chain.length) === 4 && chain[0] instanceof nodes_1.TokenNode && (first === "XSDBOOL" || first === "BOOLC")) {
|
|
30422
30651
|
return `Built-in function "${chain[0].getFirstToken().getStr()}" cannot be the operand of IS INITIAL`;
|
|
30423
30652
|
}
|
|
30653
|
+
const name = this.builtinCallName(node.findDirectExpression(Expressions.Source), input);
|
|
30654
|
+
const returning = (_d = (_c = _builtin_1.BuiltIn.searchBuiltin(name)) === null || _c === void 0 ? void 0 : _c.getParameters().getReturning()) === null || _d === void 0 ? void 0 : _d.getType();
|
|
30655
|
+
if (returning instanceof basic_1.StringType || returning instanceof basic_1.CharacterType) {
|
|
30656
|
+
return `Built-in function "${name}" cannot be the operand of IS INITIAL`;
|
|
30657
|
+
}
|
|
30658
|
+
return undefined;
|
|
30659
|
+
}
|
|
30660
|
+
// a predicate function, contains( ) or line_exists( ), is a relational expression and not a value,
|
|
30661
|
+
// it can stand alone as a condition or inside boolc( ) or xsdbool( ), but cannot be an operand of a comparison
|
|
30662
|
+
static checkPredicateOperand(sources, input) {
|
|
30663
|
+
if (input.scope.getOpenABAP()) {
|
|
30664
|
+
return undefined;
|
|
30665
|
+
}
|
|
30666
|
+
for (const source of sources) {
|
|
30667
|
+
const name = this.builtinCallName(source, input);
|
|
30668
|
+
if (_builtin_1.BuiltIn.isPredicate(name) === true) {
|
|
30669
|
+
return `Predicate function "${name}" cannot be the operand of a comparison`;
|
|
30670
|
+
}
|
|
30671
|
+
}
|
|
30672
|
+
return undefined;
|
|
30673
|
+
}
|
|
30674
|
+
// the name of the built-in function when the source is exactly one call of it, not hidden by a method of the same name
|
|
30675
|
+
static builtinCallName(source, input) {
|
|
30676
|
+
var _a;
|
|
30677
|
+
const chain = source === null || source === void 0 ? void 0 : source.getChildren();
|
|
30424
30678
|
if ((chain === null || chain === void 0 ? void 0 : chain.length) !== 1 || !(chain[0] instanceof nodes_1.ExpressionNode) || !(chain[0].get() instanceof Expressions.MethodCallChain)) {
|
|
30425
30679
|
return undefined;
|
|
30426
30680
|
}
|
|
@@ -30428,9 +30682,8 @@ class Compare {
|
|
|
30428
30682
|
if (calls.length !== 1 || !(calls[0] instanceof nodes_1.ExpressionNode) || !(calls[0].get() instanceof Expressions.MethodCall)) {
|
|
30429
30683
|
return undefined;
|
|
30430
30684
|
}
|
|
30431
|
-
const name = (
|
|
30432
|
-
|
|
30433
|
-
if (name === undefined || builtin === undefined) {
|
|
30685
|
+
const name = (_a = calls[0].findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
30686
|
+
if (name === undefined || _builtin_1.BuiltIn.searchBuiltin(name) === undefined) {
|
|
30434
30687
|
return undefined;
|
|
30435
30688
|
}
|
|
30436
30689
|
// a method of the same name hides the built-in function
|
|
@@ -30438,11 +30691,7 @@ class Compare {
|
|
|
30438
30691
|
if (enclosing !== undefined && new _object_oriented_1.ObjectOriented(input.scope).searchMethodName(enclosing, name).method !== undefined) {
|
|
30439
30692
|
return undefined;
|
|
30440
30693
|
}
|
|
30441
|
-
|
|
30442
|
-
if (returning instanceof basic_1.StringType || returning instanceof basic_1.CharacterType) {
|
|
30443
|
-
return `Built-in function "${name}" cannot be the operand of IS INITIAL`;
|
|
30444
|
-
}
|
|
30445
|
-
return undefined;
|
|
30694
|
+
return name;
|
|
30446
30695
|
}
|
|
30447
30696
|
}
|
|
30448
30697
|
exports.Compare = Compare;
|
|
@@ -31672,6 +31921,7 @@ const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */
|
|
|
31672
31921
|
const dereference_1 = __webpack_require__(/*! ./dereference */ "../core/build/src/abap/5_syntax/expressions/dereference.js");
|
|
31673
31922
|
const source_field_symbol_1 = __webpack_require__(/*! ./source_field_symbol */ "../core/build/src/abap/5_syntax/expressions/source_field_symbol.js");
|
|
31674
31923
|
const source_field_1 = __webpack_require__(/*! ./source_field */ "../core/build/src/abap/5_syntax/expressions/source_field.js");
|
|
31924
|
+
const _substring_1 = __webpack_require__(/*! ./_substring */ "../core/build/src/abap/5_syntax/expressions/_substring.js");
|
|
31675
31925
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
31676
31926
|
const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
|
|
31677
31927
|
class FieldChain {
|
|
@@ -31784,24 +32034,14 @@ class FieldChain {
|
|
|
31784
32034
|
}
|
|
31785
32035
|
else if (current.get() instanceof Expressions.FieldOffset && current instanceof nodes_1.ExpressionNode) {
|
|
31786
32036
|
const offset = field_offset_1.FieldOffset.runSyntax(current, input);
|
|
31787
|
-
if (
|
|
31788
|
-
|
|
31789
|
-
context = new basic_1.CharacterType(context.getLength() - offset);
|
|
31790
|
-
}
|
|
31791
|
-
else if (context instanceof basic_1.HexType) {
|
|
31792
|
-
context = new basic_1.HexType(context.getLength() - offset);
|
|
31793
|
-
}
|
|
32037
|
+
if (!(0, _substring_1.isFieldSymbolItself)(children, i)) {
|
|
32038
|
+
context = (0, _substring_1.substringType)(context, offset, undefined, current, input);
|
|
31794
32039
|
}
|
|
31795
32040
|
}
|
|
31796
32041
|
else if (current.get() instanceof Expressions.FieldLength && current instanceof nodes_1.ExpressionNode) {
|
|
31797
32042
|
const length = field_length_1.FieldLength.runSyntax(current, input);
|
|
31798
|
-
if (
|
|
31799
|
-
|
|
31800
|
-
context = new basic_1.CharacterType(length);
|
|
31801
|
-
}
|
|
31802
|
-
else if (context instanceof basic_1.HexType) {
|
|
31803
|
-
context = new basic_1.HexType(length);
|
|
31804
|
-
}
|
|
32043
|
+
if (!(0, _substring_1.isFieldSymbolItself)(children, i)) {
|
|
32044
|
+
context = (0, _substring_1.substringType)(context, undefined, length, current, input);
|
|
31805
32045
|
}
|
|
31806
32046
|
}
|
|
31807
32047
|
prev = current.concatTokens();
|
|
@@ -33235,7 +33475,12 @@ class MethodCallChain {
|
|
|
33235
33475
|
}
|
|
33236
33476
|
const param = current.findDirectExpression(Expressions.MethodCallParam);
|
|
33237
33477
|
if (param && method) {
|
|
33238
|
-
method_call_param_1.MethodCallParam.runSyntax(param, input, method);
|
|
33478
|
+
const argumentType = method_call_param_1.MethodCallParam.runSyntax(param, input, method);
|
|
33479
|
+
if (method instanceof _builtin_1.BuiltInMethod
|
|
33480
|
+
&& _builtin_1.BuiltIn.returnsArgumentType(methodName)
|
|
33481
|
+
&& this.isNumeric(argumentType)) {
|
|
33482
|
+
context = argumentType;
|
|
33483
|
+
}
|
|
33239
33484
|
}
|
|
33240
33485
|
else if (param && context instanceof basic_1.VoidType) {
|
|
33241
33486
|
method_call_param_1.MethodCallParam.runSyntax(param, input, context);
|
|
@@ -33252,6 +33497,16 @@ class MethodCallChain {
|
|
|
33252
33497
|
return context;
|
|
33253
33498
|
}
|
|
33254
33499
|
//////////////////////////////////////
|
|
33500
|
+
static isNumeric(type) {
|
|
33501
|
+
return type instanceof basic_1.IntegerType
|
|
33502
|
+
|| type instanceof basic_1.Integer8Type
|
|
33503
|
+
|| type instanceof basic_1.PackedType
|
|
33504
|
+
|| type instanceof basic_1.FloatType
|
|
33505
|
+
|| type instanceof basic_1.FloatingPointType
|
|
33506
|
+
|| type instanceof basic_1.DecFloatType
|
|
33507
|
+
|| type instanceof basic_1.DecFloat16Type
|
|
33508
|
+
|| type instanceof basic_1.DecFloat34Type;
|
|
33509
|
+
}
|
|
33255
33510
|
static findTop(first, input, targetType) {
|
|
33256
33511
|
var _a;
|
|
33257
33512
|
if (first.get() instanceof Expressions.ClassName) {
|
|
@@ -33349,6 +33604,7 @@ const constant_1 = __webpack_require__(/*! ./constant */ "../core/build/src/abap
|
|
|
33349
33604
|
const _check_offset_length_1 = __webpack_require__(/*! ./_check_offset_length */ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js");
|
|
33350
33605
|
const _check_text_symbol_1 = __webpack_require__(/*! ./_check_text_symbol */ "../core/build/src/abap/5_syntax/expressions/_check_text_symbol.js");
|
|
33351
33606
|
class MethodCallParam {
|
|
33607
|
+
/** returns the type of the unnamed argument, if any */
|
|
33352
33608
|
static runSyntax(node, input, method) {
|
|
33353
33609
|
if (!(node.get() instanceof Expressions.MethodCallParam)) {
|
|
33354
33610
|
const message = "MethodCallParam, unexpected input";
|
|
@@ -33428,6 +33684,7 @@ class MethodCallParam {
|
|
|
33428
33684
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
33429
33685
|
return;
|
|
33430
33686
|
}
|
|
33687
|
+
return sourceType;
|
|
33431
33688
|
}
|
|
33432
33689
|
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.ParameterListS) {
|
|
33433
33690
|
new method_parameters_1.MethodParameters().checkExporting(child, input, method);
|
|
@@ -33440,6 +33697,7 @@ class MethodCallParam {
|
|
|
33440
33697
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
33441
33698
|
return;
|
|
33442
33699
|
}
|
|
33700
|
+
return undefined;
|
|
33443
33701
|
}
|
|
33444
33702
|
}
|
|
33445
33703
|
exports.MethodCallParam = MethodCallParam;
|
|
@@ -36630,6 +36888,7 @@ const table_expression_1 = __webpack_require__(/*! ./table_expression */ "../cor
|
|
|
36630
36888
|
const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js");
|
|
36631
36889
|
const field_length_1 = __webpack_require__(/*! ./field_length */ "../core/build/src/abap/5_syntax/expressions/field_length.js");
|
|
36632
36890
|
const cast_1 = __webpack_require__(/*! ./cast */ "../core/build/src/abap/5_syntax/expressions/cast.js");
|
|
36891
|
+
const _substring_1 = __webpack_require__(/*! ./_substring */ "../core/build/src/abap/5_syntax/expressions/_substring.js");
|
|
36633
36892
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
36634
36893
|
const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
|
|
36635
36894
|
class Target {
|
|
@@ -36737,6 +36996,8 @@ class Target {
|
|
|
36737
36996
|
context = attribute_name_1.AttributeName.runSyntax(context, current, input, type);
|
|
36738
36997
|
}
|
|
36739
36998
|
}
|
|
36999
|
+
// the substring is checked, but the type of the whole field is returned
|
|
37000
|
+
let substring = context;
|
|
36740
37001
|
const offset = node.findDirectExpression(Expressions.FieldOffset);
|
|
36741
37002
|
if (offset) {
|
|
36742
37003
|
if (context instanceof basic_1.XStringType || context instanceof basic_1.StringType) {
|
|
@@ -36744,7 +37005,10 @@ class Target {
|
|
|
36744
37005
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
36745
37006
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
36746
37007
|
}
|
|
36747
|
-
field_offset_1.FieldOffset.runSyntax(offset, input);
|
|
37008
|
+
const value = field_offset_1.FieldOffset.runSyntax(offset, input);
|
|
37009
|
+
if (!(0, _substring_1.isFieldSymbolItself)(children, children.indexOf(offset))) {
|
|
37010
|
+
substring = (0, _substring_1.substringType)(substring, value, undefined, offset, input);
|
|
37011
|
+
}
|
|
36748
37012
|
}
|
|
36749
37013
|
const length = node.findDirectExpression(Expressions.FieldLength);
|
|
36750
37014
|
if (length) {
|
|
@@ -36753,7 +37017,13 @@ class Target {
|
|
|
36753
37017
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
36754
37018
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
36755
37019
|
}
|
|
36756
|
-
field_length_1.FieldLength.runSyntax(length, input);
|
|
37020
|
+
const value = field_length_1.FieldLength.runSyntax(length, input);
|
|
37021
|
+
if (!(0, _substring_1.isFieldSymbolItself)(children, children.indexOf(length))) {
|
|
37022
|
+
substring = (0, _substring_1.substringType)(substring, undefined, value, length, input);
|
|
37023
|
+
}
|
|
37024
|
+
}
|
|
37025
|
+
if (substring instanceof basic_1.VoidType && !(context instanceof basic_1.VoidType)) {
|
|
37026
|
+
return substring;
|
|
36757
37027
|
}
|
|
36758
37028
|
return context;
|
|
36759
37029
|
}
|
|
@@ -45282,6 +45552,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
45282
45552
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
45283
45553
|
exports.ReadTable = void 0;
|
|
45284
45554
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
45555
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
45285
45556
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
45286
45557
|
const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
|
|
45287
45558
|
const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "../core/build/src/abap/5_syntax/expressions/inline_data.js");
|
|
@@ -45290,6 +45561,9 @@ const fstarget_1 = __webpack_require__(/*! ../expressions/fstarget */ "../core/b
|
|
|
45290
45561
|
const component_compare_simple_1 = __webpack_require__(/*! ../expressions/component_compare_simple */ "../core/build/src/abap/5_syntax/expressions/component_compare_simple.js");
|
|
45291
45562
|
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
|
|
45292
45563
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
45564
|
+
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
|
|
45565
|
+
const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
|
|
45566
|
+
const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
|
|
45293
45567
|
class ReadTable {
|
|
45294
45568
|
runSyntax(node, input) {
|
|
45295
45569
|
const concat = node.concatTokens().toUpperCase();
|
|
@@ -45316,6 +45590,11 @@ class ReadTable {
|
|
|
45316
45590
|
const components = node.findDirectExpression(Expressions.ComponentCompareSimple);
|
|
45317
45591
|
if (components !== undefined) {
|
|
45318
45592
|
component_compare_simple_1.ComponentCompareSimple.runSyntax(components, input, rowType);
|
|
45593
|
+
const keyMessage = this.checkKeyOperands(components, input);
|
|
45594
|
+
if (keyMessage !== undefined) {
|
|
45595
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), keyMessage));
|
|
45596
|
+
return;
|
|
45597
|
+
}
|
|
45319
45598
|
}
|
|
45320
45599
|
const indexSource = node.findExpressionAfterToken("INDEX");
|
|
45321
45600
|
if (indexSource) {
|
|
@@ -45411,6 +45690,36 @@ class ReadTable {
|
|
|
45411
45690
|
}
|
|
45412
45691
|
}
|
|
45413
45692
|
}
|
|
45693
|
+
// before 7.40 a WITH [TABLE] KEY operand is not an expression position, a built-in function from 7.02 on
|
|
45694
|
+
// is read as a functional method call there, "method TO_UPPER is unknown" on a system, while
|
|
45695
|
+
// functional methods and the older built-in functions like lines( ) are accepted
|
|
45696
|
+
checkKeyOperands(node, input) {
|
|
45697
|
+
var _a, _b;
|
|
45698
|
+
if (input.scope.getOpenABAP() || (0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v740sp02)) {
|
|
45699
|
+
return undefined;
|
|
45700
|
+
}
|
|
45701
|
+
for (const operand of node.findDirectExpressionsMulti([Expressions.Source, Expressions.SimpleSource4])) {
|
|
45702
|
+
const chain = operand.getChildren();
|
|
45703
|
+
if (chain.length !== 1 || !(chain[0] instanceof nodes_1.ExpressionNode) || !(chain[0].get() instanceof Expressions.MethodCallChain)) {
|
|
45704
|
+
continue;
|
|
45705
|
+
}
|
|
45706
|
+
const calls = chain[0].getChildren();
|
|
45707
|
+
if (calls.length !== 1 || !(calls[0] instanceof nodes_1.ExpressionNode) || !(calls[0].get() instanceof Expressions.MethodCall)) {
|
|
45708
|
+
continue;
|
|
45709
|
+
}
|
|
45710
|
+
const name = (_a = calls[0].findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
45711
|
+
if (name === undefined || ((_b = _builtin_1.BuiltIn.methods[name.toUpperCase()]) === null || _b === void 0 ? void 0 : _b.release) === undefined) {
|
|
45712
|
+
continue;
|
|
45713
|
+
}
|
|
45714
|
+
// a method of the same name hides the built-in function
|
|
45715
|
+
const enclosing = input.scope.findClassDefinition(input.scope.getEnclosingClassName());
|
|
45716
|
+
if (enclosing !== undefined && new _object_oriented_1.ObjectOriented(input.scope).searchMethodName(enclosing, name).method !== undefined) {
|
|
45717
|
+
continue;
|
|
45718
|
+
}
|
|
45719
|
+
return `Built-in function "${name}" cannot be a READ TABLE key operand before 7.40`;
|
|
45720
|
+
}
|
|
45721
|
+
return undefined;
|
|
45722
|
+
}
|
|
45414
45723
|
}
|
|
45415
45724
|
exports.ReadTable = ReadTable;
|
|
45416
45725
|
//# sourceMappingURL=read_table.js.map
|
|
@@ -48298,6 +48607,121 @@ exports.ClassData = ClassData;
|
|
|
48298
48607
|
|
|
48299
48608
|
/***/ },
|
|
48300
48609
|
|
|
48610
|
+
/***/ "../core/build/src/abap/5_syntax/structures/cleanup.js"
|
|
48611
|
+
/*!*************************************************************!*\
|
|
48612
|
+
!*** ../core/build/src/abap/5_syntax/structures/cleanup.js ***!
|
|
48613
|
+
\*************************************************************/
|
|
48614
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
48615
|
+
|
|
48616
|
+
"use strict";
|
|
48617
|
+
|
|
48618
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
48619
|
+
if (k2 === undefined) k2 = k;
|
|
48620
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
48621
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
48622
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
48623
|
+
}
|
|
48624
|
+
Object.defineProperty(o, k2, desc);
|
|
48625
|
+
}) : (function(o, m, k, k2) {
|
|
48626
|
+
if (k2 === undefined) k2 = k;
|
|
48627
|
+
o[k2] = m[k];
|
|
48628
|
+
}));
|
|
48629
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
48630
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
48631
|
+
}) : function(o, v) {
|
|
48632
|
+
o["default"] = v;
|
|
48633
|
+
});
|
|
48634
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
48635
|
+
var ownKeys = function(o) {
|
|
48636
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
48637
|
+
var ar = [];
|
|
48638
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
48639
|
+
return ar;
|
|
48640
|
+
};
|
|
48641
|
+
return ownKeys(o);
|
|
48642
|
+
};
|
|
48643
|
+
return function (mod) {
|
|
48644
|
+
if (mod && mod.__esModule) return mod;
|
|
48645
|
+
var result = {};
|
|
48646
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
48647
|
+
__setModuleDefault(result, mod);
|
|
48648
|
+
return result;
|
|
48649
|
+
};
|
|
48650
|
+
})();
|
|
48651
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
48652
|
+
exports.Cleanup = void 0;
|
|
48653
|
+
const Statements = __importStar(__webpack_require__(/*! ../../2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
48654
|
+
const Structures = __importStar(__webpack_require__(/*! ../../3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
|
|
48655
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
48656
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
48657
|
+
const LOOPS = [
|
|
48658
|
+
Structures.Loop,
|
|
48659
|
+
Structures.LoopAtScreen,
|
|
48660
|
+
Structures.LoopExtract,
|
|
48661
|
+
Structures.Do,
|
|
48662
|
+
Structures.While,
|
|
48663
|
+
Structures.Select,
|
|
48664
|
+
Structures.With,
|
|
48665
|
+
Structures.Provide,
|
|
48666
|
+
];
|
|
48667
|
+
// a CLEANUP block cannot contain statements that statically leave it: RETURN, and EXIT, CONTINUE or CHECK
|
|
48668
|
+
// that do not belong to a loop inside the block, these end a loop outside the TRY or the processing block
|
|
48669
|
+
class Cleanup {
|
|
48670
|
+
static runSyntax(node, input) {
|
|
48671
|
+
if (input.scope.getOpenABAP()) {
|
|
48672
|
+
return;
|
|
48673
|
+
}
|
|
48674
|
+
const body = node.findDirectStructure(Structures.Body);
|
|
48675
|
+
if (body !== undefined) {
|
|
48676
|
+
this.walk(body, false, input);
|
|
48677
|
+
}
|
|
48678
|
+
}
|
|
48679
|
+
static walk(node, inLoop, input) {
|
|
48680
|
+
for (const child of node.getChildren()) {
|
|
48681
|
+
if (child instanceof nodes_1.StructureNode) {
|
|
48682
|
+
const stru = child.get();
|
|
48683
|
+
// a nested CLEANUP block is checked on its own, macro definitions and test injections do not run here
|
|
48684
|
+
if (stru instanceof Structures.Cleanup
|
|
48685
|
+
|| stru instanceof Structures.Define
|
|
48686
|
+
|| stru instanceof Structures.TestInjection) {
|
|
48687
|
+
continue;
|
|
48688
|
+
}
|
|
48689
|
+
this.walk(child, inLoop || LOOPS.some(l => stru instanceof l), input);
|
|
48690
|
+
}
|
|
48691
|
+
else if (child instanceof nodes_1.StatementNode) {
|
|
48692
|
+
const name = this.leavingStatement(child, inLoop);
|
|
48693
|
+
if (name !== undefined) {
|
|
48694
|
+
const message = `${name} cannot leave a CLEANUP block`;
|
|
48695
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
|
|
48696
|
+
}
|
|
48697
|
+
}
|
|
48698
|
+
}
|
|
48699
|
+
}
|
|
48700
|
+
static leavingStatement(node, inLoop) {
|
|
48701
|
+
const s = node.get();
|
|
48702
|
+
if (s instanceof Statements.Return) {
|
|
48703
|
+
return "RETURN";
|
|
48704
|
+
}
|
|
48705
|
+
else if (inLoop === true) {
|
|
48706
|
+
return undefined;
|
|
48707
|
+
}
|
|
48708
|
+
else if (s instanceof Statements.Exit && node.findDirectTokenByText("FROM") === undefined) {
|
|
48709
|
+
return "EXIT";
|
|
48710
|
+
}
|
|
48711
|
+
else if (s instanceof Statements.Continue) {
|
|
48712
|
+
return "CONTINUE";
|
|
48713
|
+
}
|
|
48714
|
+
else if (s instanceof Statements.Check) {
|
|
48715
|
+
return "CHECK";
|
|
48716
|
+
}
|
|
48717
|
+
return undefined;
|
|
48718
|
+
}
|
|
48719
|
+
}
|
|
48720
|
+
exports.Cleanup = Cleanup;
|
|
48721
|
+
//# sourceMappingURL=cleanup.js.map
|
|
48722
|
+
|
|
48723
|
+
/***/ },
|
|
48724
|
+
|
|
48301
48725
|
/***/ "../core/build/src/abap/5_syntax/structures/constants.js"
|
|
48302
48726
|
/*!***************************************************************!*\
|
|
48303
48727
|
!*** ../core/build/src/abap/5_syntax/structures/constants.js ***!
|
|
@@ -49101,6 +49525,7 @@ const type_mesh_1 = __webpack_require__(/*! ./structures/type_mesh */ "../core/b
|
|
|
49101
49525
|
const types_1 = __webpack_require__(/*! ./structures/types */ "../core/build/src/abap/5_syntax/structures/types.js");
|
|
49102
49526
|
const statics_1 = __webpack_require__(/*! ./structures/statics */ "../core/build/src/abap/5_syntax/structures/statics.js");
|
|
49103
49527
|
const constants_1 = __webpack_require__(/*! ./structures/constants */ "../core/build/src/abap/5_syntax/structures/constants.js");
|
|
49528
|
+
const cleanup_1 = __webpack_require__(/*! ./structures/cleanup */ "../core/build/src/abap/5_syntax/structures/cleanup.js");
|
|
49104
49529
|
const class_definition_1 = __webpack_require__(/*! ../types/class_definition */ "../core/build/src/abap/types/class_definition.js");
|
|
49105
49530
|
const interface_definition_1 = __webpack_require__(/*! ../types/interface_definition */ "../core/build/src/abap/types/interface_definition.js");
|
|
49106
49531
|
const delete_memory_1 = __webpack_require__(/*! ./statements/delete_memory */ "../core/build/src/abap/5_syntax/statements/delete_memory.js");
|
|
@@ -49242,6 +49667,7 @@ const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/buil
|
|
|
49242
49667
|
const assert_error_1 = __webpack_require__(/*! ./assert_error */ "../core/build/src/abap/5_syntax/assert_error.js");
|
|
49243
49668
|
const field_group_1 = __webpack_require__(/*! ./statements/field_group */ "../core/build/src/abap/5_syntax/statements/field_group.js");
|
|
49244
49669
|
const stuff_1 = __webpack_require__(/*! ../../stuff */ "../core/build/src/stuff.js");
|
|
49670
|
+
const _loop_table_change_1 = __webpack_require__(/*! ./_loop_table_change */ "../core/build/src/abap/5_syntax/_loop_table_change.js");
|
|
49245
49671
|
// -----------------------------------
|
|
49246
49672
|
const map = {};
|
|
49247
49673
|
function addToMap(handler) {
|
|
@@ -49403,6 +49829,7 @@ class SyntaxLogic {
|
|
|
49403
49829
|
};
|
|
49404
49830
|
this.issues = [];
|
|
49405
49831
|
this.deferred = [];
|
|
49832
|
+
this.loopTables = new _loop_table_change_1.LoopTableChange();
|
|
49406
49833
|
this.reg.getDDICReferences().clear(this.object);
|
|
49407
49834
|
this.reg.getMSAGReferences().clear(this.object);
|
|
49408
49835
|
if (this.object instanceof objects_1.Program && this.object.isInclude()) {
|
|
@@ -49468,6 +49895,9 @@ class SyntaxLogic {
|
|
|
49468
49895
|
this.issues.push(issue);
|
|
49469
49896
|
}
|
|
49470
49897
|
traverse(node) {
|
|
49898
|
+
const loop = node instanceof nodes_1.StructureNode
|
|
49899
|
+
&& node.get() instanceof Structures.Loop
|
|
49900
|
+
&& this.loopTables.push(node, this.scope);
|
|
49471
49901
|
for (const child of node.getChildren()) {
|
|
49472
49902
|
const isStructure = child instanceof nodes_1.StructureNode;
|
|
49473
49903
|
const isStatement = child instanceof nodes_1.StatementNode;
|
|
@@ -49500,6 +49930,9 @@ class SyntaxLogic {
|
|
|
49500
49930
|
this.traverse(child);
|
|
49501
49931
|
}
|
|
49502
49932
|
}
|
|
49933
|
+
if (loop === true) {
|
|
49934
|
+
this.loopTables.pop();
|
|
49935
|
+
}
|
|
49503
49936
|
}
|
|
49504
49937
|
/**
|
|
49505
49938
|
* if this returns true, then the traversal should continue with next child
|
|
@@ -49556,6 +49989,9 @@ class SyntaxLogic {
|
|
|
49556
49989
|
// todo: skipped for now
|
|
49557
49990
|
return true;
|
|
49558
49991
|
}
|
|
49992
|
+
else if (stru instanceof Structures.Cleanup) {
|
|
49993
|
+
cleanup_1.Cleanup.runSyntax(node, input);
|
|
49994
|
+
}
|
|
49559
49995
|
return false;
|
|
49560
49996
|
}
|
|
49561
49997
|
updateScopeStatement(node) {
|
|
@@ -49585,6 +50021,7 @@ class SyntaxLogic {
|
|
|
49585
50021
|
this.scope.addIdentifier(new data_2.Data().runSyntax(node, input));
|
|
49586
50022
|
return;
|
|
49587
50023
|
}
|
|
50024
|
+
this.loopTables.check(node, input);
|
|
49588
50025
|
const name = s.constructor.name;
|
|
49589
50026
|
if (map[name]) {
|
|
49590
50027
|
map[name].runSyntax(node, input);
|
|
@@ -70942,7 +71379,7 @@ class Registry {
|
|
|
70942
71379
|
}
|
|
70943
71380
|
static abaplintVersion() {
|
|
70944
71381
|
// magic, see build script "version.js"
|
|
70945
|
-
return "2.120.
|
|
71382
|
+
return "2.120.76";
|
|
70946
71383
|
}
|
|
70947
71384
|
getDDICReferences() {
|
|
70948
71385
|
return this.ddicReferences;
|
|
@@ -97440,6 +97877,9 @@ text = text.`,
|
|
|
97440
97877
|
else if (child.get() instanceof Expressions.Constant) {
|
|
97441
97878
|
context = this.infer(context, constant_1.Constant.runSyntax(child));
|
|
97442
97879
|
}
|
|
97880
|
+
else if (child.get() instanceof Expressions.StringTemplate) {
|
|
97881
|
+
context = basic_1.StringType.get();
|
|
97882
|
+
}
|
|
97443
97883
|
else if (child.get() instanceof Expressions.Source) {
|
|
97444
97884
|
context = this.infer(context, this.sourceType(child, scope));
|
|
97445
97885
|
}
|
|
@@ -104278,7 +104718,16 @@ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/ex
|
|
|
104278
104718
|
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
104279
104719
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
104280
104720
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
104721
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
104722
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
104723
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
104724
|
+
const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
|
|
104281
104725
|
class UseMessageClassConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
104726
|
+
constructor() {
|
|
104727
|
+
super(...arguments);
|
|
104728
|
+
/** Allow MESSAGE with an object reference, eg. an exception, like MESSAGE lx_error TYPE 'E' */
|
|
104729
|
+
this.allowExceptions = true;
|
|
104730
|
+
}
|
|
104282
104731
|
}
|
|
104283
104732
|
exports.UseMessageClassConf = UseMessageClassConf;
|
|
104284
104733
|
class UseMessageClass extends _abap_rule_1.ABAPRule {
|
|
@@ -104291,6 +104740,9 @@ class UseMessageClass extends _abap_rule_1.ABAPRule {
|
|
|
104291
104740
|
key: "use_message_class",
|
|
104292
104741
|
title: "Use message class",
|
|
104293
104742
|
shortDescription: `Define messages in SE91 instead of using inline text or variables`,
|
|
104743
|
+
extendedInformation: `If allowExceptions is enabled, MESSAGE with an object reference is allowed, eg. MESSAGE lx_error TYPE 'E'.
|
|
104744
|
+
|
|
104745
|
+
Void types are only allowed if the type name contains "CX_", as void class references cannot be distinguished from other void types.`,
|
|
104294
104746
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
104295
104747
|
badExample: `MESSAGE 'Something went wrong' TYPE 'E'.`,
|
|
104296
104748
|
goodExample: `MESSAGE e001(bc_msg).`,
|
|
@@ -104302,13 +104754,14 @@ class UseMessageClass extends _abap_rule_1.ABAPRule {
|
|
|
104302
104754
|
setConfig(conf) {
|
|
104303
104755
|
this.conf = conf;
|
|
104304
104756
|
}
|
|
104305
|
-
runParsed(file,
|
|
104757
|
+
runParsed(file, obj) {
|
|
104306
104758
|
const structure = file.getStructure();
|
|
104307
104759
|
if (structure === undefined) {
|
|
104308
104760
|
return [];
|
|
104309
104761
|
}
|
|
104310
104762
|
const issues = [];
|
|
104311
104763
|
const key = this.getMetadata().key;
|
|
104764
|
+
let syntax = undefined;
|
|
104312
104765
|
for (const statement of structure.findAllStatements(Statements.Message)) {
|
|
104313
104766
|
// The parser populates MessageSource only for the class-based forms (e001(bc_msg) or ID/TYPE/NUMBER).
|
|
104314
104767
|
// The text form (MESSAGE <source> TYPE <source>) uses MessageSourceSource directly with no MessageSource child.
|
|
@@ -104316,10 +104769,60 @@ class UseMessageClass extends _abap_rule_1.ABAPRule {
|
|
|
104316
104769
|
if (statement.findDirectExpression(Expressions.MessageSource) !== undefined) {
|
|
104317
104770
|
continue;
|
|
104318
104771
|
}
|
|
104772
|
+
if (this.conf.allowExceptions === true) {
|
|
104773
|
+
syntax !== null && syntax !== void 0 ? syntax : (syntax = new syntax_1.SyntaxLogic(this.reg, obj).run());
|
|
104774
|
+
if (this.isObjectReference(statement, file, syntax)) {
|
|
104775
|
+
continue;
|
|
104776
|
+
}
|
|
104777
|
+
}
|
|
104319
104778
|
issues.push(issue_1.Issue.atStatement(file, statement, "Use a message class (SE91) instead of inline text or variable", key, this.conf.severity));
|
|
104320
104779
|
}
|
|
104321
104780
|
return issues;
|
|
104322
104781
|
}
|
|
104782
|
+
isObjectReference(statement, file, syntax) {
|
|
104783
|
+
var _a, _b;
|
|
104784
|
+
const chain = (_b = (_a = statement.findDirectExpression(Expressions.MessageSourceSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.FieldChain);
|
|
104785
|
+
if (chain === undefined) {
|
|
104786
|
+
return false;
|
|
104787
|
+
}
|
|
104788
|
+
let type = undefined;
|
|
104789
|
+
for (const child of chain.getChildren()) {
|
|
104790
|
+
const c = child.get();
|
|
104791
|
+
if (c instanceof Expressions.ComponentName) {
|
|
104792
|
+
type = type instanceof basic_1.StructureType ? type.getComponentByName(child.concatTokens()) : undefined;
|
|
104793
|
+
}
|
|
104794
|
+
else if (c instanceof Expressions.SourceField
|
|
104795
|
+
|| c instanceof Expressions.SourceFieldSymbol
|
|
104796
|
+
|| c instanceof Expressions.AttributeName) {
|
|
104797
|
+
type = this.findType(child.getFirstToken().getStart(), file, syntax);
|
|
104798
|
+
}
|
|
104799
|
+
else if (c instanceof Expressions.ClassName
|
|
104800
|
+
|| c instanceof tokens_1.InstanceArrow
|
|
104801
|
+
|| c instanceof tokens_1.StaticArrow
|
|
104802
|
+
|| c instanceof tokens_1.Dash) {
|
|
104803
|
+
continue;
|
|
104804
|
+
}
|
|
104805
|
+
else {
|
|
104806
|
+
return false;
|
|
104807
|
+
}
|
|
104808
|
+
if (type === undefined) {
|
|
104809
|
+
return false;
|
|
104810
|
+
}
|
|
104811
|
+
}
|
|
104812
|
+
// void class references cannot be distinguished from other void types, guess based on the name
|
|
104813
|
+
return type instanceof basic_1.ObjectReferenceType
|
|
104814
|
+
|| type instanceof basic_1.GenericObjectReferenceType
|
|
104815
|
+
|| (type instanceof basic_1.VoidType && /CX_/i.test(type.getVoided() || ""));
|
|
104816
|
+
}
|
|
104817
|
+
findType(start, file, syntax) {
|
|
104818
|
+
const scope = syntax.spaghetti.lookupPosition(start, file.getFilename());
|
|
104819
|
+
for (const r of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
|
|
104820
|
+
if (r.position.getStart().equals(start) && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {
|
|
104821
|
+
return r.resolved.getType();
|
|
104822
|
+
}
|
|
104823
|
+
}
|
|
104824
|
+
return undefined;
|
|
104825
|
+
}
|
|
104323
104826
|
}
|
|
104324
104827
|
exports.UseMessageClass = UseMessageClass;
|
|
104325
104828
|
//# sourceMappingURL=use_message_class.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.76",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.120.
|
|
42
|
+
"@abaplint/core": "^2.120.76",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|