@abaplint/cli 2.120.112 → 2.120.114
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 +627 -64
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -6640,7 +6640,7 @@ exports.MethodName = void 0;
|
|
|
6640
6640
|
const combi_1 = __webpack_require__(/*! ../combi */ "../core/build/src/abap/2_statements/combi.js");
|
|
6641
6641
|
class MethodName extends combi_1.Expression {
|
|
6642
6642
|
getRunnable() {
|
|
6643
|
-
return (0, combi_1.regex)(
|
|
6643
|
+
return (0, combi_1.regex)(/^!?(\/\w+\/)?\w+(~\w+)?$/);
|
|
6644
6644
|
}
|
|
6645
6645
|
}
|
|
6646
6646
|
exports.MethodName = MethodName;
|
|
@@ -26273,7 +26273,7 @@ class BuiltInCall {
|
|
|
26273
26273
|
}
|
|
26274
26274
|
static callName(call) {
|
|
26275
26275
|
var _a;
|
|
26276
|
-
return (_a = call.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
26276
|
+
return (_a = call.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.concatTokens().replace(/^!/, "");
|
|
26277
26277
|
}
|
|
26278
26278
|
static isNumeric(call) {
|
|
26279
26279
|
var _a, _b, _c;
|
|
@@ -28297,6 +28297,28 @@ var ReferenceType;
|
|
|
28297
28297
|
|
|
28298
28298
|
/***/ },
|
|
28299
28299
|
|
|
28300
|
+
/***/ "../core/build/src/abap/5_syntax/_reserved_names.js"
|
|
28301
|
+
/*!**********************************************************!*\
|
|
28302
|
+
!*** ../core/build/src/abap/5_syntax/_reserved_names.js ***!
|
|
28303
|
+
\**********************************************************/
|
|
28304
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
28305
|
+
|
|
28306
|
+
"use strict";
|
|
28307
|
+
|
|
28308
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
28309
|
+
exports.checkReservedName = checkReservedName;
|
|
28310
|
+
const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
28311
|
+
/** "me" is the self reference in classes, it cannot be declared as a parameter, attribute or variable */
|
|
28312
|
+
function checkReservedName(token, input) {
|
|
28313
|
+
if (token === undefined || token.getStr().toLowerCase() !== "me" || input.scope.isAnyOO() === false) {
|
|
28314
|
+
return;
|
|
28315
|
+
}
|
|
28316
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, "\"me\" is a reserved name, it cannot be declared"));
|
|
28317
|
+
}
|
|
28318
|
+
//# sourceMappingURL=_reserved_names.js.map
|
|
28319
|
+
|
|
28320
|
+
/***/ },
|
|
28321
|
+
|
|
28300
28322
|
/***/ "../core/build/src/abap/5_syntax/_scope_type.js"
|
|
28301
28323
|
/*!******************************************************!*\
|
|
28302
28324
|
!*** ../core/build/src/abap/5_syntax/_scope_type.js ***!
|
|
@@ -29981,11 +30003,59 @@ class BasicTypes {
|
|
|
29981
30003
|
}
|
|
29982
30004
|
cloneType(type, qualifiedName) {
|
|
29983
30005
|
// nested types(containing "-") will inherit the qualified names if possible
|
|
29984
|
-
// todo, this needs to be extended to all AbstractTypes
|
|
29985
|
-
if (
|
|
29986
|
-
|
|
29987
|
-
|
|
29988
|
-
|
|
30006
|
+
// todo, this needs to be extended to all AbstractTypes
|
|
30007
|
+
if (!qualifiedName || qualifiedName.includes("-") === true) {
|
|
30008
|
+
return type;
|
|
30009
|
+
}
|
|
30010
|
+
// TYPES creates a new type, it is no longer the DDIC type
|
|
30011
|
+
const data = Object.assign(Object.assign({}, type.getAbstractTypeData()), { qualifiedName, ddicName: undefined });
|
|
30012
|
+
if (type instanceof basic_1.CharacterType) {
|
|
30013
|
+
type = new basic_1.CharacterType(type.getLength(), data);
|
|
30014
|
+
}
|
|
30015
|
+
else if (type instanceof Types.IntegerType) {
|
|
30016
|
+
type = Types.IntegerType.get(data);
|
|
30017
|
+
}
|
|
30018
|
+
else if (type instanceof Types.StringType) {
|
|
30019
|
+
type = Types.StringType.get(data);
|
|
30020
|
+
}
|
|
30021
|
+
else if (type instanceof Types.XStringType) {
|
|
30022
|
+
type = Types.XStringType.get(data);
|
|
30023
|
+
}
|
|
30024
|
+
else if (type instanceof Types.Integer8Type) {
|
|
30025
|
+
type = new Types.Integer8Type(data);
|
|
30026
|
+
}
|
|
30027
|
+
else if (type instanceof Types.NumericType) {
|
|
30028
|
+
type = new Types.NumericType(type.getLength(), data);
|
|
30029
|
+
}
|
|
30030
|
+
else if (type instanceof Types.HexType) {
|
|
30031
|
+
type = new Types.HexType(type.getLength(), data);
|
|
30032
|
+
}
|
|
30033
|
+
else if (type instanceof Types.FloatingPointType) {
|
|
30034
|
+
type = new Types.FloatingPointType(type.getLength(), data);
|
|
30035
|
+
}
|
|
30036
|
+
else if (type instanceof Types.DateType) {
|
|
30037
|
+
type = new Types.DateType(data);
|
|
30038
|
+
}
|
|
30039
|
+
else if (type instanceof Types.TimeType) {
|
|
30040
|
+
type = new Types.TimeType(data);
|
|
30041
|
+
}
|
|
30042
|
+
else if (type instanceof Types.PackedType) {
|
|
30043
|
+
type = new Types.PackedType(type.getLength(), type.getDecimals(), data);
|
|
30044
|
+
}
|
|
30045
|
+
else if (type instanceof Types.DecFloat16Type) {
|
|
30046
|
+
type = new Types.DecFloat16Type(data);
|
|
30047
|
+
}
|
|
30048
|
+
else if (type instanceof Types.DecFloat34Type) {
|
|
30049
|
+
type = new Types.DecFloat34Type(data);
|
|
30050
|
+
}
|
|
30051
|
+
else if (type instanceof Types.UTCLongType) {
|
|
30052
|
+
type = new Types.UTCLongType(data);
|
|
30053
|
+
}
|
|
30054
|
+
else if (type instanceof basic_1.StructureType) {
|
|
30055
|
+
type = new basic_1.StructureType(type.getComponents().slice(), qualifiedName, undefined, type.getDescription());
|
|
30056
|
+
}
|
|
30057
|
+
else if (type instanceof basic_1.TableType) {
|
|
30058
|
+
type = new basic_1.TableType(type.getRowType(), type.getOptions(), qualifiedName, type.getDescription());
|
|
29989
30059
|
}
|
|
29990
30060
|
return type;
|
|
29991
30061
|
}
|
|
@@ -30317,6 +30387,10 @@ class BasicTypes {
|
|
|
30317
30387
|
if (type === undefined) {
|
|
30318
30388
|
return new Types.UnknownType("Type error, could not resolve \"" + name + "\", parseType");
|
|
30319
30389
|
}
|
|
30390
|
+
// generic tables are reported via DataReference.isGeneric()
|
|
30391
|
+
if (type.isGeneric() === true && !(type instanceof basic_1.TableType)) {
|
|
30392
|
+
throw new Error("LIKE REF TO not possible, \"" + name + "\" is generic");
|
|
30393
|
+
}
|
|
30320
30394
|
return new Types.DataReference(type, name);
|
|
30321
30395
|
}
|
|
30322
30396
|
else if (text === "TYPE STANDARD TABLE"
|
|
@@ -30820,15 +30894,23 @@ class BasicTypes {
|
|
|
30820
30894
|
checkLengthDecimals(node, text) {
|
|
30821
30895
|
const length = node.findDirectExpression(Expressions.Length);
|
|
30822
30896
|
const decimals = node.findDirectExpression(Expressions.Decimals);
|
|
30823
|
-
|
|
30897
|
+
const fieldLength = node.get() instanceof Statements.Parameter
|
|
30898
|
+
? undefined : node.findDirectExpression(Expressions.ConstantFieldLength);
|
|
30899
|
+
if (length === undefined && decimals === undefined && fieldLength === undefined) {
|
|
30824
30900
|
return undefined;
|
|
30825
30901
|
}
|
|
30826
30902
|
else if (text.startsWith("LIKE")) {
|
|
30827
|
-
if (decimals === undefined) {
|
|
30903
|
+
if (decimals === undefined && fieldLength === undefined) {
|
|
30828
30904
|
return undefined;
|
|
30829
30905
|
}
|
|
30830
30906
|
const message = "When referencing another field (with LIKE), type and length cannot be changed";
|
|
30831
|
-
return (0, _syntax_input_1.syntaxIssue)(this.input, decimals.getFirstToken(), message);
|
|
30907
|
+
return (0, _syntax_input_1.syntaxIssue)(this.input, (decimals !== null && decimals !== void 0 ? decimals : node).getFirstToken(), message);
|
|
30908
|
+
}
|
|
30909
|
+
if (fieldLength !== undefined) {
|
|
30910
|
+
const fieldLengthIssue = this.checkFieldLength(node, text);
|
|
30911
|
+
if (fieldLengthIssue !== undefined) {
|
|
30912
|
+
return fieldLengthIssue;
|
|
30913
|
+
}
|
|
30832
30914
|
}
|
|
30833
30915
|
const builtin = text.startsWith("TYPE") ? text.substring(4).trim() : "";
|
|
30834
30916
|
if (length !== undefined && ["C", "N", "X", "P"].includes(builtin) === false) {
|
|
@@ -30839,6 +30921,32 @@ class BasicTypes {
|
|
|
30839
30921
|
}
|
|
30840
30922
|
return undefined;
|
|
30841
30923
|
}
|
|
30924
|
+
// the length in brackets, "DATA foo(8) TYPE d", as a system checks it: c, n, x and p take any length,
|
|
30925
|
+
// d, t and f only their own length, i any length. Their allowed lengths are ignored with a warning,
|
|
30926
|
+
// which is an error in classes and interfaces. Any other type is an error
|
|
30927
|
+
checkFieldLength(node, text) {
|
|
30928
|
+
var _a;
|
|
30929
|
+
const typeNameExpression = node.findFirstExpression(Expressions.TypeName);
|
|
30930
|
+
const typeName = (_a = typeNameExpression === null || typeNameExpression === void 0 ? void 0 : typeNameExpression.concatTokens().toUpperCase()) !== null && _a !== void 0 ? _a : "";
|
|
30931
|
+
if (typeNameExpression === undefined
|
|
30932
|
+
|| text.includes(" REF TO ")
|
|
30933
|
+
|| ["C", "N", "X", "P"].includes(typeName)) {
|
|
30934
|
+
return undefined;
|
|
30935
|
+
}
|
|
30936
|
+
const token = typeNameExpression.getFirstToken();
|
|
30937
|
+
const ownLength = { "D": 8, "T": 6, "F": 8 };
|
|
30938
|
+
if (ownLength[typeName] !== undefined) {
|
|
30939
|
+
const length = this.findLength(node);
|
|
30940
|
+
if (length !== undefined && length !== ownLength[typeName]) {
|
|
30941
|
+
const message = "Type \"" + typeName + "\" can only have the specified length \"" + ownLength[typeName] + "\" or no length specified at all";
|
|
30942
|
+
return (0, _syntax_input_1.syntaxIssue)(this.input, token, message);
|
|
30943
|
+
}
|
|
30944
|
+
}
|
|
30945
|
+
if ((ownLength[typeName] !== undefined || typeName === "I") && this.input.scope.isAnyOO() === false) {
|
|
30946
|
+
return undefined;
|
|
30947
|
+
}
|
|
30948
|
+
return (0, _syntax_input_1.syntaxIssue)(this.input, token, "Lengths specified in combination with type \"" + typeName + "\" are ignored");
|
|
30949
|
+
}
|
|
30842
30950
|
findDecimals(node) {
|
|
30843
30951
|
var _a, _b, _c;
|
|
30844
30952
|
const dec = (_b = (_a = node.findDirectExpression(Expressions.Decimals)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Integer)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
@@ -31117,6 +31225,78 @@ function checkDatabaseWorkArea(node, dbSource, sourceTypes, input) {
|
|
|
31117
31225
|
|
|
31118
31226
|
/***/ },
|
|
31119
31227
|
|
|
31228
|
+
/***/ "../core/build/src/abap/5_syntax/expressions/_check_header_line.js"
|
|
31229
|
+
/*!*************************************************************************!*\
|
|
31230
|
+
!*** ../core/build/src/abap/5_syntax/expressions/_check_header_line.js ***!
|
|
31231
|
+
\*************************************************************************/
|
|
31232
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
31233
|
+
|
|
31234
|
+
"use strict";
|
|
31235
|
+
|
|
31236
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
31237
|
+
if (k2 === undefined) k2 = k;
|
|
31238
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31239
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
31240
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31241
|
+
}
|
|
31242
|
+
Object.defineProperty(o, k2, desc);
|
|
31243
|
+
}) : (function(o, m, k, k2) {
|
|
31244
|
+
if (k2 === undefined) k2 = k;
|
|
31245
|
+
o[k2] = m[k];
|
|
31246
|
+
}));
|
|
31247
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
31248
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
31249
|
+
}) : function(o, v) {
|
|
31250
|
+
o["default"] = v;
|
|
31251
|
+
});
|
|
31252
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31253
|
+
var ownKeys = function(o) {
|
|
31254
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31255
|
+
var ar = [];
|
|
31256
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31257
|
+
return ar;
|
|
31258
|
+
};
|
|
31259
|
+
return ownKeys(o);
|
|
31260
|
+
};
|
|
31261
|
+
return function (mod) {
|
|
31262
|
+
if (mod && mod.__esModule) return mod;
|
|
31263
|
+
var result = {};
|
|
31264
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31265
|
+
__setModuleDefault(result, mod);
|
|
31266
|
+
return result;
|
|
31267
|
+
};
|
|
31268
|
+
})();
|
|
31269
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
31270
|
+
exports.checkHeaderLine = checkHeaderLine;
|
|
31271
|
+
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
31272
|
+
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
31273
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
31274
|
+
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
|
|
31275
|
+
// A table with header line written without [] is the header line, not the table body,
|
|
31276
|
+
// so it cannot be passed to a table typed method parameter. Built-in functions like lines( ) use
|
|
31277
|
+
// the table body, so they are not checked. Returns true if an issue was reported.
|
|
31278
|
+
function checkHeaderLine(source, sourceType, parameterType, method, input) {
|
|
31279
|
+
if (source === undefined
|
|
31280
|
+
|| method instanceof _builtin_1.BuiltInMethod
|
|
31281
|
+
|| !(parameterType instanceof basic_1.TableType)
|
|
31282
|
+
|| !(sourceType instanceof basic_1.TableType)
|
|
31283
|
+
|| sourceType.isWithHeader() === false) {
|
|
31284
|
+
return false;
|
|
31285
|
+
}
|
|
31286
|
+
const chain = source.getChildren().length === 1 ? source.findDirectExpression(Expressions.FieldChain) : undefined;
|
|
31287
|
+
const children = (chain === null || chain === void 0 ? void 0 : chain.getChildren()) || [];
|
|
31288
|
+
if (chain === undefined || children[children.length - 1].get() instanceof Expressions.TableBody) {
|
|
31289
|
+
return false;
|
|
31290
|
+
}
|
|
31291
|
+
const name = chain.concatTokens();
|
|
31292
|
+
const message = `"${name}" is the header line, use "${name}[]" to pass the table body`;
|
|
31293
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, source.getFirstToken(), message));
|
|
31294
|
+
return true;
|
|
31295
|
+
}
|
|
31296
|
+
//# sourceMappingURL=_check_header_line.js.map
|
|
31297
|
+
|
|
31298
|
+
/***/ },
|
|
31299
|
+
|
|
31120
31300
|
/***/ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js"
|
|
31121
31301
|
/*!***************************************************************************!*\
|
|
31122
31302
|
!*** ../core/build/src/abap/5_syntax/expressions/_check_offset_length.js ***!
|
|
@@ -33968,6 +34148,7 @@ const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifie
|
|
|
33968
34148
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
33969
34149
|
const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
33970
34150
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
34151
|
+
const _reserved_names_1 = __webpack_require__(/*! ../_reserved_names */ "../core/build/src/abap/5_syntax/_reserved_names.js");
|
|
33971
34152
|
class InlineData {
|
|
33972
34153
|
static runSyntax(node, input, type) {
|
|
33973
34154
|
var _a;
|
|
@@ -33976,6 +34157,7 @@ class InlineData {
|
|
|
33976
34157
|
const message = "DATA name too long, " + token.getStr();
|
|
33977
34158
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
|
|
33978
34159
|
}
|
|
34160
|
+
(0, _reserved_names_1.checkReservedName)(token, input);
|
|
33979
34161
|
if (token && type) {
|
|
33980
34162
|
if (type instanceof basic_1.CSequenceType || type instanceof basic_1.CLikeType) {
|
|
33981
34163
|
type = basic_1.StringType.get();
|
|
@@ -34808,7 +34990,7 @@ class MethodCallChain {
|
|
|
34808
34990
|
// for built-in methods set className to undefined
|
|
34809
34991
|
const className = context instanceof basic_1.ObjectReferenceType ? context.getIdentifierName() : undefined;
|
|
34810
34992
|
const methodToken = (_a = current.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
34811
|
-
const methodName = methodToken === null || methodToken === void 0 ? void 0 : methodToken.getStr();
|
|
34993
|
+
const methodName = methodToken === null || methodToken === void 0 ? void 0 : methodToken.getStr().replace(/^!/, "");
|
|
34812
34994
|
const def = input.scope.findObjectDefinition(className);
|
|
34813
34995
|
const isSuper = current === children[2]
|
|
34814
34996
|
&& first.get() instanceof Expressions.FieldChain
|
|
@@ -35003,6 +35185,7 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
|
|
|
35003
35185
|
const constant_1 = __webpack_require__(/*! ./constant */ "../core/build/src/abap/5_syntax/expressions/constant.js");
|
|
35004
35186
|
const _check_offset_length_1 = __webpack_require__(/*! ./_check_offset_length */ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js");
|
|
35005
35187
|
const _check_text_symbol_1 = __webpack_require__(/*! ./_check_text_symbol */ "../core/build/src/abap/5_syntax/expressions/_check_text_symbol.js");
|
|
35188
|
+
const _check_header_line_1 = __webpack_require__(/*! ./_check_header_line */ "../core/build/src/abap/5_syntax/expressions/_check_header_line.js");
|
|
35006
35189
|
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
|
|
35007
35190
|
class MethodCallParam {
|
|
35008
35191
|
/** returns the type of the unnamed argument, if any */
|
|
@@ -35080,6 +35263,9 @@ class MethodCallParam {
|
|
|
35080
35263
|
else if ((0, _check_text_symbol_1.checkTextSymbol)(child, targetType, input)) {
|
|
35081
35264
|
return;
|
|
35082
35265
|
}
|
|
35266
|
+
else if ((0, _check_header_line_1.checkHeaderLine)(child, sourceType, targetType, method, input)) {
|
|
35267
|
+
return;
|
|
35268
|
+
}
|
|
35083
35269
|
else if (this.isAssignable(sourceType, targetType, child, method, input) === false) {
|
|
35084
35270
|
const message = "Method parameter type not compatible";
|
|
35085
35271
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
@@ -35343,6 +35529,7 @@ const field_chain_1 = __webpack_require__(/*! ./field_chain */ "../core/build/sr
|
|
|
35343
35529
|
const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
35344
35530
|
const _check_offset_length_1 = __webpack_require__(/*! ./_check_offset_length */ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js");
|
|
35345
35531
|
const _check_text_symbol_1 = __webpack_require__(/*! ./_check_text_symbol */ "../core/build/src/abap/5_syntax/expressions/_check_text_symbol.js");
|
|
35532
|
+
const _check_header_line_1 = __webpack_require__(/*! ./_check_header_line */ "../core/build/src/abap/5_syntax/expressions/_check_header_line.js");
|
|
35346
35533
|
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
|
|
35347
35534
|
function normalizeParameterName(name) {
|
|
35348
35535
|
return name.replace(/^!/, "").toUpperCase();
|
|
@@ -35508,6 +35695,9 @@ class MethodParameters {
|
|
|
35508
35695
|
if ((0, _check_text_symbol_1.checkTextSymbol)(item.source, parameter.getType(), input)) {
|
|
35509
35696
|
return;
|
|
35510
35697
|
}
|
|
35698
|
+
else if ((0, _check_header_line_1.checkHeaderLine)(item.source, item.sourceType, parameter.getType(), method, input)) {
|
|
35699
|
+
return;
|
|
35700
|
+
}
|
|
35511
35701
|
else if (assignable(item.sourceType, parameter.getType(), item.source) === false) {
|
|
35512
35702
|
const message = "Method parameter type not compatible, " + item.name;
|
|
35513
35703
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
@@ -38801,7 +38991,9 @@ class TypeTable {
|
|
|
38801
38991
|
if (type === undefined) {
|
|
38802
38992
|
return new _typed_identifier_1.TypedIdentifier(name, input.filename, new basic_1.UnknownType("TableType, fallback"));
|
|
38803
38993
|
}
|
|
38804
|
-
|
|
38994
|
+
const keys = node.findAllExpressions(Expressions.TypeTableKey);
|
|
38995
|
+
TypeTable.checkUniqueness(keys, type);
|
|
38996
|
+
for (const tt of keys) {
|
|
38805
38997
|
const error = type_table_key_1.TypeTableKey.runSyntax(tt, type);
|
|
38806
38998
|
if (error) {
|
|
38807
38999
|
type = error;
|
|
@@ -38809,6 +39001,24 @@ class TypeTable {
|
|
|
38809
39001
|
}
|
|
38810
39002
|
return new _typed_identifier_1.TypedIdentifier(name, input.filename, type);
|
|
38811
39003
|
}
|
|
39004
|
+
static checkUniqueness(keys, type) {
|
|
39005
|
+
var _a;
|
|
39006
|
+
for (const key of keys) {
|
|
39007
|
+
if (key.concatTokens().toUpperCase().startsWith("WITH UNIQUE EMPTY KEY")) {
|
|
39008
|
+
throw new Error("EMPTY KEY cannot be UNIQUE");
|
|
39009
|
+
}
|
|
39010
|
+
}
|
|
39011
|
+
// the primary key comes first, it is unnamed or named PRIMARY_KEY
|
|
39012
|
+
const first = keys[0];
|
|
39013
|
+
const keyName = (_a = first === null || first === void 0 ? void 0 : first.findDirectExpression(Expressions.Field)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
39014
|
+
if (type instanceof basic_1.TableType
|
|
39015
|
+
&& type.getAccessType() === basic_1.TableAccessType.hashed
|
|
39016
|
+
&& first !== undefined
|
|
39017
|
+
&& (keyName === undefined || keyName === "PRIMARY_KEY")
|
|
39018
|
+
&& first.concatTokens().toUpperCase().startsWith("WITH NON-UNIQUE ")) {
|
|
39019
|
+
throw new Error("HASHED tables cannot have NON-UNIQUE key");
|
|
39020
|
+
}
|
|
39021
|
+
}
|
|
38812
39022
|
}
|
|
38813
39023
|
exports.TypeTable = TypeTable;
|
|
38814
39024
|
//# sourceMappingURL=type_table.js.map
|
|
@@ -41012,6 +41222,7 @@ const data_definition_1 = __webpack_require__(/*! ../expressions/data_definition
|
|
|
41012
41222
|
const unknown_type_1 = __webpack_require__(/*! ../../types/basic/unknown_type */ "../core/build/src/abap/types/basic/unknown_type.js");
|
|
41013
41223
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
41014
41224
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
41225
|
+
const _reserved_names_1 = __webpack_require__(/*! ../_reserved_names */ "../core/build/src/abap/5_syntax/_reserved_names.js");
|
|
41015
41226
|
class ClassData {
|
|
41016
41227
|
runSyntax(node, input) {
|
|
41017
41228
|
const dd = node.findFirstExpression(Expressions.DataDefinition);
|
|
@@ -41020,6 +41231,7 @@ class ClassData {
|
|
|
41020
41231
|
if (found === undefined) {
|
|
41021
41232
|
return undefined;
|
|
41022
41233
|
}
|
|
41234
|
+
(0, _reserved_names_1.checkReservedName)(found.getToken(), input);
|
|
41023
41235
|
if ((found === null || found === void 0 ? void 0 : found.getType().isGeneric()) === true
|
|
41024
41236
|
&& (found === null || found === void 0 ? void 0 : found.getType().containsVoid()) === false) {
|
|
41025
41237
|
const message = "DATA definition cannot be generic, " + found.getName();
|
|
@@ -42414,12 +42626,14 @@ const data_definition_1 = __webpack_require__(/*! ../expressions/data_definition
|
|
|
42414
42626
|
const unknown_type_1 = __webpack_require__(/*! ../../types/basic/unknown_type */ "../core/build/src/abap/types/basic/unknown_type.js");
|
|
42415
42627
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
42416
42628
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
42629
|
+
const _reserved_names_1 = __webpack_require__(/*! ../_reserved_names */ "../core/build/src/abap/5_syntax/_reserved_names.js");
|
|
42417
42630
|
class Data {
|
|
42418
42631
|
runSyntax(node, input) {
|
|
42419
42632
|
const name = node.findFirstExpression(Expressions.DefinitionName);
|
|
42420
42633
|
const dd = node.findFirstExpression(Expressions.DataDefinition);
|
|
42421
42634
|
if (dd) {
|
|
42422
42635
|
const id = data_definition_1.DataDefinition.runSyntax(dd, input);
|
|
42636
|
+
(0, _reserved_names_1.checkReservedName)(id === null || id === void 0 ? void 0 : id.getToken(), input);
|
|
42423
42637
|
if (id && this.isOnlyDigits(id.getName()) && this.allowOnlyDigitsName(node, input) === false) {
|
|
42424
42638
|
const message = "not possible to have a name with only digits";
|
|
42425
42639
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, id.getToken(), message));
|
|
@@ -42701,6 +42915,17 @@ class DeleteInternal {
|
|
|
42701
42915
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
42702
42916
|
return;
|
|
42703
42917
|
}
|
|
42918
|
+
if (targetType instanceof basic_1.TableType && targetType.isWithHeader() === false) {
|
|
42919
|
+
// short forms, "DELETE itab." deletes the current line inside a LOOP, otherwise both use the header line
|
|
42920
|
+
const children = node.getChildren().length;
|
|
42921
|
+
const short = children === 3 && input.inLoop !== true;
|
|
42922
|
+
const shortTable = children === 4 && node.findDirectTokenByText("TABLE") !== undefined;
|
|
42923
|
+
if (short || shortTable) {
|
|
42924
|
+
const message = "Table does not have header line";
|
|
42925
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
42926
|
+
return;
|
|
42927
|
+
}
|
|
42928
|
+
}
|
|
42704
42929
|
if (targetType instanceof basic_1.TableType) {
|
|
42705
42930
|
targetType = targetType.getRowType();
|
|
42706
42931
|
}
|
|
@@ -44794,9 +45019,12 @@ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expr
|
|
|
44794
45019
|
const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
|
|
44795
45020
|
const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "../core/build/src/abap/5_syntax/expressions/dynamic.js");
|
|
44796
45021
|
const database_table_1 = __webpack_require__(/*! ../expressions/database_table */ "../core/build/src/abap/5_syntax/expressions/database_table.js");
|
|
45022
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
45023
|
+
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
44797
45024
|
const _check_database_work_area_1 = __webpack_require__(/*! ../expressions/_check_database_work_area */ "../core/build/src/abap/5_syntax/expressions/_check_database_work_area.js");
|
|
44798
45025
|
class InsertDatabase {
|
|
44799
45026
|
runSyntax(node, input) {
|
|
45027
|
+
var _a;
|
|
44800
45028
|
const sourceTypes = new Map();
|
|
44801
45029
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
44802
45030
|
sourceTypes.set(s, source_1.Source.runSyntax(s, input));
|
|
@@ -44809,6 +45037,15 @@ class InsertDatabase {
|
|
|
44809
45037
|
}
|
|
44810
45038
|
const dbtab = node.findFirstExpression(Expressions.DatabaseTable);
|
|
44811
45039
|
if (dbtab !== undefined) {
|
|
45040
|
+
// "INSERT itab." is the short form for an internal table with header line
|
|
45041
|
+
const localType = node.getChildren().length === 3
|
|
45042
|
+
? (_a = input.scope.findVariable(dbtab.concatTokens())) === null || _a === void 0 ? void 0 : _a.getType()
|
|
45043
|
+
: undefined;
|
|
45044
|
+
if (localType instanceof basic_1.TableType && localType.isWithHeader() === false) {
|
|
45045
|
+
const message = "Table does not have header line";
|
|
45046
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
45047
|
+
return;
|
|
45048
|
+
}
|
|
44812
45049
|
const dbSource = database_table_1.DatabaseTable.runSyntax(dbtab, input);
|
|
44813
45050
|
(0, _check_database_work_area_1.checkDatabaseWorkArea)(node, dbSource, sourceTypes, input);
|
|
44814
45051
|
}
|
|
@@ -44937,7 +45174,7 @@ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/s
|
|
|
44937
45174
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
44938
45175
|
class InsertInternal {
|
|
44939
45176
|
runSyntax(node, input) {
|
|
44940
|
-
var _a;
|
|
45177
|
+
var _a, _b;
|
|
44941
45178
|
let targetType;
|
|
44942
45179
|
const t = node.findDirectExpression(Expressions.Target);
|
|
44943
45180
|
if (t) {
|
|
@@ -45000,9 +45237,21 @@ class InsertInternal {
|
|
|
45000
45237
|
// yea, well, INSERT doesnt convert the values automatically, like everything else?
|
|
45001
45238
|
error = true;
|
|
45002
45239
|
}
|
|
45240
|
+
else if ((sourceType instanceof basic_1.StringType || sourceType instanceof basic_1.CharacterType)
|
|
45241
|
+
&& ((_a = sourceType.getAbstractTypeData()) === null || _a === void 0 ? void 0 : _a.derivedFromConstant) !== true
|
|
45242
|
+
&& (source === null || source === void 0 ? void 0 : source.findDirectExpression(Expressions.Constant)) === undefined
|
|
45243
|
+
&& (targetType instanceof basic_1.IntegerType
|
|
45244
|
+
|| targetType instanceof basic_1.Integer8Type
|
|
45245
|
+
|| targetType instanceof basic_1.PackedType
|
|
45246
|
+
|| targetType instanceof basic_1.FloatType
|
|
45247
|
+
|| targetType instanceof basic_1.DecFloat16Type
|
|
45248
|
+
|| targetType instanceof basic_1.DecFloat34Type)) {
|
|
45249
|
+
// a character-like data object into a table with a numeric row type, no conversion
|
|
45250
|
+
error = true;
|
|
45251
|
+
}
|
|
45003
45252
|
else if (sourceType instanceof basic_1.CharacterType
|
|
45004
45253
|
&& targetType instanceof basic_1.CharacterType
|
|
45005
|
-
&& ((
|
|
45254
|
+
&& ((_b = sourceType.getAbstractTypeData()) === null || _b === void 0 ? void 0 : _b.derivedFromConstant) === true
|
|
45006
45255
|
&& sourceType.getLength() !== targetType.getLength()) {
|
|
45007
45256
|
// character literal of different length than the row type
|
|
45008
45257
|
error = true;
|
|
@@ -46004,6 +46253,13 @@ class ModifyInternal {
|
|
|
46004
46253
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
46005
46254
|
return;
|
|
46006
46255
|
}
|
|
46256
|
+
if (node.findDirectTokenByText("FROM") === undefined
|
|
46257
|
+
&& targetType.isWithHeader() === false) {
|
|
46258
|
+
// short form, the header line is the work area, eg. "MODIFY itab."
|
|
46259
|
+
const message = "Table does not have header line";
|
|
46260
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
46261
|
+
return;
|
|
46262
|
+
}
|
|
46007
46263
|
}
|
|
46008
46264
|
else if (targetType instanceof basic_1.StructureType) {
|
|
46009
46265
|
// it might originate from a TABLES statement
|
|
@@ -50314,7 +50570,7 @@ class Write {
|
|
|
50314
50570
|
const issueCount = input.issues.length;
|
|
50315
50571
|
const type = source_1.Source.runSyntax(s, input);
|
|
50316
50572
|
// "Arithmetic calculation not permitted here" on a system, while abs( x ) or lines( itab ) is fine
|
|
50317
|
-
const call = s === second && issueCount === input.issues.length
|
|
50573
|
+
const call = s === second && issueCount === input.issues.length
|
|
50318
50574
|
? _builtin_call_1.BuiltInCall.fromSource(s, input) : undefined;
|
|
50319
50575
|
if (call !== undefined && _builtin_call_1.BuiltInCall.isNumeric(call) && _builtin_call_1.BuiltInCall.hasDataObjectArgument(call) === false) {
|
|
50320
50576
|
const message = `Numeric function "${_builtin_call_1.BuiltInCall.callName(call)}" in WRITE takes only a single data object as argument`;
|
|
@@ -51766,6 +52022,7 @@ class SyntaxLogic {
|
|
|
51766
52022
|
this.issues = [];
|
|
51767
52023
|
this.deferred = [];
|
|
51768
52024
|
this.loopTables = new _loop_table_change_1.LoopTableChange();
|
|
52025
|
+
this.loopDepth = 0;
|
|
51769
52026
|
this.sortedLines = new _sorted_key_write_1.SortedKeyWrite();
|
|
51770
52027
|
this.reg.getDDICReferences().clear(this.object);
|
|
51771
52028
|
this.reg.getMSAGReferences().clear(this.object);
|
|
@@ -51835,6 +52092,10 @@ class SyntaxLogic {
|
|
|
51835
52092
|
const loop = node instanceof nodes_1.StructureNode
|
|
51836
52093
|
&& node.get() instanceof Structures.Loop
|
|
51837
52094
|
&& this.loopTables.push(node, this.scope);
|
|
52095
|
+
const isLoop = node instanceof nodes_1.StructureNode && node.get() instanceof Structures.Loop;
|
|
52096
|
+
if (isLoop) {
|
|
52097
|
+
this.loopDepth++;
|
|
52098
|
+
}
|
|
51838
52099
|
if (node instanceof nodes_1.StructureNode) {
|
|
51839
52100
|
this.sortedLines.enter(node, this.currentFile.getFilename());
|
|
51840
52101
|
}
|
|
@@ -51883,6 +52144,9 @@ class SyntaxLogic {
|
|
|
51883
52144
|
if (loop === true) {
|
|
51884
52145
|
this.loopTables.pop();
|
|
51885
52146
|
}
|
|
52147
|
+
if (isLoop) {
|
|
52148
|
+
this.loopDepth--;
|
|
52149
|
+
}
|
|
51886
52150
|
if (node instanceof nodes_1.StructureNode && node.get() instanceof Structures.Loop) {
|
|
51887
52151
|
const loopStatement = node.findDirectStatement(Statements.Loop);
|
|
51888
52152
|
if (loopStatement) {
|
|
@@ -51968,6 +52232,7 @@ class SyntaxLogic {
|
|
|
51968
52232
|
filename,
|
|
51969
52233
|
issues: this.issues,
|
|
51970
52234
|
deferred: this.deferred,
|
|
52235
|
+
inLoop: this.loopDepth > 0,
|
|
51971
52236
|
};
|
|
51972
52237
|
// todo, refactor
|
|
51973
52238
|
if (s instanceof Statements.Type) {
|
|
@@ -54164,8 +54429,8 @@ exports.FloatingPointType = void 0;
|
|
|
54164
54429
|
const _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ "../core/build/src/abap/types/basic/_abstract_type.js");
|
|
54165
54430
|
// this is the DDIC floating point type
|
|
54166
54431
|
class FloatingPointType extends _abstract_type_1.AbstractType {
|
|
54167
|
-
constructor(length,
|
|
54168
|
-
super({ qualifiedName:
|
|
54432
|
+
constructor(length, extra) {
|
|
54433
|
+
super(extra === undefined || typeof extra === "string" ? { qualifiedName: extra } : extra);
|
|
54169
54434
|
if (length <= 0) {
|
|
54170
54435
|
throw new Error("Bad LENGTH, Floating Point");
|
|
54171
54436
|
}
|
|
@@ -54241,8 +54506,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
54241
54506
|
exports.HexType = void 0;
|
|
54242
54507
|
const _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ "../core/build/src/abap/types/basic/_abstract_type.js");
|
|
54243
54508
|
class HexType extends _abstract_type_1.AbstractType {
|
|
54244
|
-
constructor(length,
|
|
54245
|
-
super({ qualifiedName:
|
|
54509
|
+
constructor(length, extra) {
|
|
54510
|
+
super(extra === undefined || typeof extra === "string" ? { qualifiedName: extra } : extra);
|
|
54246
54511
|
if (length <= 0) {
|
|
54247
54512
|
throw new Error("Bad LENGTH, Hex");
|
|
54248
54513
|
}
|
|
@@ -54500,8 +54765,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
54500
54765
|
exports.NumericType = void 0;
|
|
54501
54766
|
const _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ "../core/build/src/abap/types/basic/_abstract_type.js");
|
|
54502
54767
|
class NumericType extends _abstract_type_1.AbstractType {
|
|
54503
|
-
constructor(length,
|
|
54504
|
-
super({ qualifiedName:
|
|
54768
|
+
constructor(length, extra) {
|
|
54769
|
+
super(extra === undefined || typeof extra === "string" ? { qualifiedName: extra } : extra);
|
|
54505
54770
|
if (length <= 0) {
|
|
54506
54771
|
throw new Error("Bad LENGTH, Numeric");
|
|
54507
54772
|
}
|
|
@@ -54856,11 +55121,12 @@ var TableKeyType;
|
|
|
54856
55121
|
TableKeyType["empty"] = "EMPTY";
|
|
54857
55122
|
})(TableKeyType || (exports.TableKeyType = TableKeyType = {}));
|
|
54858
55123
|
class TableType extends _abstract_type_1.AbstractType {
|
|
54859
|
-
constructor(rowType, options, qualifiedName, description) {
|
|
55124
|
+
constructor(rowType, options, qualifiedName, description, ddicName) {
|
|
54860
55125
|
var _a;
|
|
54861
55126
|
super({
|
|
54862
55127
|
qualifiedName: qualifiedName,
|
|
54863
55128
|
description: description,
|
|
55129
|
+
ddicName: ddicName,
|
|
54864
55130
|
});
|
|
54865
55131
|
this.rowType = rowType;
|
|
54866
55132
|
this.options = options;
|
|
@@ -57049,6 +57315,7 @@ const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "../core/
|
|
|
57049
57315
|
const identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ "../core/build/src/abap/1_lexer/tokens/identifier.js");
|
|
57050
57316
|
const _scope_type_1 = __webpack_require__(/*! ../5_syntax/_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
|
|
57051
57317
|
const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
57318
|
+
const _reserved_names_1 = __webpack_require__(/*! ../5_syntax/_reserved_names */ "../core/build/src/abap/5_syntax/_reserved_names.js");
|
|
57052
57319
|
// the keywords that can follow a parameter in each section, a plain parameter name is read as them
|
|
57053
57320
|
const KEYWORDS_AFTER = {
|
|
57054
57321
|
"IMPORTING": ["PREFERRED", "EXPORTING", "CHANGING", "RETURNING", "RAISING", "EXCEPTIONS"],
|
|
@@ -57078,7 +57345,6 @@ class MethodParameters {
|
|
|
57078
57345
|
try {
|
|
57079
57346
|
this.parse(node, input, parentName, abstractMethod);
|
|
57080
57347
|
this.checkNameLengths(input);
|
|
57081
|
-
this.checkDuplicateNames();
|
|
57082
57348
|
}
|
|
57083
57349
|
finally {
|
|
57084
57350
|
input.scope.pop(node.getEnd());
|
|
@@ -57215,25 +57481,28 @@ class MethodParameters {
|
|
|
57215
57481
|
}
|
|
57216
57482
|
const returning = node.findFirstExpression(Expressions.MethodDefReturning);
|
|
57217
57483
|
if (returning) {
|
|
57218
|
-
|
|
57484
|
+
const id = method_def_returning_1.MethodDefReturning.runSyntax(returning, input, ["returning" /* IdentifierMeta.MethodReturning */]);
|
|
57485
|
+
if (this.isDuplicateName(id, input) === false) {
|
|
57486
|
+
this.returning = id;
|
|
57487
|
+
}
|
|
57219
57488
|
}
|
|
57220
57489
|
this.workaroundRAP(node, input, parentName);
|
|
57221
57490
|
}
|
|
57222
|
-
|
|
57223
|
-
|
|
57224
|
-
|
|
57225
|
-
|
|
57226
|
-
|
|
57227
|
-
|
|
57228
|
-
}
|
|
57229
|
-
names.add(name);
|
|
57491
|
+
/** reports a parameter with the name of an earlier one, the method definition is kept without it */
|
|
57492
|
+
isDuplicateName(id, input) {
|
|
57493
|
+
const name = id.getName().toUpperCase();
|
|
57494
|
+
if (this.getAll().some(p => p.getName().toUpperCase() === name)) {
|
|
57495
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, id.getToken(), `Method parameter "${name}" already defined`));
|
|
57496
|
+
return true;
|
|
57230
57497
|
}
|
|
57498
|
+
return false;
|
|
57231
57499
|
}
|
|
57232
57500
|
checkNameLengths(input) {
|
|
57233
57501
|
for (const parameter of this.getAll()) {
|
|
57234
57502
|
if (parameter.getName().length > 30) {
|
|
57235
57503
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, parameter.getToken(), "Method parameter name longer than 30 characters"));
|
|
57236
57504
|
}
|
|
57505
|
+
(0, _reserved_names_1.checkReservedName)(parameter.getToken(), input);
|
|
57237
57506
|
}
|
|
57238
57507
|
}
|
|
57239
57508
|
workaroundRAP(node, input, parentName) {
|
|
@@ -57302,7 +57571,8 @@ class MethodParameters {
|
|
|
57302
57571
|
add(target, source, input, meta, abstractMethod) {
|
|
57303
57572
|
var _a;
|
|
57304
57573
|
this.checkKeywordNames(source, input);
|
|
57305
|
-
|
|
57574
|
+
const optionals = source.findAllExpressions(Expressions.MethodParamOptional);
|
|
57575
|
+
for (const opt of optionals) {
|
|
57306
57576
|
const p = opt.findDirectExpression(Expressions.MethodParam);
|
|
57307
57577
|
if (p === undefined) {
|
|
57308
57578
|
continue;
|
|
@@ -57318,11 +57588,19 @@ class MethodParameters {
|
|
|
57318
57588
|
extraMeta.push("abstract" /* IdentifierMeta.Abstract */);
|
|
57319
57589
|
}
|
|
57320
57590
|
const id = method_param_1.MethodParam.runSyntax(p, input, [...meta, ...extraMeta]);
|
|
57591
|
+
if (this.isDuplicateName(id, input)) {
|
|
57592
|
+
continue;
|
|
57593
|
+
}
|
|
57321
57594
|
input.scope.addIdentifier(id);
|
|
57322
57595
|
target.push(id);
|
|
57323
|
-
|
|
57596
|
+
const optionalToken = opt.findDirectTokenByText("OPTIONAL");
|
|
57597
|
+
if (optionalToken) {
|
|
57324
57598
|
const name = target[target.length - 1].getName().toUpperCase();
|
|
57325
57599
|
this.optional.push(name);
|
|
57600
|
+
if (opt.findFirstExpression(Expressions.Default)) {
|
|
57601
|
+
const message = "Parameter \"" + id.getName() + "\" cannot have both DEFAULT and OPTIONAL";
|
|
57602
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, optionalToken, message));
|
|
57603
|
+
}
|
|
57326
57604
|
}
|
|
57327
57605
|
else if (opt.findFirstExpression(Expressions.Default)) {
|
|
57328
57606
|
const name = target[target.length - 1].getName().toUpperCase();
|
|
@@ -57333,13 +57611,16 @@ class MethodParameters {
|
|
|
57333
57611
|
}
|
|
57334
57612
|
}
|
|
57335
57613
|
}
|
|
57336
|
-
if (
|
|
57614
|
+
if (optionals.length > 0) {
|
|
57337
57615
|
return;
|
|
57338
57616
|
}
|
|
57339
57617
|
const params = source.findAllExpressions(Expressions.MethodParam);
|
|
57340
57618
|
for (const param of params) {
|
|
57341
57619
|
const extraMeta = this.isPassByValue(param) ? ["pass_by_value" /* IdentifierMeta.PassByValue */] : [];
|
|
57342
|
-
|
|
57620
|
+
const id = method_param_1.MethodParam.runSyntax(param, input, [...meta, ...extraMeta]);
|
|
57621
|
+
if (this.isDuplicateName(id, input) === false) {
|
|
57622
|
+
target.push(id);
|
|
57623
|
+
}
|
|
57343
57624
|
}
|
|
57344
57625
|
}
|
|
57345
57626
|
// A system reads a plain parameter name as a keyword wherever that keyword can stand, measured on 758:
|
|
@@ -60956,7 +61237,7 @@ class DDIC {
|
|
|
60956
61237
|
if (input.length === undefined) {
|
|
60957
61238
|
return new Types.UnknownType(input.text + " unknown length", input.infoText);
|
|
60958
61239
|
}
|
|
60959
|
-
return new Types.NumericType(parseInt(input.length, 10),
|
|
61240
|
+
return new Types.NumericType(parseInt(input.length, 10), extra);
|
|
60960
61241
|
case "CHAR": // 1 <= len <= 30000 (1333 for table fields)
|
|
60961
61242
|
case "LCHR": // 256 <= len <= 32000
|
|
60962
61243
|
if (input.length === undefined) {
|
|
@@ -60968,10 +61249,10 @@ class DDIC {
|
|
|
60968
61249
|
if (input.length === undefined) {
|
|
60969
61250
|
return new Types.UnknownType(input.text + " unknown length", input.infoText);
|
|
60970
61251
|
}
|
|
60971
|
-
return new Types.HexType(parseInt(input.length, 10),
|
|
61252
|
+
return new Types.HexType(parseInt(input.length, 10), extra);
|
|
60972
61253
|
case "TIMN": // Native HANA
|
|
60973
61254
|
case "TIMS":
|
|
60974
|
-
return new Types.TimeType(
|
|
61255
|
+
return new Types.TimeType(extra); //HHMMSS
|
|
60975
61256
|
case "DECFLOAT16": // len = 16
|
|
60976
61257
|
case "DECFLOAT34": // len = 34
|
|
60977
61258
|
case "D16R": // len = 16
|
|
@@ -60982,25 +61263,25 @@ class DDIC {
|
|
|
60982
61263
|
if (input.length === undefined) {
|
|
60983
61264
|
return new Types.UnknownType(input.text + " unknown length", input.infoText);
|
|
60984
61265
|
}
|
|
60985
|
-
return new Types.FloatingPointType(parseInt(input.length, 10),
|
|
61266
|
+
return new Types.FloatingPointType(parseInt(input.length, 10), extra);
|
|
60986
61267
|
case "DATN": // Native HANA
|
|
60987
61268
|
case "DATS":
|
|
60988
|
-
return new Types.DateType(
|
|
61269
|
+
return new Types.DateType(extra); //YYYYMMDD
|
|
60989
61270
|
case "INT1":
|
|
60990
61271
|
case "INT2":
|
|
60991
61272
|
case "INT4":
|
|
60992
|
-
return Types.IntegerType.get(
|
|
61273
|
+
return Types.IntegerType.get(extra);
|
|
60993
61274
|
case "INT8":
|
|
60994
|
-
return new Types.Integer8Type(
|
|
61275
|
+
return new Types.Integer8Type(extra);
|
|
60995
61276
|
case "SSTR": // 1 <= len <= 1333
|
|
60996
61277
|
case "SSTRING": // 1 <= len <= 1333
|
|
60997
61278
|
case "STRG": // 256 <= len
|
|
60998
61279
|
case "STRING": // 256 <= len
|
|
60999
|
-
return Types.StringType.get(
|
|
61280
|
+
return Types.StringType.get(extra);
|
|
61000
61281
|
case "RSTR": // 256 <= len
|
|
61001
61282
|
case "RAWSTRING": // 256 <= len
|
|
61002
61283
|
case "GEOM_EWKB":
|
|
61003
|
-
return Types.XStringType.get(
|
|
61284
|
+
return Types.XStringType.get(extra);
|
|
61004
61285
|
case "D16S":
|
|
61005
61286
|
case "D34S":
|
|
61006
61287
|
case "DF16_SCL":
|
|
@@ -73180,34 +73461,35 @@ class TableType extends _abstract_object_1.AbstractObject {
|
|
|
73180
73461
|
}
|
|
73181
73462
|
else if (this.parsedXML.rowkind === "S") {
|
|
73182
73463
|
const lookup = ddic.lookupTableOrView(this.parsedXML.rowtype);
|
|
73183
|
-
type = new Types.TableType(lookup.type, tableOptions, this.getName(), this.getDescription());
|
|
73464
|
+
type = new Types.TableType(lookup.type, tableOptions, this.getName(), this.getDescription(), this.getName());
|
|
73184
73465
|
if (lookup.object) {
|
|
73185
73466
|
references.push({ object: lookup.object });
|
|
73186
73467
|
}
|
|
73187
73468
|
}
|
|
73188
73469
|
else if (this.parsedXML.rowkind === "E") {
|
|
73189
73470
|
const lookup = ddic.lookupDataElement(this.parsedXML.rowtype);
|
|
73190
|
-
type = new Types.TableType(lookup.type, tableOptions, this.getName(), this.getDescription());
|
|
73471
|
+
type = new Types.TableType(lookup.type, tableOptions, this.getName(), this.getDescription(), this.getName());
|
|
73191
73472
|
if (lookup.object) {
|
|
73192
73473
|
references.push({ object: lookup.object });
|
|
73193
73474
|
}
|
|
73194
73475
|
}
|
|
73195
73476
|
else if (this.parsedXML.rowkind === "L") {
|
|
73196
73477
|
const lookup = ddic.lookupTableType(this.parsedXML.rowtype);
|
|
73197
|
-
type = new Types.TableType(lookup.type, tableOptions, this.getName(), this.getDescription());
|
|
73478
|
+
type = new Types.TableType(lookup.type, tableOptions, this.getName(), this.getDescription(), this.getName());
|
|
73198
73479
|
if (lookup.object) {
|
|
73199
73480
|
references.push({ object: lookup.object });
|
|
73200
73481
|
}
|
|
73201
73482
|
}
|
|
73202
73483
|
else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "OBJECT") {
|
|
73203
|
-
type = new Types.TableType(new basic_1.GenericObjectReferenceType(), tableOptions, this.getName(), this.getDescription());
|
|
73484
|
+
type = new Types.TableType(new basic_1.GenericObjectReferenceType(), tableOptions, this.getName(), this.getDescription(), this.getName());
|
|
73204
73485
|
}
|
|
73205
73486
|
else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "DATA") {
|
|
73206
|
-
|
|
73487
|
+
const row = new basic_1.DataReference(new Types.DataType());
|
|
73488
|
+
type = new Types.TableType(row, tableOptions, this.getName(), this.getDescription(), this.getName());
|
|
73207
73489
|
}
|
|
73208
73490
|
else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype !== undefined) {
|
|
73209
73491
|
const lookup = ddic.lookupObject(this.parsedXML.rowtype);
|
|
73210
|
-
type = new Types.TableType(lookup.type, tableOptions, this.getName(), this.getDescription());
|
|
73492
|
+
type = new Types.TableType(lookup.type, tableOptions, this.getName(), this.getDescription(), this.getName());
|
|
73211
73493
|
if (lookup.object) {
|
|
73212
73494
|
references.push({ object: lookup.object });
|
|
73213
73495
|
}
|
|
@@ -73223,7 +73505,7 @@ class TableType extends _abstract_object_1.AbstractObject {
|
|
|
73223
73505
|
decimals: this.parsedXML.decimals,
|
|
73224
73506
|
infoText: this.getName(),
|
|
73225
73507
|
});
|
|
73226
|
-
type = new Types.TableType(row, tableOptions, this.getName(), this.getDescription());
|
|
73508
|
+
type = new Types.TableType(row, tableOptions, this.getName(), this.getDescription(), this.getName());
|
|
73227
73509
|
}
|
|
73228
73510
|
}
|
|
73229
73511
|
else {
|
|
@@ -74530,7 +74812,7 @@ class Registry {
|
|
|
74530
74812
|
}
|
|
74531
74813
|
static abaplintVersion() {
|
|
74532
74814
|
// magic, see build script "version.js"
|
|
74533
|
-
return "2.120.
|
|
74815
|
+
return "2.120.114";
|
|
74534
74816
|
}
|
|
74535
74817
|
getDDICReferences() {
|
|
74536
74818
|
return this.ddicReferences;
|
|
@@ -82637,6 +82919,10 @@ class CheckSubrcConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
|
82637
82919
|
this.readTable = true;
|
|
82638
82920
|
this.assign = true;
|
|
82639
82921
|
this.find = true;
|
|
82922
|
+
/** CALL FUNCTION with EXCEPTIONS, unless every exception is mapped to 0 */
|
|
82923
|
+
this.callFunction = true;
|
|
82924
|
+
/** Method call with EXCEPTIONS, unless every exception is mapped to 0 */
|
|
82925
|
+
this.callMethod = true;
|
|
82640
82926
|
}
|
|
82641
82927
|
}
|
|
82642
82928
|
exports.CheckSubrcConf = CheckSubrcConf;
|
|
@@ -82658,7 +82944,17 @@ If sy-dbcnt is checked after database statements, it is considered okay.
|
|
|
82658
82944
|
|
|
82659
82945
|
If IS ASSIGNED is checked after assigning, it is considered okay.
|
|
82660
82946
|
|
|
82661
|
-
FIND statement with MATCH COUNT is considered okay if subrc is not checked
|
|
82947
|
+
FIND statement with MATCH COUNT is considered okay if subrc is not checked
|
|
82948
|
+
|
|
82949
|
+
CALL FUNCTION and method calls are checked if they have an EXCEPTIONS addition that maps an exception to a value other than 0,
|
|
82950
|
+
including CALL FUNCTION DESTINATION and STARTING NEW TASK. Not checked: calls without EXCEPTIONS, calls where every exception
|
|
82951
|
+
is mapped to 0, EXCEPTION-TABLE, CALL FUNCTION IN UPDATE TASK and IN BACKGROUND.
|
|
82952
|
+
For CALL FUNCTION the pragma ##FM_SUBRC_OK is also accepted.
|
|
82953
|
+
|
|
82954
|
+
A call of a method with SUBRC in its name, like check_subrc( ), is considered a check.
|
|
82955
|
+
|
|
82956
|
+
After ELSE, ELSEIF, WHEN, CATCH and CLEANUP the check continues after the end of the block, as these branches are not run
|
|
82957
|
+
after the statement`,
|
|
82662
82958
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
82663
82959
|
pseudoComment: "EC CI_SUBRC",
|
|
82664
82960
|
pragma: "##SUBRC_OK",
|
|
@@ -82683,7 +82979,6 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
|
|
|
82683
82979
|
const config = this.getConfig();
|
|
82684
82980
|
for (let i = 0; i < statements.length; i++) {
|
|
82685
82981
|
const statement = statements[i];
|
|
82686
|
-
// todo: CALL FUNCTION
|
|
82687
82982
|
if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {
|
|
82688
82983
|
continue;
|
|
82689
82984
|
}
|
|
@@ -82769,6 +83064,22 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
|
|
|
82769
83064
|
const fix = this.buildFix(file, statement);
|
|
82770
83065
|
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
|
|
82771
83066
|
}
|
|
83067
|
+
else if (config.callFunction === true
|
|
83068
|
+
&& statement.get() instanceof Statements.CallFunction
|
|
83069
|
+
&& statement.getPragmas().some(t => t.getStr().toUpperCase() === "##FM_SUBRC_OK") === false
|
|
83070
|
+
&& this.isUpdateOrBackgroundTask(statement) === false
|
|
83071
|
+
&& this.mapsExceptionToNonZero(statement) === true
|
|
83072
|
+
&& this.isChecked(i, statements) === false) {
|
|
83073
|
+
const fix = this.buildFix(file, statement);
|
|
83074
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
|
|
83075
|
+
}
|
|
83076
|
+
else if (config.callMethod === true
|
|
83077
|
+
&& statement.get() instanceof Statements.Call
|
|
83078
|
+
&& this.mapsExceptionToNonZero(statement) === true
|
|
83079
|
+
&& this.isChecked(i, statements) === false) {
|
|
83080
|
+
const fix = this.buildFix(file, statement);
|
|
83081
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
|
|
83082
|
+
}
|
|
82772
83083
|
}
|
|
82773
83084
|
return issues;
|
|
82774
83085
|
}
|
|
@@ -82783,6 +83094,22 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
|
|
|
82783
83094
|
}
|
|
82784
83095
|
return false;
|
|
82785
83096
|
}
|
|
83097
|
+
/** true if the EXCEPTIONS addition maps an exception to a value other than 0, then the call sets sy-subrc */
|
|
83098
|
+
mapsExceptionToNonZero(statement) {
|
|
83099
|
+
for (const list of statement.findAllExpressions(Expressions.ParameterListExceptions)) {
|
|
83100
|
+
for (const exception of list.findDirectExpressions(Expressions.ParameterException)) {
|
|
83101
|
+
const value = exception.findDirectExpression(Expressions.Integer);
|
|
83102
|
+
if (value === undefined || parseInt(value.concatTokens().replace(/\s/g, ""), 10) !== 0) {
|
|
83103
|
+
return true;
|
|
83104
|
+
}
|
|
83105
|
+
}
|
|
83106
|
+
}
|
|
83107
|
+
return false;
|
|
83108
|
+
}
|
|
83109
|
+
isUpdateOrBackgroundTask(statement) {
|
|
83110
|
+
const concat = statement.concatTokens().toUpperCase();
|
|
83111
|
+
return concat.includes(" IN UPDATE TASK") || concat.includes(" IN BACKGROUND ");
|
|
83112
|
+
}
|
|
82786
83113
|
isExemptedFind(s) {
|
|
82787
83114
|
// see https://github.com/abaplint/abaplint/issues/2130
|
|
82788
83115
|
return s.concatTokens().toUpperCase().includes(" MATCH COUNT ") === true;
|
|
@@ -82804,6 +83131,28 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
|
|
|
82804
83131
|
}
|
|
82805
83132
|
return false;
|
|
82806
83133
|
}
|
|
83134
|
+
/** index of the end statement that closes the block the statement at index is in */
|
|
83135
|
+
findEnd(index, statements, open, close) {
|
|
83136
|
+
let depth = 0;
|
|
83137
|
+
for (let i = index + 1; i < statements.length; i++) {
|
|
83138
|
+
const statement = statements[i].get();
|
|
83139
|
+
if (open.some(o => statement instanceof o)) {
|
|
83140
|
+
depth++;
|
|
83141
|
+
}
|
|
83142
|
+
else if (statement instanceof close) {
|
|
83143
|
+
if (depth === 0) {
|
|
83144
|
+
return i;
|
|
83145
|
+
}
|
|
83146
|
+
depth--;
|
|
83147
|
+
}
|
|
83148
|
+
}
|
|
83149
|
+
return statements.length;
|
|
83150
|
+
}
|
|
83151
|
+
/** a method call like check_subrc( ), the method reads sy-subrc */
|
|
83152
|
+
callsSubrcMethod(statement) {
|
|
83153
|
+
return statement.get() instanceof Statements.Call
|
|
83154
|
+
&& statement.findAllExpressions(Expressions.MethodName).some(m => m.concatTokens().toUpperCase().includes("SUBRC"));
|
|
83155
|
+
}
|
|
82807
83156
|
isChecked(index, statements) {
|
|
82808
83157
|
var _a, _b;
|
|
82809
83158
|
let assigned = undefined;
|
|
@@ -82823,9 +83172,25 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
|
|
|
82823
83172
|
}
|
|
82824
83173
|
}
|
|
82825
83174
|
else if (statement.get() instanceof Statements.EndIf
|
|
83175
|
+
|| statement.get() instanceof Statements.EndCase
|
|
83176
|
+
|| statement.get() instanceof Statements.EndTry
|
|
82826
83177
|
|| statement.get() instanceof Statements.EndTestSeam) {
|
|
82827
83178
|
continue;
|
|
82828
83179
|
}
|
|
83180
|
+
else if (statement.get() instanceof Statements.Else
|
|
83181
|
+
|| statement.get() instanceof Statements.ElseIf) {
|
|
83182
|
+
// the other branches are not run after this one, continue after ENDIF
|
|
83183
|
+
i = this.findEnd(i, statements, [Statements.If], Statements.EndIf);
|
|
83184
|
+
}
|
|
83185
|
+
else if (statement.get() instanceof Statements.When
|
|
83186
|
+
|| statement.get() instanceof Statements.WhenOthers
|
|
83187
|
+
|| statement.get() instanceof Statements.WhenType) {
|
|
83188
|
+
i = this.findEnd(i, statements, [Statements.Case, Statements.CaseType], Statements.EndCase);
|
|
83189
|
+
}
|
|
83190
|
+
else if (statement.get() instanceof Statements.Catch
|
|
83191
|
+
|| statement.get() instanceof Statements.Cleanup) {
|
|
83192
|
+
i = this.findEnd(i, statements, [Statements.Try], Statements.EndTry);
|
|
83193
|
+
}
|
|
82829
83194
|
else {
|
|
82830
83195
|
if (assigned && concat.includes(assigned)) {
|
|
82831
83196
|
return true;
|
|
@@ -82834,7 +83199,8 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
|
|
|
82834
83199
|
return true;
|
|
82835
83200
|
}
|
|
82836
83201
|
return concat.includes(" SY-SUBRC")
|
|
82837
|
-
|| concat.includes("CL_ABAP_UNIT_ASSERT=>ASSERT_SUBRC")
|
|
83202
|
+
|| concat.includes("CL_ABAP_UNIT_ASSERT=>ASSERT_SUBRC")
|
|
83203
|
+
|| this.callsSubrcMethod(statement);
|
|
82838
83204
|
}
|
|
82839
83205
|
}
|
|
82840
83206
|
return false;
|
|
@@ -84227,7 +84593,8 @@ https://docs.abapopenchecks.org/checks/14/`,
|
|
|
84227
84593
|
return [];
|
|
84228
84594
|
}
|
|
84229
84595
|
let containsStatement = false;
|
|
84230
|
-
for (
|
|
84596
|
+
for (let i = 0; i < statementNodes.length; i++) {
|
|
84597
|
+
const statementNode = statementNodes[i];
|
|
84231
84598
|
const statement = statementNode.get();
|
|
84232
84599
|
if (this.getConfig().allowIncludeInFugr === true
|
|
84233
84600
|
&& obj instanceof objects_1.FunctionGroup
|
|
@@ -84237,6 +84604,9 @@ https://docs.abapopenchecks.org/checks/14/`,
|
|
|
84237
84604
|
if (!(statement instanceof _statement_1.Unknown
|
|
84238
84605
|
|| statement instanceof _statement_1.Empty
|
|
84239
84606
|
|| statement instanceof _statement_1.Comment)) {
|
|
84607
|
+
if (this.isSplitFromText(statementNodes, i)) {
|
|
84608
|
+
continue;
|
|
84609
|
+
}
|
|
84240
84610
|
containsStatement = true;
|
|
84241
84611
|
break;
|
|
84242
84612
|
}
|
|
@@ -84248,6 +84618,22 @@ https://docs.abapopenchecks.org/checks/14/`,
|
|
|
84248
84618
|
const issue = issue_1.Issue.atRange(file, posStart, posEnd, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
|
|
84249
84619
|
return [issue];
|
|
84250
84620
|
}
|
|
84621
|
+
/**
|
|
84622
|
+
* The statement parser splits an Unknown statement at a line break if the rest parses as a statement.
|
|
84623
|
+
* In comment text, such a split is code only if no further text follows the statement on its line.
|
|
84624
|
+
*/
|
|
84625
|
+
isSplitFromText(statementNodes, index) {
|
|
84626
|
+
const previous = statementNodes[index - 1];
|
|
84627
|
+
if (previous === undefined
|
|
84628
|
+
|| !(previous.get() instanceof _statement_1.Unknown)
|
|
84629
|
+
|| [".", ","].includes(previous.getLastToken().getStr())) {
|
|
84630
|
+
return false;
|
|
84631
|
+
}
|
|
84632
|
+
const next = statementNodes[index + 1];
|
|
84633
|
+
return next !== undefined
|
|
84634
|
+
&& next.get() instanceof _statement_1.Unknown
|
|
84635
|
+
&& next.getFirstToken().getRow() === statementNodes[index].getLastToken().getRow();
|
|
84636
|
+
}
|
|
84251
84637
|
isCommentLine(text) {
|
|
84252
84638
|
return (text.substr(0, 1) === "*")
|
|
84253
84639
|
|| (text.trim().substr(0, 1) === "\"" && text.trim().substr(1, 1) !== "!");
|
|
@@ -92563,6 +92949,138 @@ exports.ForbiddenPseudoAndPragma = ForbiddenPseudoAndPragma;
|
|
|
92563
92949
|
|
|
92564
92950
|
/***/ },
|
|
92565
92951
|
|
|
92952
|
+
/***/ "../core/build/src/rules/forbidden_statement.js"
|
|
92953
|
+
/*!******************************************************!*\
|
|
92954
|
+
!*** ../core/build/src/rules/forbidden_statement.js ***!
|
|
92955
|
+
\******************************************************/
|
|
92956
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
92957
|
+
|
|
92958
|
+
"use strict";
|
|
92959
|
+
|
|
92960
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
92961
|
+
if (k2 === undefined) k2 = k;
|
|
92962
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
92963
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
92964
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
92965
|
+
}
|
|
92966
|
+
Object.defineProperty(o, k2, desc);
|
|
92967
|
+
}) : (function(o, m, k, k2) {
|
|
92968
|
+
if (k2 === undefined) k2 = k;
|
|
92969
|
+
o[k2] = m[k];
|
|
92970
|
+
}));
|
|
92971
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
92972
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
92973
|
+
}) : function(o, v) {
|
|
92974
|
+
o["default"] = v;
|
|
92975
|
+
});
|
|
92976
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
92977
|
+
var ownKeys = function(o) {
|
|
92978
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
92979
|
+
var ar = [];
|
|
92980
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
92981
|
+
return ar;
|
|
92982
|
+
};
|
|
92983
|
+
return ownKeys(o);
|
|
92984
|
+
};
|
|
92985
|
+
return function (mod) {
|
|
92986
|
+
if (mod && mod.__esModule) return mod;
|
|
92987
|
+
var result = {};
|
|
92988
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
92989
|
+
__setModuleDefault(result, mod);
|
|
92990
|
+
return result;
|
|
92991
|
+
};
|
|
92992
|
+
})();
|
|
92993
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
92994
|
+
exports.ForbiddenStatement = exports.ForbiddenStatementConf = void 0;
|
|
92995
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
92996
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
92997
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
92998
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
92999
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
93000
|
+
class ForbiddenStatementConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
93001
|
+
constructor() {
|
|
93002
|
+
super(...arguments);
|
|
93003
|
+
/** List of forbidden statements, given as abaplint statement names,
|
|
93004
|
+
* case insensitive, spaces, underscores and dashes are ignored,
|
|
93005
|
+
* so "READ TABLE", "ReadTable" and "read_table" are the same
|
|
93006
|
+
* @uniqueItems true
|
|
93007
|
+
*/
|
|
93008
|
+
this.statements = [];
|
|
93009
|
+
}
|
|
93010
|
+
}
|
|
93011
|
+
exports.ForbiddenStatementConf = ForbiddenStatementConf;
|
|
93012
|
+
class ForbiddenStatement extends _abap_rule_1.ABAPRule {
|
|
93013
|
+
constructor() {
|
|
93014
|
+
super(...arguments);
|
|
93015
|
+
this.conf = new ForbiddenStatementConf();
|
|
93016
|
+
/** statement class -> configured spelling, used in the message */
|
|
93017
|
+
this.forbidden = new Map();
|
|
93018
|
+
}
|
|
93019
|
+
getMetadata() {
|
|
93020
|
+
return {
|
|
93021
|
+
key: "forbidden_statement",
|
|
93022
|
+
title: "Forbidden Statement",
|
|
93023
|
+
shortDescription: `Forbid use of specified statements.`,
|
|
93024
|
+
extendedInformation: `Nothing is reported unless statements are configured.
|
|
93025
|
+
|
|
93026
|
+
A configured entry matches the abaplint statement with the same name, compared case insensitive,
|
|
93027
|
+
ignoring spaces, underscores and dashes, so "READ TABLE", "ReadTable" and "read_table" all match ReadTable.
|
|
93028
|
+
|
|
93029
|
+
The names are the class names in https://github.com/abaplint/abaplint/tree/main/packages/core/src/abap/2_statements/statements,
|
|
93030
|
+
some keywords are split into several statements, eg. "INSERT" does not match anything,
|
|
93031
|
+
use "InsertInternal" or "InsertDatabase", likewise for DELETE, MODIFY and READ. Entries that do not match a statement are ignored.
|
|
93032
|
+
|
|
93033
|
+
Each part of a chained statement is checked as a separate statement.`,
|
|
93034
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
93035
|
+
badExample: `* with "statements": ["READ TABLE"]
|
|
93036
|
+
READ TABLE items INDEX 1 INTO item.`,
|
|
93037
|
+
goodExample: `* with "statements": ["READ TABLE"]
|
|
93038
|
+
item = items[ 1 ].`,
|
|
93039
|
+
};
|
|
93040
|
+
}
|
|
93041
|
+
getConfig() {
|
|
93042
|
+
return this.conf;
|
|
93043
|
+
}
|
|
93044
|
+
setConfig(conf) {
|
|
93045
|
+
this.conf = conf;
|
|
93046
|
+
if (this.conf.statements === undefined) {
|
|
93047
|
+
this.conf.statements = [];
|
|
93048
|
+
}
|
|
93049
|
+
const byName = new Map();
|
|
93050
|
+
for (const [name, value] of Object.entries(Statements)) {
|
|
93051
|
+
byName.set(ForbiddenStatement.normalize(name), value);
|
|
93052
|
+
}
|
|
93053
|
+
this.forbidden = new Map();
|
|
93054
|
+
for (const entry of this.conf.statements) {
|
|
93055
|
+
const found = byName.get(ForbiddenStatement.normalize(entry));
|
|
93056
|
+
if (found !== undefined && this.forbidden.has(found) === false) {
|
|
93057
|
+
this.forbidden.set(found, entry.trim());
|
|
93058
|
+
}
|
|
93059
|
+
}
|
|
93060
|
+
}
|
|
93061
|
+
runParsed(file) {
|
|
93062
|
+
if (this.forbidden.size === 0) {
|
|
93063
|
+
return [];
|
|
93064
|
+
}
|
|
93065
|
+
const ret = [];
|
|
93066
|
+
for (const s of file.getStatements()) {
|
|
93067
|
+
const name = this.forbidden.get(s.get().constructor);
|
|
93068
|
+
if (name !== undefined) {
|
|
93069
|
+
const message = "Statement \"" + name + "\" is forbidden";
|
|
93070
|
+
ret.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.conf.severity));
|
|
93071
|
+
}
|
|
93072
|
+
}
|
|
93073
|
+
return ret;
|
|
93074
|
+
}
|
|
93075
|
+
static normalize(name) {
|
|
93076
|
+
return name.toLowerCase().replace(/[\s_-]/g, "");
|
|
93077
|
+
}
|
|
93078
|
+
}
|
|
93079
|
+
exports.ForbiddenStatement = ForbiddenStatement;
|
|
93080
|
+
//# sourceMappingURL=forbidden_statement.js.map
|
|
93081
|
+
|
|
93082
|
+
/***/ },
|
|
93083
|
+
|
|
92566
93084
|
/***/ "../core/build/src/rules/forbidden_void_type.js"
|
|
92567
93085
|
/*!******************************************************!*\
|
|
92568
93086
|
!*** ../core/build/src/rules/forbidden_void_type.js ***!
|
|
@@ -94935,12 +95453,11 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
|
|
|
94935
95453
|
const name = m.objectName + "~" + m.method.name;
|
|
94936
95454
|
let found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());
|
|
94937
95455
|
if (found === undefined) {
|
|
94938
|
-
// try looking for ALIASes
|
|
94939
|
-
|
|
94940
|
-
|
|
94941
|
-
|
|
94942
|
-
|
|
94943
|
-
}
|
|
95456
|
+
// try looking for ALIASes, also the ones inherited from super classes,
|
|
95457
|
+
// "METHODS alias_name REDEFINITION" implements the method through an alias of the super class
|
|
95458
|
+
const alias = this.findAlias(def, name);
|
|
95459
|
+
if (alias !== undefined) {
|
|
95460
|
+
found = impl.methods.find(m => m.getName().toUpperCase() === alias.toUpperCase());
|
|
94944
95461
|
}
|
|
94945
95462
|
}
|
|
94946
95463
|
if (found === undefined && def.superClassName !== undefined) {
|
|
@@ -94963,6 +95480,21 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
|
|
|
94963
95480
|
}
|
|
94964
95481
|
return found !== undefined;
|
|
94965
95482
|
}
|
|
95483
|
+
/** name of the alias for the component, in the class or in one of its super classes */
|
|
95484
|
+
findAlias(def, component) {
|
|
95485
|
+
var _a;
|
|
95486
|
+
const visited = new Set();
|
|
95487
|
+
let current = def;
|
|
95488
|
+
while (current !== undefined && !visited.has(current.name.toUpperCase())) {
|
|
95489
|
+
visited.add(current.name.toUpperCase());
|
|
95490
|
+
const alias = current.aliases.find(a => a.component.toUpperCase() === component.toUpperCase());
|
|
95491
|
+
if (alias !== undefined) {
|
|
95492
|
+
return alias.name;
|
|
95493
|
+
}
|
|
95494
|
+
current = current.superClassName ? (_a = this.findClass(current.superClassName)) === null || _a === void 0 ? void 0 : _a.def : undefined;
|
|
95495
|
+
}
|
|
95496
|
+
return undefined;
|
|
95497
|
+
}
|
|
94966
95498
|
viaAliasInInterface(m, intf, impl) {
|
|
94967
95499
|
for (const a of intf.aliases) {
|
|
94968
95500
|
if (a.component.toUpperCase() === m.objectName.toUpperCase() + "~" + m.method.name.toUpperCase()) {
|
|
@@ -95585,6 +96117,7 @@ __exportStar(__webpack_require__(/*! ./fm_global_parameters_obsolete */ "../core
|
|
|
95585
96117
|
__exportStar(__webpack_require__(/*! ./forbidden_identifier */ "../core/build/src/rules/forbidden_identifier.js"), exports);
|
|
95586
96118
|
__exportStar(__webpack_require__(/*! ./forbidden_kernel_write */ "../core/build/src/rules/forbidden_kernel_write.js"), exports);
|
|
95587
96119
|
__exportStar(__webpack_require__(/*! ./forbidden_pseudo_and_pragma */ "../core/build/src/rules/forbidden_pseudo_and_pragma.js"), exports);
|
|
96120
|
+
__exportStar(__webpack_require__(/*! ./forbidden_statement */ "../core/build/src/rules/forbidden_statement.js"), exports);
|
|
95588
96121
|
__exportStar(__webpack_require__(/*! ./forbidden_void_type */ "../core/build/src/rules/forbidden_void_type.js"), exports);
|
|
95589
96122
|
__exportStar(__webpack_require__(/*! ./form_tables_obsolete */ "../core/build/src/rules/form_tables_obsolete.js"), exports);
|
|
95590
96123
|
__exportStar(__webpack_require__(/*! ./fully_type_constants */ "../core/build/src/rules/fully_type_constants.js"), exports);
|
|
@@ -102802,6 +103335,8 @@ class ObsoleteStatementConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
|
102802
103335
|
this.replaceInto = true;
|
|
102803
103336
|
this.loopExtract = true;
|
|
102804
103337
|
this.sortExtract = true;
|
|
103338
|
+
/** Checks for TRANSLATE statement */
|
|
103339
|
+
this.translate = true;
|
|
102805
103340
|
}
|
|
102806
103341
|
}
|
|
102807
103342
|
exports.ObsoleteStatementConf = ObsoleteStatementConf;
|
|
@@ -102858,7 +103393,9 @@ POSIX REGEX: https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/ABE
|
|
|
102858
103393
|
|
|
102859
103394
|
OCCURENCES: check for OCCURENCES vs OCCURRENCES
|
|
102860
103395
|
|
|
102861
|
-
CLIENT SPECIFIED, from 754: https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abapselect_client_obsolete.html
|
|
103396
|
+
CLIENT SPECIFIED, from 754: https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abapselect_client_obsolete.html
|
|
103397
|
+
|
|
103398
|
+
TRANSLATE: https://help.sap.com/docs/abap-cloud/abap-keywords-standard-abap/translate`,
|
|
102862
103399
|
badExample: `REFRESH itab.
|
|
102863
103400
|
|
|
102864
103401
|
COMPUTE foo = 2 + 2.
|
|
@@ -103063,6 +103600,11 @@ ENDIF.`,
|
|
|
103063
103600
|
const issue = issue_1.Issue.atStatement(file, staNode, "SORT extract", this.getMetadata().key, this.conf.severity);
|
|
103064
103601
|
issues.push(issue);
|
|
103065
103602
|
}
|
|
103603
|
+
if (this.conf.translate && sta instanceof Statements.Translate) {
|
|
103604
|
+
const fix = this.getTranslateFix(file, staNode);
|
|
103605
|
+
const issue = issue_1.Issue.atStatement(file, staNode, "TRANSLATE is obsolete", this.getMetadata().key, this.conf.severity, fix);
|
|
103606
|
+
issues.push(issue);
|
|
103607
|
+
}
|
|
103066
103608
|
if ((0, version_1.releaseAtLeast)(configRelease, version_1.Release.v754) && this.conf.clientSpecified
|
|
103067
103609
|
&& (sta instanceof Statements.Select
|
|
103068
103610
|
|| sta instanceof Statements.SelectLoop
|
|
@@ -103185,6 +103727,27 @@ ENDIF.`,
|
|
|
103185
103727
|
}
|
|
103186
103728
|
return undefined;
|
|
103187
103729
|
}
|
|
103730
|
+
getTranslateFix(file, statementNode) {
|
|
103731
|
+
const tokens = statementNode.getTokens();
|
|
103732
|
+
// tokens: TRANSLATE <target> TO UPPER|LOWER CASE .
|
|
103733
|
+
// or: TRANSLATE <target> USING <source> .
|
|
103734
|
+
if (tokens.length < 4) {
|
|
103735
|
+
return undefined;
|
|
103736
|
+
}
|
|
103737
|
+
const thirdToken = tokens[2].getStr().toUpperCase();
|
|
103738
|
+
if (thirdToken !== "TO") {
|
|
103739
|
+
return undefined;
|
|
103740
|
+
}
|
|
103741
|
+
const targetStr = tokens[1].getStr();
|
|
103742
|
+
const directionToken = tokens[3].getStr().toUpperCase();
|
|
103743
|
+
if (directionToken === "UPPER") {
|
|
103744
|
+
return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), targetStr + " = to_upper( " + targetStr + " ).");
|
|
103745
|
+
}
|
|
103746
|
+
else if (directionToken === "LOWER") {
|
|
103747
|
+
return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), targetStr + " = to_lower( " + targetStr + " ).");
|
|
103748
|
+
}
|
|
103749
|
+
return undefined;
|
|
103750
|
+
}
|
|
103188
103751
|
}
|
|
103189
103752
|
exports.ObsoleteStatement = ObsoleteStatement;
|
|
103190
103753
|
//# sourceMappingURL=obsolete_statement.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.114",
|
|
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.114",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|