@abaplint/core 2.85.18 → 2.85.19
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/src/abap/5_syntax/expressions/raise_with.js +14 -0
- package/build/src/abap/5_syntax/statements/raise.js +4 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +47 -0
- package/build/src/rules/function_module_recommendations.js +3 -1
- package/build/src/version.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RaiseWith = void 0;
|
|
4
|
+
const Expressions = require("../../2_statements/expressions");
|
|
5
|
+
const source_1 = require("./source");
|
|
6
|
+
class RaiseWith {
|
|
7
|
+
runSyntax(node, scope, filename) {
|
|
8
|
+
for (const f of node.findDirectExpressions(Expressions.Source)) {
|
|
9
|
+
new source_1.Source().runSyntax(f, scope, filename);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.RaiseWith = RaiseWith;
|
|
14
|
+
//# sourceMappingURL=raise_with.js.map
|
|
@@ -7,6 +7,7 @@ const source_1 = require("../expressions/source");
|
|
|
7
7
|
const _reference_1 = require("../_reference");
|
|
8
8
|
const basic_1 = require("../../types/basic");
|
|
9
9
|
const message_source_1 = require("../expressions/message_source");
|
|
10
|
+
const raise_with_1 = require("../expressions/raise_with");
|
|
10
11
|
class Raise {
|
|
11
12
|
runSyntax(node, scope, filename) {
|
|
12
13
|
// todo
|
|
@@ -47,6 +48,9 @@ class Raise {
|
|
|
47
48
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
51
|
+
for (const s of node.findDirectExpressions(Expressions.RaiseWith)) {
|
|
52
|
+
new raise_with_1.RaiseWith().runSyntax(s, scope, filename);
|
|
53
|
+
}
|
|
50
54
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
51
55
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
52
56
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -56,6 +56,7 @@ Current rules:
|
|
|
56
56
|
* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
|
|
57
57
|
* RAISE EXCEPTION ... MESSAGE
|
|
58
58
|
* APPEND expression is outlined
|
|
59
|
+
* Moving with +=, -=, /=, *=, &&=
|
|
59
60
|
|
|
60
61
|
Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,
|
|
61
62
|
tags: [_irule_1.RuleTag.Experimental, _irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],
|
|
@@ -163,6 +164,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
163
164
|
if (found) {
|
|
164
165
|
return found;
|
|
165
166
|
}
|
|
167
|
+
found = this.moveWithOperator(high, lowFile);
|
|
168
|
+
if (found) {
|
|
169
|
+
return found;
|
|
170
|
+
}
|
|
166
171
|
found = this.downportSelectInline(low, high, lowFile, highSyntax);
|
|
167
172
|
if (found) {
|
|
168
173
|
return found;
|
|
@@ -560,6 +565,48 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
|
|
|
560
565
|
}
|
|
561
566
|
return undefined;
|
|
562
567
|
}
|
|
568
|
+
moveWithOperator(high, lowFile) {
|
|
569
|
+
var _a, _b, _c;
|
|
570
|
+
if (!(high.get() instanceof Statements.Move)) {
|
|
571
|
+
return undefined;
|
|
572
|
+
}
|
|
573
|
+
const children = high.getChildren();
|
|
574
|
+
const secondChild = children[1];
|
|
575
|
+
if (secondChild === undefined) {
|
|
576
|
+
return undefined;
|
|
577
|
+
}
|
|
578
|
+
const op = secondChild.getFirstToken();
|
|
579
|
+
let operator = "";
|
|
580
|
+
switch (op.getStr()) {
|
|
581
|
+
case "+":
|
|
582
|
+
operator = " + ";
|
|
583
|
+
break;
|
|
584
|
+
case "-":
|
|
585
|
+
operator = " - ";
|
|
586
|
+
break;
|
|
587
|
+
case "/=":
|
|
588
|
+
operator = " / ";
|
|
589
|
+
break;
|
|
590
|
+
case "*=":
|
|
591
|
+
operator = " * ";
|
|
592
|
+
break;
|
|
593
|
+
case "&&=":
|
|
594
|
+
operator = " && ";
|
|
595
|
+
break;
|
|
596
|
+
default:
|
|
597
|
+
return undefined;
|
|
598
|
+
}
|
|
599
|
+
const target = (_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
600
|
+
if (target === undefined) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
const sourceStart = (_c = (_b = high.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstToken().getStart();
|
|
604
|
+
if (sourceStart === undefined) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, op.getStart(), sourceStart, "= " + target + operator);
|
|
608
|
+
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Expand operator", this.getMetadata().key, this.conf.severity, fix);
|
|
609
|
+
}
|
|
563
610
|
// must be very simple string templates, like "|{ ls_line-no ALPHA = IN }|"
|
|
564
611
|
stringTemplateAlpha(node, lowFile) {
|
|
565
612
|
var _a, _b, _c;
|
|
@@ -32,6 +32,8 @@ class FunctionModuleRecommendationsConf extends _basic_rule_config_1.BasicRuleCo
|
|
|
32
32
|
{ name: "REUSE_ALV_GRID_DISPLAY", replace: "use CL_SALV_TABLE=>FACTORY or CL_GUI_ALV_GRID" },
|
|
33
33
|
{ name: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC" },
|
|
34
34
|
{ name: "FUNCTION_EXISTS", replace: "surround with try-catch CX_SY_DYN_CALL_ILLEGAL_METHOD instead" },
|
|
35
|
+
{ name: "IGN_TIMESTAMP_DIFFERENCE", replace: "use CL_ABAP_TSTMP" },
|
|
36
|
+
{ name: "IGN_TIMESTAMP_PLUSMINUS", replace: "use CL_ABAP_TSTMP" },
|
|
35
37
|
];
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -45,7 +47,7 @@ class FunctionModuleRecommendations extends _abap_rule_1.ABAPRule {
|
|
|
45
47
|
return {
|
|
46
48
|
key: "function_module_recommendations",
|
|
47
49
|
title: "Function Module Recommendations",
|
|
48
|
-
shortDescription: `
|
|
50
|
+
shortDescription: `Suggests replacements for various function modules`,
|
|
49
51
|
extendedInformation: `https://docs.abapopenchecks.org/checks/53/`,
|
|
50
52
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
51
53
|
};
|
package/build/src/version.js
CHANGED
|
@@ -18,7 +18,7 @@ var Version;
|
|
|
18
18
|
Version["v756"] = "v756";
|
|
19
19
|
Version["Cloud"] = "Cloud";
|
|
20
20
|
})(Version = exports.Version || (exports.Version = {}));
|
|
21
|
-
exports.defaultVersion = Version.
|
|
21
|
+
exports.defaultVersion = Version.v756;
|
|
22
22
|
function getPreviousVersion(v) {
|
|
23
23
|
if (v === Version.OpenABAP) {
|
|
24
24
|
return Version.v702;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.85.
|
|
3
|
+
"version": "2.85.19",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
"@microsoft/api-extractor": "^7.19.4",
|
|
49
49
|
"@types/chai": "^4.3.0",
|
|
50
50
|
"@types/mocha": "^9.1.0",
|
|
51
|
-
"@types/node": "^17.0.
|
|
51
|
+
"@types/node": "^17.0.18",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
53
|
"eslint": "^8.9.0",
|
|
54
54
|
"mocha": "^9.2.0",
|
|
55
55
|
"c8": "^7.11.0",
|
|
56
56
|
"source-map-support": "^0.5.21",
|
|
57
|
-
"ts-json-schema-generator": "^0.
|
|
57
|
+
"ts-json-schema-generator": "^0.98.0",
|
|
58
58
|
"typescript": "^4.5.5"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"fast-xml-parser": "^4.0.
|
|
61
|
+
"fast-xml-parser": "^4.0.3",
|
|
62
62
|
"json5": "^2.2.0",
|
|
63
63
|
"vscode-languageserver-protocol": "^3.16.0",
|
|
64
64
|
"vscode-languageserver-types": "^3.16.0"
|