@abaplint/core 2.95.24 → 2.95.26
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/2_statements/expressions/inlinedata.js +2 -1
- package/build/src/abap/2_statements/statements/import.js +1 -2
- package/build/src/abap/5_syntax/expressions/component_compare.js +1 -1
- package/build/src/abap/5_syntax/statements/submit.js +4 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +3 -0
- package/build/src/rules/method_overwrites_builtin.js +3 -4
- package/build/src/rules/uncaught_exception.js +18 -3
- package/package.json +2 -2
|
@@ -10,7 +10,8 @@ class InlineData extends combi_1.Expression {
|
|
|
10
10
|
const right = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.ParenRight));
|
|
11
11
|
const left = (0, combi_1.tok)(tokens_1.ParenLeft);
|
|
12
12
|
const data = (0, combi_1.seq)("DATA", left, _1.TargetField, right);
|
|
13
|
-
|
|
13
|
+
const final = (0, combi_1.seq)("FINAL", left, _1.TargetField, right);
|
|
14
|
+
return (0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v740sp02, data), (0, combi_1.ver)(version_1.Version.v757, final));
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
exports.InlineData = InlineData;
|
|
@@ -4,7 +4,6 @@ exports.Import = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
6
6
|
const expressions_1 = require("../expressions");
|
|
7
|
-
const version_1 = require("../../../version");
|
|
8
7
|
class Import {
|
|
9
8
|
getMatcher() {
|
|
10
9
|
const dto = (0, combi_1.seq)("TO", expressions_1.Target);
|
|
@@ -23,7 +22,7 @@ class Import {
|
|
|
23
22
|
const target = (0, combi_1.alt)(toeq, to, expressions_1.Dynamic, (0, combi_1.plus)(expressions_1.Target));
|
|
24
23
|
const options = (0, combi_1.per)("ACCEPTING PADDING", "IGNORING CONVERSION ERRORS", "IN CHAR-TO-HEX MODE", "IGNORING STRUCTURE BOUNDARIES", "ACCEPTING TRUNCATION", (0, combi_1.seq)("REPLACEMENT CHARACTER", expressions_1.Source), (0, combi_1.seq)("CODE PAGE INTO", expressions_1.Source), (0, combi_1.seq)("ENDIAN INTO", expressions_1.Source));
|
|
25
24
|
const ret = (0, combi_1.seq)("IMPORT", target, "FROM", source, (0, combi_1.opt)(options));
|
|
26
|
-
return
|
|
25
|
+
return ret;
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
exports.Import = Import;
|
|
@@ -22,7 +22,7 @@ class ComponentCompare {
|
|
|
22
22
|
throw new Error("ComponentCompare, source not structured");
|
|
23
23
|
}
|
|
24
24
|
if (type.getComponentByName(fieldName) === undefined) {
|
|
25
|
-
throw new Error("Component " + fieldName + " not part of structure");
|
|
25
|
+
throw new Error("Component \"" + fieldName + "\" not part of structure");
|
|
26
26
|
}
|
|
27
27
|
// todo, check type compatibility
|
|
28
28
|
}
|
|
@@ -4,6 +4,7 @@ exports.Submit = void 0;
|
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const source_1 = require("../expressions/source");
|
|
6
6
|
const target_1 = require("../expressions/target");
|
|
7
|
+
const dynamic_1 = require("../expressions/dynamic");
|
|
7
8
|
class Submit {
|
|
8
9
|
runSyntax(node, scope, filename) {
|
|
9
10
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
@@ -12,6 +13,9 @@ class Submit {
|
|
|
12
13
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
13
14
|
new target_1.Target().runSyntax(t, scope, filename);
|
|
14
15
|
}
|
|
16
|
+
for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
|
|
17
|
+
new dynamic_1.Dynamic().runSyntax(t, scope, filename);
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
exports.Submit = Submit;
|
package/build/src/registry.js
CHANGED
|
@@ -2215,6 +2215,9 @@ ${indentation} output = ${topTarget}.`;
|
|
|
2215
2215
|
else if (c.get() instanceof Expressions.Source) {
|
|
2216
2216
|
code += indent + " " + uniqueName + " = " + c.concatTokens() + ".\n";
|
|
2217
2217
|
}
|
|
2218
|
+
else if (c.get() instanceof Expressions.Throw) {
|
|
2219
|
+
code += indent + " " + c.concatTokens().replace("THROW", "RAISE EXCEPTION NEW") + ".\n";
|
|
2220
|
+
}
|
|
2218
2221
|
else {
|
|
2219
2222
|
throw "buildCondBody, unexpected expression, " + c.get().constructor.name;
|
|
2220
2223
|
}
|
|
@@ -21,7 +21,9 @@ class MethodOverwritesBuiltIn extends _abap_rule_1.ABAPRule {
|
|
|
21
21
|
shortDescription: `Checks Method names that overwrite builtin SAP functions`,
|
|
22
22
|
extendedInformation: `https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenbuilt_in_functions_overview.htm
|
|
23
23
|
|
|
24
|
-
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obscuring-built-in-functions
|
|
24
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obscuring-built-in-functions
|
|
25
|
+
|
|
26
|
+
Interface method names are ignored`,
|
|
25
27
|
tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
26
28
|
};
|
|
27
29
|
}
|
|
@@ -37,9 +39,6 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obscu
|
|
|
37
39
|
for (const classDef of file.getInfo().listClassDefinitions()) {
|
|
38
40
|
methods = methods.concat(classDef.methods);
|
|
39
41
|
}
|
|
40
|
-
for (const intfDef of file.getInfo().listInterfaceDefinitions()) {
|
|
41
|
-
methods = methods.concat(intfDef.methods);
|
|
42
|
-
}
|
|
43
42
|
const builtIn = new _builtin_1.BuiltIn();
|
|
44
43
|
for (const method of methods) {
|
|
45
44
|
if (builtIn.searchBuiltin(method.name.toUpperCase())) {
|
|
@@ -54,6 +54,7 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
|
|
|
54
54
|
if (stru === undefined) {
|
|
55
55
|
return [];
|
|
56
56
|
}
|
|
57
|
+
this.findLocalExceptions(obj);
|
|
57
58
|
this.syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
58
59
|
if (this.syntax.issues.length > 0) {
|
|
59
60
|
return [];
|
|
@@ -176,7 +177,6 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
|
|
|
176
177
|
def.getRaising().forEach(r => { var _a; return (_a = this.sinked) === null || _a === void 0 ? void 0 : _a.push(r); });
|
|
177
178
|
}
|
|
178
179
|
isSinked(name) {
|
|
179
|
-
// todo: ignore dynamic and no_check exceptions
|
|
180
180
|
if (this.sinked === undefined || name === undefined) {
|
|
181
181
|
return true;
|
|
182
182
|
}
|
|
@@ -184,9 +184,13 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
|
|
|
184
184
|
if (sup === "CX_DYNAMIC_CHECK" || sup === "CX_NO_CHECK") {
|
|
185
185
|
return true;
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
const lsup = this.localExceptions[name.toUpperCase()];
|
|
188
|
+
if (lsup === "CX_DYNAMIC_CHECK" || lsup === "CX_NO_CHECK") {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
188
191
|
return this.sinked.some(a => a.toUpperCase() === name.toUpperCase())
|
|
189
|
-
|| (sup !== undefined && this.isSinked(sup) === true)
|
|
192
|
+
|| (sup !== undefined && this.isSinked(sup) === true)
|
|
193
|
+
|| (lsup !== undefined && this.isSinked(lsup) === true);
|
|
190
194
|
}
|
|
191
195
|
findGlobalExceptions() {
|
|
192
196
|
var _a, _b;
|
|
@@ -203,6 +207,17 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
|
|
|
203
207
|
this.globalExceptions[o.getName().toUpperCase()] = (_b = def.superClassName) === null || _b === void 0 ? void 0 : _b.toUpperCase();
|
|
204
208
|
}
|
|
205
209
|
}
|
|
210
|
+
findLocalExceptions(obj) {
|
|
211
|
+
var _a;
|
|
212
|
+
this.localExceptions = {};
|
|
213
|
+
for (const file of obj.getABAPFiles()) {
|
|
214
|
+
for (const def of file.getInfo().listClassDefinitions()) {
|
|
215
|
+
if (def.isLocal === true && def.superClassName !== undefined) {
|
|
216
|
+
this.localExceptions[def.name.toUpperCase()] = (_a = def.superClassName) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
206
221
|
}
|
|
207
222
|
exports.UncaughtException = UncaughtException;
|
|
208
223
|
//# sourceMappingURL=uncaught_exception.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.95.
|
|
3
|
+
"version": "2.95.26",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/mocha": "^10.0.1",
|
|
53
53
|
"@types/node": "^18.14.1",
|
|
54
54
|
"chai": "^4.3.7",
|
|
55
|
-
"eslint": "^8.
|
|
55
|
+
"eslint": "^8.35.0",
|
|
56
56
|
"mocha": "^10.2.0",
|
|
57
57
|
"c8": "^7.13.0",
|
|
58
58
|
"source-map-support": "^0.5.21",
|