@abaplint/cli 2.120.87 → 2.120.89
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 +147 -17
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -5230,10 +5230,15 @@ class FormParamType extends combi_1.Expression {
|
|
|
5230
5230
|
getRunnable() {
|
|
5231
5231
|
const def = (0, combi_1.seq)("DEFAULT", (0, combi_1.alt)(_1.Constant, _1.FieldChain));
|
|
5232
5232
|
const table = (0, combi_1.seq)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY"), "TABLE");
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
const
|
|
5236
|
-
|
|
5233
|
+
// the following are not valid FORM typings, fail instead of reading the
|
|
5234
|
+
// remaining words as additional parameters
|
|
5235
|
+
const inline = (0, combi_1.seq)((0, combi_1.alt)("TABLE", "RANGE"), "OF", (0, combi_1.failCombinator)());
|
|
5236
|
+
const tableKey = (0, combi_1.seq)("WITH", (0, combi_1.failCombinator)());
|
|
5237
|
+
const lengthDecimals = (0, combi_1.seq)((0, combi_1.alt)("LENGTH", "DECIMALS"), _1.Integer, (0, combi_1.failCombinator)());
|
|
5238
|
+
const tabseq = (0, combi_1.seq)(table, (0, combi_1.optPrio)((0, combi_1.seq)("OF", (0, combi_1.altPrio)((0, combi_1.seq)("REF TO", (0, combi_1.failCombinator)()), _1.TypeName))), (0, combi_1.optPrio)(tableKey));
|
|
5239
|
+
const ret = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.alt)("REF TO", "LINE OF")), _1.TypeName, (0, combi_1.optPrio)(lengthDecimals), (0, combi_1.opt)(def));
|
|
5240
|
+
const like = (0, combi_1.seq)("LIKE", (0, combi_1.altPrio)(inline, (0, combi_1.seq)(table, (0, combi_1.failCombinator)()), (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.alt)("REF TO", "LINE OF")), _1.FieldChain)));
|
|
5241
|
+
return (0, combi_1.alt)((0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(tabseq, (0, combi_1.ver)(version_1.Release.v916, (0, combi_1.seq)("ANY", "STRUCTURE")), inline, ret)), like);
|
|
5237
5242
|
}
|
|
5238
5243
|
}
|
|
5239
5244
|
exports.FormParamType = FormParamType;
|
|
@@ -28506,6 +28511,15 @@ class TypeUtils {
|
|
|
28506
28511
|
}
|
|
28507
28512
|
return this.isAssignable(source, target);
|
|
28508
28513
|
}
|
|
28514
|
+
// character-like arguments of built-in functions must be elementary, flat character-like structures are not allowed
|
|
28515
|
+
isAssignableBuiltin(source, target, node) {
|
|
28516
|
+
if (target instanceof basic_1.CLikeType
|
|
28517
|
+
&& (source instanceof basic_1.StructureType
|
|
28518
|
+
|| (source instanceof basic_1.TableType && source.isWithHeader() && source.getRowType() instanceof basic_1.StructureType))) {
|
|
28519
|
+
return false;
|
|
28520
|
+
}
|
|
28521
|
+
return this.isAssignableStrict(source, target, node);
|
|
28522
|
+
}
|
|
28509
28523
|
// Typing with the classic STRUCTURE addition, ie. "FORM foo USING bar STRUCTURE zkey",
|
|
28510
28524
|
// is not a compatibility check: ABAP only checks the fragment view up to the end of the
|
|
28511
28525
|
// formal structure, so the actual parameter is allowed to be longer. For TABLES parameters
|
|
@@ -33795,6 +33809,7 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
|
|
|
33795
33809
|
const constant_1 = __webpack_require__(/*! ./constant */ "../core/build/src/abap/5_syntax/expressions/constant.js");
|
|
33796
33810
|
const _check_offset_length_1 = __webpack_require__(/*! ./_check_offset_length */ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js");
|
|
33797
33811
|
const _check_text_symbol_1 = __webpack_require__(/*! ./_check_text_symbol */ "../core/build/src/abap/5_syntax/expressions/_check_text_symbol.js");
|
|
33812
|
+
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
|
|
33798
33813
|
class MethodCallParam {
|
|
33799
33814
|
/** returns the type of the unnamed argument, if any */
|
|
33800
33815
|
static runSyntax(node, input, method) {
|
|
@@ -33871,7 +33886,7 @@ class MethodCallParam {
|
|
|
33871
33886
|
else if ((0, _check_text_symbol_1.checkTextSymbol)(child, targetType, input)) {
|
|
33872
33887
|
return;
|
|
33873
33888
|
}
|
|
33874
|
-
else if (
|
|
33889
|
+
else if (this.isAssignable(sourceType, targetType, child, method, input) === false) {
|
|
33875
33890
|
const message = "Method parameter type not compatible";
|
|
33876
33891
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
33877
33892
|
return;
|
|
@@ -33891,6 +33906,12 @@ class MethodCallParam {
|
|
|
33891
33906
|
}
|
|
33892
33907
|
return undefined;
|
|
33893
33908
|
}
|
|
33909
|
+
static isAssignable(sourceType, targetType, child, method, input) {
|
|
33910
|
+
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
33911
|
+
return method instanceof _builtin_1.BuiltInMethod
|
|
33912
|
+
? typeUtils.isAssignableBuiltin(sourceType, targetType, child)
|
|
33913
|
+
: typeUtils.isAssignableStrict(sourceType, targetType, child);
|
|
33914
|
+
}
|
|
33894
33915
|
}
|
|
33895
33916
|
exports.MethodCallParam = MethodCallParam;
|
|
33896
33917
|
//# sourceMappingURL=method_call_param.js.map
|
|
@@ -34128,6 +34149,7 @@ const field_chain_1 = __webpack_require__(/*! ./field_chain */ "../core/build/sr
|
|
|
34128
34149
|
const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
34129
34150
|
const _check_offset_length_1 = __webpack_require__(/*! ./_check_offset_length */ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js");
|
|
34130
34151
|
const _check_text_symbol_1 = __webpack_require__(/*! ./_check_text_symbol */ "../core/build/src/abap/5_syntax/expressions/_check_text_symbol.js");
|
|
34152
|
+
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
|
|
34131
34153
|
function normalizeParameterName(name) {
|
|
34132
34154
|
return name.replace(/^!/, "").toUpperCase();
|
|
34133
34155
|
}
|
|
@@ -34275,6 +34297,10 @@ class MethodParameters {
|
|
|
34275
34297
|
if (this.requiredParameters === undefined) {
|
|
34276
34298
|
this.requiredParameters = new Set(method.getParameters().getRequiredParameters().map(i => i.getName().toUpperCase()));
|
|
34277
34299
|
}
|
|
34300
|
+
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
34301
|
+
const assignable = method instanceof _builtin_1.BuiltInMethod
|
|
34302
|
+
? typeUtils.isAssignableBuiltin.bind(typeUtils)
|
|
34303
|
+
: typeUtils.isAssignableStrict.bind(typeUtils);
|
|
34278
34304
|
for (const item of items) {
|
|
34279
34305
|
const parameter = allImporting.find(p => p.getName().toUpperCase() === item.name);
|
|
34280
34306
|
if (parameter === undefined) {
|
|
@@ -34285,7 +34311,7 @@ class MethodParameters {
|
|
|
34285
34311
|
else if ((0, _check_text_symbol_1.checkTextSymbol)(item.source, parameter.getType(), input)) {
|
|
34286
34312
|
return;
|
|
34287
34313
|
}
|
|
34288
|
-
else if (
|
|
34314
|
+
else if (assignable(item.sourceType, parameter.getType(), item.source) === false) {
|
|
34289
34315
|
const message = "Method parameter type not compatible, " + item.name;
|
|
34290
34316
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
34291
34317
|
return;
|
|
@@ -56688,7 +56714,7 @@ const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/sr
|
|
|
56688
56714
|
const ddic_1 = __webpack_require__(/*! ../ddic */ "../core/build/src/ddic.js");
|
|
56689
56715
|
class CDSDetermineTypes {
|
|
56690
56716
|
parseType(reg, parsedData, ddlsName) {
|
|
56691
|
-
var _a;
|
|
56717
|
+
var _a, _b;
|
|
56692
56718
|
const ddic = new ddic_1.DDIC(reg);
|
|
56693
56719
|
if ((parsedData === null || parsedData === void 0 ? void 0 : parsedData.fields.length) === 0) {
|
|
56694
56720
|
return basic_1.VoidType.get("DDLS:todo");
|
|
@@ -56767,13 +56793,29 @@ class CDSDetermineTypes {
|
|
|
56767
56793
|
else {
|
|
56768
56794
|
components.push({
|
|
56769
56795
|
name: f.name,
|
|
56770
|
-
type: basic_1.VoidType.get("DDLS:fieldname:" + ddlsName),
|
|
56796
|
+
type: (_b = this.findInSources(ddic, parsedData, f.nameInSource)) !== null && _b !== void 0 ? _b : basic_1.VoidType.get("DDLS:fieldname:" + ddlsName),
|
|
56771
56797
|
});
|
|
56772
56798
|
}
|
|
56773
56799
|
}
|
|
56774
56800
|
return new basic_1.StructureType(components, parsedData.definitionName, parsedData.definitionName, parsedData.description);
|
|
56775
56801
|
}
|
|
56776
56802
|
}
|
|
56803
|
+
/** unprefixed field, take the type from the first source containing it, void or unknown sources are skipped */
|
|
56804
|
+
findInSources(ddic, parsedData, nameInSource) {
|
|
56805
|
+
if (nameInSource === undefined) {
|
|
56806
|
+
return undefined;
|
|
56807
|
+
}
|
|
56808
|
+
for (const source of parsedData.sources) {
|
|
56809
|
+
const lookup = ddic.lookupTableOrView(source.name);
|
|
56810
|
+
if (lookup.type instanceof basic_1.StructureType) {
|
|
56811
|
+
const type = lookup.type.getComponentByName(nameInSource);
|
|
56812
|
+
if (type) {
|
|
56813
|
+
return type;
|
|
56814
|
+
}
|
|
56815
|
+
}
|
|
56816
|
+
}
|
|
56817
|
+
return undefined;
|
|
56818
|
+
}
|
|
56777
56819
|
}
|
|
56778
56820
|
exports.CDSDetermineTypes = CDSDetermineTypes;
|
|
56779
56821
|
//# sourceMappingURL=cds_determine_types.js.map
|
|
@@ -60336,8 +60378,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
60336
60378
|
};
|
|
60337
60379
|
})();
|
|
60338
60380
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
60339
|
-
exports.
|
|
60340
|
-
exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = void 0;
|
|
60381
|
+
exports.Tokens = exports.ABAPParser = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLKind = exports.DDLParser = exports.AbstractFile = exports.ABAPFile = exports.MemoryFile = exports.Edits = exports.ReferenceType = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.SpaghettiScopeNode = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.FormLengthStats = exports.FunctionLengthStats = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.versionToABAPRelease = exports.releaseAtLeast = exports.Release = exports.LanguageVersion = exports.Version = exports.Config = exports.Issue = void 0;
|
|
60382
|
+
exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = void 0;
|
|
60341
60383
|
const issue_1 = __webpack_require__(/*! ./issue */ "../core/build/src/issue.js");
|
|
60342
60384
|
Object.defineProperty(exports, "Issue", ({ enumerable: true, get: function () { return issue_1.Issue; } }));
|
|
60343
60385
|
const config_1 = __webpack_require__(/*! ./config */ "../core/build/src/config.js");
|
|
@@ -60434,6 +60476,8 @@ Object.defineProperty(exports, "DDLParser", ({ enumerable: true, get: function (
|
|
|
60434
60476
|
Object.defineProperty(exports, "DDLKind", ({ enumerable: true, get: function () { return ddl_parser_1.DDLKind; } }));
|
|
60435
60477
|
const cds_parser_1 = __webpack_require__(/*! ./cds/cds_parser */ "../core/build/src/cds/cds_parser.js");
|
|
60436
60478
|
Object.defineProperty(exports, "CDSParser", ({ enumerable: true, get: function () { return cds_parser_1.CDSParser; } }));
|
|
60479
|
+
const abap_parser_1 = __webpack_require__(/*! ./abap/abap_parser */ "../core/build/src/abap/abap_parser.js");
|
|
60480
|
+
Object.defineProperty(exports, "ABAPParser", ({ enumerable: true, get: function () { return abap_parser_1.ABAPParser; } }));
|
|
60437
60481
|
const rules_runner_1 = __webpack_require__(/*! ./rules_runner */ "../core/build/src/rules_runner.js");
|
|
60438
60482
|
Object.defineProperty(exports, "RulesRunner", ({ enumerable: true, get: function () { return rules_runner_1.RulesRunner; } }));
|
|
60439
60483
|
const _irule_1 = __webpack_require__(/*! ./rules/_irule */ "../core/build/src/rules/_irule.js");
|
|
@@ -65486,12 +65530,16 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
65486
65530
|
let found = (_a = e.findDirectExpression(expressions_1.CDSAs)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.CDSName);
|
|
65487
65531
|
const list = (_b = e.findDirectExpression(expressions_1.CDSPrefixedName)) === null || _b === void 0 ? void 0 : _b.findAllExpressions(expressions_1.CDSName);
|
|
65488
65532
|
if (list !== undefined) {
|
|
65489
|
-
const redirected =
|
|
65533
|
+
const redirected = e.concatTokens().toUpperCase().includes(" REDIRECTED TO ");
|
|
65490
65534
|
if (list.length > 1 && redirected === false) {
|
|
65491
65535
|
// "prefix.field" is looked up as "field" in "prefix", also when aliased via "as"
|
|
65492
65536
|
prefix = list[0].concatTokens();
|
|
65493
65537
|
nameInSource = list[list.length - 1].concatTokens();
|
|
65494
65538
|
}
|
|
65539
|
+
else if (list.length === 1 && redirected === false) {
|
|
65540
|
+
// unprefixed "field" is looked up in the sources, also when aliased via "as"
|
|
65541
|
+
nameInSource = list[0].concatTokens();
|
|
65542
|
+
}
|
|
65495
65543
|
if (found === undefined) {
|
|
65496
65544
|
found = redirected === true ? list[0] : list[list.length - 1];
|
|
65497
65545
|
}
|
|
@@ -72674,7 +72722,7 @@ class Registry {
|
|
|
72674
72722
|
}
|
|
72675
72723
|
static abaplintVersion() {
|
|
72676
72724
|
// magic, see build script "version.js"
|
|
72677
|
-
return "2.120.
|
|
72725
|
+
return "2.120.89";
|
|
72678
72726
|
}
|
|
72679
72727
|
getDDICReferences() {
|
|
72680
72728
|
return this.ddicReferences;
|
|
@@ -84456,6 +84504,18 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
84456
84504
|
}
|
|
84457
84505
|
}
|
|
84458
84506
|
}
|
|
84507
|
+
// a chained call with EXPORTING/IMPORTING/CHANGING/RECEIVING/EXCEPTIONS parses in the low
|
|
84508
|
+
// version, but 702 reads the last call of a chain as a functional call,
|
|
84509
|
+
// "Unexpected word CHANGING in functional method call"
|
|
84510
|
+
if (ret.length === 0) {
|
|
84511
|
+
for (let i = 0; i < lowStatements.length; i++) {
|
|
84512
|
+
const issue = this.outlineChainedCallParameters(lowStatements[i], highStatements[i], lowFile, highSyntax);
|
|
84513
|
+
if (issue) {
|
|
84514
|
+
ret.push(issue);
|
|
84515
|
+
break;
|
|
84516
|
+
}
|
|
84517
|
+
}
|
|
84518
|
+
}
|
|
84459
84519
|
// INSERT with a 702 built-in function as the operand parses in the low version, but 702
|
|
84460
84520
|
// reads the function as a method call, "Method SUBSTRING does not exist"
|
|
84461
84521
|
if (ret.length === 0) {
|
|
@@ -87037,6 +87097,67 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
87037
87097
|
}
|
|
87038
87098
|
return undefined;
|
|
87039
87099
|
}
|
|
87100
|
+
/** a( )->b( CHANGING c = d ), the object the last method is called on is outlined into a
|
|
87101
|
+
* variable typed via the RETURNING parameter of the method before it */
|
|
87102
|
+
outlineChainedCallParameters(low, high, lowFile, highSyntax) {
|
|
87103
|
+
var _a, _b, _c, _d;
|
|
87104
|
+
if (!(high.get() instanceof Statements.Call)) {
|
|
87105
|
+
return undefined;
|
|
87106
|
+
}
|
|
87107
|
+
else if (this.lowReg.getConfig().isOpenABAP()) {
|
|
87108
|
+
return undefined;
|
|
87109
|
+
}
|
|
87110
|
+
else if (low.getFirstToken().getStart() instanceof virtual_position_1.VirtualPosition) {
|
|
87111
|
+
return undefined;
|
|
87112
|
+
}
|
|
87113
|
+
const chain = high.findDirectExpression(Expressions.MethodCallChain);
|
|
87114
|
+
const children = (chain === null || chain === void 0 ? void 0 : chain.getChildren()) || [];
|
|
87115
|
+
const last = children[children.length - 1];
|
|
87116
|
+
const arrow = children[children.length - 2];
|
|
87117
|
+
const previous = children[children.length - 3];
|
|
87118
|
+
if (chain === undefined
|
|
87119
|
+
|| !(last instanceof nodes_1.ExpressionNode)
|
|
87120
|
+
|| !(last.get() instanceof Expressions.MethodCall)
|
|
87121
|
+
|| (arrow === null || arrow === void 0 ? void 0 : arrow.getFirstToken().getStr()) !== "->"
|
|
87122
|
+
|| !(previous instanceof nodes_1.ExpressionNode)
|
|
87123
|
+
|| !(previous.get() instanceof Expressions.MethodCall)) {
|
|
87124
|
+
return undefined;
|
|
87125
|
+
}
|
|
87126
|
+
const parameters = (_a = last.findDirectExpression(Expressions.MethodCallParam)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.MethodParameters);
|
|
87127
|
+
if (parameters === undefined) {
|
|
87128
|
+
return undefined;
|
|
87129
|
+
}
|
|
87130
|
+
// the type of the object, from the method that returns it
|
|
87131
|
+
const methodToken = (_b = previous.findDirectExpression(Expressions.MethodName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
87132
|
+
if (methodToken === undefined) {
|
|
87133
|
+
return undefined;
|
|
87134
|
+
}
|
|
87135
|
+
const spag = highSyntax.spaghetti.lookupPosition(methodToken.getStart(), lowFile.getFilename());
|
|
87136
|
+
let type = undefined;
|
|
87137
|
+
for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
|
|
87138
|
+
if (r.referenceType === _reference_1.ReferenceType.MethodReference
|
|
87139
|
+
&& r.position.getStart().equals(methodToken.getStart())) {
|
|
87140
|
+
const returning = (_d = (_c = r.resolved) === null || _c === void 0 ? void 0 : _c.getParameters().getReturning()) === null || _d === void 0 ? void 0 : _d.getType();
|
|
87141
|
+
if (returning instanceof basic_1.ObjectReferenceType) {
|
|
87142
|
+
type = returning.toABAP();
|
|
87143
|
+
}
|
|
87144
|
+
break;
|
|
87145
|
+
}
|
|
87146
|
+
}
|
|
87147
|
+
if (type === undefined) {
|
|
87148
|
+
return undefined;
|
|
87149
|
+
}
|
|
87150
|
+
const object = children.slice(0, children.length - 2).map(c => c.concatTokens()).join("");
|
|
87151
|
+
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
87152
|
+
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
87153
|
+
const code = `DATA ${uniqueName} TYPE ${type}.\n` +
|
|
87154
|
+
indentation + `${uniqueName} = ${object}.\n` +
|
|
87155
|
+
indentation;
|
|
87156
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
87157
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, chain.getFirstToken().getStart(), previous.getLastToken().getEnd(), uniqueName);
|
|
87158
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
87159
|
+
return issue_1.Issue.atToken(lowFile, chain.getFirstToken(), "Outline object of chained call with parameter keywords", this.getMetadata().key, this.conf.severity, fix);
|
|
87160
|
+
}
|
|
87040
87161
|
/** if the source expression is the complete source of an INSERT or APPEND statement, then the
|
|
87041
87162
|
* outlined variable must be typed via the row type of the table, returns the table name */
|
|
87042
87163
|
findRowTypeOf(high, source) {
|
|
@@ -101863,7 +101984,7 @@ class PreferStringTemplate extends _abap_rule_1.ABAPRule {
|
|
|
101863
101984
|
continue;
|
|
101864
101985
|
}
|
|
101865
101986
|
const operands = this.flattenChain(source);
|
|
101866
|
-
if (!operands.some(op =>
|
|
101987
|
+
if (!operands.some(op => this.isLiteral(op))) {
|
|
101867
101988
|
continue;
|
|
101868
101989
|
}
|
|
101869
101990
|
const template = this.buildTemplate(operands);
|
|
@@ -101888,10 +102009,11 @@ class PreferStringTemplate extends _abap_rule_1.ABAPRule {
|
|
|
101888
102009
|
buildTemplate(operands) {
|
|
101889
102010
|
let inner = "";
|
|
101890
102011
|
for (const op of operands) {
|
|
101891
|
-
|
|
101892
|
-
|
|
101893
|
-
|
|
101894
|
-
|
|
102012
|
+
if (this.isLiteral(op)) {
|
|
102013
|
+
const raw = op.getFirstToken().getStr();
|
|
102014
|
+
const delimiter = raw[0];
|
|
102015
|
+
const value = raw.slice(1, -1).split(delimiter + delimiter).join(delimiter);
|
|
102016
|
+
inner += value.replace(/[\\|{}]/g, "\\$&");
|
|
101895
102017
|
}
|
|
101896
102018
|
else {
|
|
101897
102019
|
inner += `{ ${op.concatTokens()} }`;
|
|
@@ -101899,6 +102021,14 @@ class PreferStringTemplate extends _abap_rule_1.ABAPRule {
|
|
|
101899
102021
|
}
|
|
101900
102022
|
return `|${inner}|`;
|
|
101901
102023
|
}
|
|
102024
|
+
// plain character or string literal, ie. not text symbols or concatenated constants
|
|
102025
|
+
isLiteral(op) {
|
|
102026
|
+
if (op.getFirstToken() !== op.getLastToken()) {
|
|
102027
|
+
return false;
|
|
102028
|
+
}
|
|
102029
|
+
const firstChar = op.getFirstToken().getStr()[0];
|
|
102030
|
+
return firstChar === "'" || firstChar === "`";
|
|
102031
|
+
}
|
|
101902
102032
|
}
|
|
101903
102033
|
exports.PreferStringTemplate = PreferStringTemplate;
|
|
101904
102034
|
//# sourceMappingURL=prefer_string_template.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.89",
|
|
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.89",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|