@abaplint/core 2.83.15 → 2.83.16
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/abaplint.d.ts +8 -0
- package/build/src/abap/2_statements/expressions/index.js +1 -0
- package/build/src/abap/2_statements/expressions/method_def_exceptions.js +13 -0
- package/build/src/abap/2_statements/statements/method_def.js +2 -3
- package/build/src/abap/types/method_definition.js +10 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/use_class_based_exceptions.js +2 -1
- package/package.json +2 -2
package/build/abaplint.d.ts
CHANGED
|
@@ -1857,6 +1857,7 @@ declare namespace Expressions {
|
|
|
1857
1857
|
MethodDefImporting,
|
|
1858
1858
|
MethodDefRaising,
|
|
1859
1859
|
MethodDefReturning,
|
|
1860
|
+
MethodDefExceptions,
|
|
1860
1861
|
MethodName,
|
|
1861
1862
|
MethodParamName,
|
|
1862
1863
|
MethodParamOptional,
|
|
@@ -2777,6 +2778,7 @@ export declare interface IMethodDefinition extends Identifier {
|
|
|
2777
2778
|
isEventHandler(): boolean;
|
|
2778
2779
|
getParameters(): IMethodParameters;
|
|
2779
2780
|
getRaising(): readonly string[];
|
|
2781
|
+
getExceptions(): readonly string[];
|
|
2780
2782
|
}
|
|
2781
2783
|
|
|
2782
2784
|
declare interface IMethodDefinitions {
|
|
@@ -3587,6 +3589,10 @@ declare class MethodDefChanging extends Expression {
|
|
|
3587
3589
|
getRunnable(): IStatementRunnable;
|
|
3588
3590
|
}
|
|
3589
3591
|
|
|
3592
|
+
declare class MethodDefExceptions extends Expression {
|
|
3593
|
+
getRunnable(): IStatementRunnable;
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3590
3596
|
declare class MethodDefExporting extends Expression {
|
|
3591
3597
|
getRunnable(): IStatementRunnable;
|
|
3592
3598
|
}
|
|
@@ -3603,6 +3609,7 @@ declare class MethodDefinition extends Identifier implements IMethodDefinition {
|
|
|
3603
3609
|
private readonly abstract;
|
|
3604
3610
|
private readonly static;
|
|
3605
3611
|
private readonly raising;
|
|
3612
|
+
private readonly exceptions;
|
|
3606
3613
|
constructor(node: StatementNode, visibility: Visibility, filename: string, scope: CurrentScope);
|
|
3607
3614
|
getVisibility(): Visibility;
|
|
3608
3615
|
isRedefinition(): boolean;
|
|
@@ -3611,6 +3618,7 @@ declare class MethodDefinition extends Identifier implements IMethodDefinition {
|
|
|
3611
3618
|
isEventHandler(): boolean;
|
|
3612
3619
|
getParameters(): MethodParameters_2;
|
|
3613
3620
|
getRaising(): readonly string[];
|
|
3621
|
+
getExceptions(): readonly string[];
|
|
3614
3622
|
}
|
|
3615
3623
|
|
|
3616
3624
|
declare class MethodDefinitions implements IMethodDefinitions {
|
|
@@ -105,6 +105,7 @@ __exportStar(require("./method_def_exporting"), exports);
|
|
|
105
105
|
__exportStar(require("./method_def_importing"), exports);
|
|
106
106
|
__exportStar(require("./method_def_raising"), exports);
|
|
107
107
|
__exportStar(require("./method_def_returning"), exports);
|
|
108
|
+
__exportStar(require("./method_def_exceptions"), exports);
|
|
108
109
|
__exportStar(require("./method_name"), exports);
|
|
109
110
|
__exportStar(require("./method_param_name"), exports);
|
|
110
111
|
__exportStar(require("./method_param_optional"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MethodDefExceptions = void 0;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
class MethodDefExceptions extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.plusPrio)(_1.NamespaceSimpleName));
|
|
9
|
+
return exceptions;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.MethodDefExceptions = MethodDefExceptions;
|
|
13
|
+
//# sourceMappingURL=method_def_exceptions.js.map
|
|
@@ -6,10 +6,9 @@ const combi_1 = require("../combi");
|
|
|
6
6
|
const expressions_1 = require("../expressions");
|
|
7
7
|
class MethodDef {
|
|
8
8
|
getMatcher() {
|
|
9
|
-
const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.plusPrio)(expressions_1.NamespaceSimpleName));
|
|
10
9
|
const def = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.seq)("DEFAULT", (0, combi_1.altPrio)("FAIL", "IGNORE")));
|
|
11
|
-
const parameters = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("FINAL", def, expressions_1.Abstract)), (0, combi_1.optPrio)(expressions_1.MethodDefImporting), (0, combi_1.optPrio)(expressions_1.MethodDefExporting), (0, combi_1.optPrio)(expressions_1.MethodDefChanging), (0, combi_1.optPrio)(expressions_1.MethodDefReturning), (0, combi_1.optPrio)((0, combi_1.altPrio)(expressions_1.MethodDefRaising,
|
|
12
|
-
const testing = (0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), "FOR TESTING", (0, combi_1.optPrio)((0, combi_1.altPrio)(expressions_1.MethodDefRaising,
|
|
10
|
+
const parameters = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("FINAL", def, expressions_1.Abstract)), (0, combi_1.optPrio)(expressions_1.MethodDefImporting), (0, combi_1.optPrio)(expressions_1.MethodDefExporting), (0, combi_1.optPrio)(expressions_1.MethodDefChanging), (0, combi_1.optPrio)(expressions_1.MethodDefReturning), (0, combi_1.optPrio)((0, combi_1.altPrio)(expressions_1.MethodDefRaising, expressions_1.MethodDefExceptions)));
|
|
11
|
+
const testing = (0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), "FOR TESTING", (0, combi_1.optPrio)((0, combi_1.altPrio)(expressions_1.MethodDefRaising, expressions_1.MethodDefExceptions)));
|
|
13
12
|
// todo, this is only from version something
|
|
14
13
|
const tableFunction = (0, combi_1.seq)("FOR TABLE FUNCTION", (0, combi_1.regex)(/^\w+?$/));
|
|
15
14
|
// todo, this is only from version something
|
|
@@ -9,7 +9,7 @@ const _reference_1 = require("../5_syntax/_reference");
|
|
|
9
9
|
class MethodDefinition extends _identifier_1.Identifier {
|
|
10
10
|
// todo: final flag
|
|
11
11
|
constructor(node, visibility, filename, scope) {
|
|
12
|
-
var _a;
|
|
12
|
+
var _a, _b;
|
|
13
13
|
if (!(node.get() instanceof statements_1.MethodDef)) {
|
|
14
14
|
throw new Error("MethodDefinition, expected MethodDef as part of input node");
|
|
15
15
|
}
|
|
@@ -58,6 +58,12 @@ class MethodDefinition extends _identifier_1.Identifier {
|
|
|
58
58
|
scope.addReference(token, clas, _reference_1.ReferenceType.ObjectOrientedUnknownReference, filename, { ooName: name.toUpperCase(), ooType: "CLAS" });
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
this.exceptions = [];
|
|
62
|
+
for (const r of ((_b = node.findDirectExpression(Expressions.MethodDefExceptions)) === null || _b === void 0 ? void 0 : _b.findAllExpressions(Expressions.NamespaceSimpleName)) || []) {
|
|
63
|
+
const token = r.getFirstToken();
|
|
64
|
+
const name = token.getStr();
|
|
65
|
+
this.exceptions.push(name);
|
|
66
|
+
}
|
|
61
67
|
this.visibility = visibility;
|
|
62
68
|
this.parameters = new method_parameters_1.MethodParameters(node, this.filename, scope);
|
|
63
69
|
}
|
|
@@ -82,6 +88,9 @@ class MethodDefinition extends _identifier_1.Identifier {
|
|
|
82
88
|
getRaising() {
|
|
83
89
|
return this.raising;
|
|
84
90
|
}
|
|
91
|
+
getExceptions() {
|
|
92
|
+
return this.exceptions;
|
|
93
|
+
}
|
|
85
94
|
}
|
|
86
95
|
exports.MethodDefinition = MethodDefinition;
|
|
87
96
|
//# sourceMappingURL=method_definition.js.map
|
package/build/src/registry.js
CHANGED
|
@@ -5,6 +5,7 @@ const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
|
5
5
|
const _abap_rule_1 = require("./_abap_rule");
|
|
6
6
|
const _irule_1 = require("./_irule");
|
|
7
7
|
const Statements = require("../abap/2_statements/statements");
|
|
8
|
+
const Expressions = require("../abap/2_statements/expressions");
|
|
8
9
|
const issue_1 = require("../issue");
|
|
9
10
|
class UseClassBasedExceptionsConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
10
11
|
}
|
|
@@ -36,7 +37,7 @@ class UseClassBasedExceptions extends _abap_rule_1.ABAPRule {
|
|
|
36
37
|
var _a;
|
|
37
38
|
const issues = [];
|
|
38
39
|
for (const s of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.MethodDef)) || []) {
|
|
39
|
-
if (s.
|
|
40
|
+
if (s.findDirectExpression(Expressions.MethodDefExceptions)) {
|
|
40
41
|
issues.push(issue_1.Issue.atStatement(file, s, this.getMessage(), this.getMetadata().key));
|
|
41
42
|
}
|
|
42
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.83.
|
|
3
|
+
"version": "2.83.16",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@types/mocha": "^9.0.0",
|
|
51
51
|
"@types/node": "^17.0.5",
|
|
52
52
|
"chai": "^4.3.4",
|
|
53
|
-
"eslint": "^8.
|
|
53
|
+
"eslint": "^8.6.0",
|
|
54
54
|
"mocha": "^9.1.3",
|
|
55
55
|
"c8": "^7.11.0",
|
|
56
56
|
"source-map-support": "^0.5.21",
|