@abaplint/core 2.115.17 → 2.115.18
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 +12 -2
- package/build/src/abap/5_syntax/statements/assign.js +5 -4
- package/build/src/abap/types/message.js +8 -1
- package/build/src/objects/message_class.js +21 -10
- package/build/src/registry.js +1 -1
- package/build/src/rules/msag_consistency.js +13 -0
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -4430,7 +4430,9 @@ export declare class MemoryFile extends AbstractFile {
|
|
|
4430
4430
|
declare class Message {
|
|
4431
4431
|
private readonly number;
|
|
4432
4432
|
private readonly message;
|
|
4433
|
-
|
|
4433
|
+
private readonly className;
|
|
4434
|
+
constructor(number: string, message: string, className: string);
|
|
4435
|
+
getMessageClass(): string;
|
|
4434
4436
|
getNumber(): string;
|
|
4435
4437
|
getMessage(): string;
|
|
4436
4438
|
getPlaceholderCount(): number;
|
|
@@ -4441,13 +4443,14 @@ declare class Message_2 implements IStatement {
|
|
|
4441
4443
|
}
|
|
4442
4444
|
|
|
4443
4445
|
declare class MessageClass extends AbstractObject {
|
|
4444
|
-
private
|
|
4446
|
+
private xml;
|
|
4445
4447
|
getType(): string;
|
|
4446
4448
|
getDescription(): string | undefined;
|
|
4447
4449
|
getAllowedNaming(): {
|
|
4448
4450
|
maxLength: number;
|
|
4449
4451
|
allowNamespace: boolean;
|
|
4450
4452
|
};
|
|
4453
|
+
getParsed(): parsedMessageClass | undefined;
|
|
4451
4454
|
setDirty(): void;
|
|
4452
4455
|
getMessages(): readonly Message[];
|
|
4453
4456
|
getByNumber(num: string): Message | undefined;
|
|
@@ -5118,6 +5121,7 @@ declare namespace Objects {
|
|
|
5118
5121
|
KnowledgeTransferDocument,
|
|
5119
5122
|
LockObject,
|
|
5120
5123
|
MaintenanceAndTransportObject,
|
|
5124
|
+
parsedMessageClass,
|
|
5121
5125
|
MessageClass,
|
|
5122
5126
|
MessagingChannel,
|
|
5123
5127
|
MIMEObject,
|
|
@@ -5359,6 +5363,12 @@ declare type ParsedDataDefinition = {
|
|
|
5359
5363
|
tree: ExpressionNode | undefined;
|
|
5360
5364
|
};
|
|
5361
5365
|
|
|
5366
|
+
declare type parsedMessageClass = {
|
|
5367
|
+
topName: string | undefined;
|
|
5368
|
+
description: string | undefined;
|
|
5369
|
+
parsedMessages: Message[] | undefined;
|
|
5370
|
+
};
|
|
5371
|
+
|
|
5362
5372
|
declare type ParsedMetadataExtension = {
|
|
5363
5373
|
tree: ExpressionNode | undefined;
|
|
5364
5374
|
};
|
|
@@ -10,8 +10,9 @@ const _type_utils_1 = require("../_type_utils");
|
|
|
10
10
|
const _syntax_input_1 = require("../_syntax_input");
|
|
11
11
|
class Assign {
|
|
12
12
|
runSyntax(node, input) {
|
|
13
|
-
var _a
|
|
13
|
+
var _a;
|
|
14
14
|
const assignSource = node.findDirectExpression(Expressions.AssignSource);
|
|
15
|
+
const isComponent = ((_a = assignSource === null || assignSource === void 0 ? void 0 : assignSource.getFirstChild()) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === "COMPONENT";
|
|
15
16
|
const sources = (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpressionsMulti([Expressions.Source, Expressions.SimpleSource3])) || [];
|
|
16
17
|
const theSource = sources[sources.length - 1];
|
|
17
18
|
let sourceType = undefined;
|
|
@@ -29,10 +30,10 @@ class Assign {
|
|
|
29
30
|
sourceType = basic_1.VoidType.get("Dynamic");
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
|
-
sourceType = source_1.Source.runSyntax(theSource, input, undefined, false,
|
|
33
|
+
sourceType = source_1.Source.runSyntax(theSource, input, undefined, false, isComponent === false);
|
|
33
34
|
}
|
|
34
35
|
if ((assignSource === null || assignSource === void 0 ? void 0 : assignSource.getChildren().length) === 5
|
|
35
|
-
&&
|
|
36
|
+
&& isComponent) {
|
|
36
37
|
const componentSource = sources[sources.length - 2];
|
|
37
38
|
const componentType = source_1.Source.runSyntax(componentSource, input);
|
|
38
39
|
if (new _type_utils_1.TypeUtils(input.scope).isAssignable(componentType, new basic_1.CharacterType(30)) === false) {
|
|
@@ -49,7 +50,7 @@ class Assign {
|
|
|
49
50
|
}
|
|
50
51
|
const target = node.findDirectExpression(Expressions.FSTarget);
|
|
51
52
|
if (target) {
|
|
52
|
-
if (
|
|
53
|
+
if (isComponent) {
|
|
53
54
|
fstarget_1.FSTarget.runSyntax(target, input, basic_1.AnyType.get());
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Message = void 0;
|
|
4
4
|
class Message {
|
|
5
|
-
constructor(number, message) {
|
|
5
|
+
constructor(number, message, className) {
|
|
6
6
|
this.number = number;
|
|
7
7
|
if (this.number === undefined) {
|
|
8
8
|
this.number = "";
|
|
@@ -11,6 +11,13 @@ class Message {
|
|
|
11
11
|
if (this.message === undefined) {
|
|
12
12
|
this.message = "";
|
|
13
13
|
}
|
|
14
|
+
this.className = className;
|
|
15
|
+
if (this.className === undefined) {
|
|
16
|
+
this.className = "";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
getMessageClass() {
|
|
20
|
+
return this.className;
|
|
14
21
|
}
|
|
15
22
|
getNumber() {
|
|
16
23
|
return this.number;
|
|
@@ -7,15 +7,15 @@ const xml_utils_1 = require("../xml_utils");
|
|
|
7
7
|
class MessageClass extends _abstract_object_1.AbstractObject {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
|
-
this.
|
|
10
|
+
this.xml = undefined;
|
|
11
11
|
}
|
|
12
12
|
getType() {
|
|
13
13
|
return "MSAG";
|
|
14
14
|
}
|
|
15
15
|
getDescription() {
|
|
16
|
+
var _a;
|
|
16
17
|
this.parseXML();
|
|
17
|
-
|
|
18
|
-
return undefined;
|
|
18
|
+
return (_a = this.xml) === null || _a === void 0 ? void 0 : _a.description;
|
|
19
19
|
}
|
|
20
20
|
getAllowedNaming() {
|
|
21
21
|
return {
|
|
@@ -23,13 +23,18 @@ class MessageClass extends _abstract_object_1.AbstractObject {
|
|
|
23
23
|
allowNamespace: true,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
getParsed() {
|
|
27
|
+
this.parseXML();
|
|
28
|
+
return this.xml;
|
|
29
|
+
}
|
|
26
30
|
setDirty() {
|
|
27
|
-
this.
|
|
31
|
+
this.xml = undefined;
|
|
28
32
|
super.setDirty();
|
|
29
33
|
}
|
|
30
34
|
getMessages() {
|
|
35
|
+
var _a;
|
|
31
36
|
this.parseXML();
|
|
32
|
-
const msg = this.parsedMessages;
|
|
37
|
+
const msg = (_a = this.xml) === null || _a === void 0 ? void 0 : _a.parsedMessages;
|
|
33
38
|
return msg ? msg : [];
|
|
34
39
|
}
|
|
35
40
|
getByNumber(num) {
|
|
@@ -44,21 +49,27 @@ class MessageClass extends _abstract_object_1.AbstractObject {
|
|
|
44
49
|
}
|
|
45
50
|
/////////////////////////////////
|
|
46
51
|
parseXML() {
|
|
47
|
-
var _a, _b;
|
|
48
|
-
if (this.
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
53
|
+
if (this.xml !== undefined) {
|
|
49
54
|
return;
|
|
50
55
|
}
|
|
51
|
-
this.
|
|
56
|
+
this.xml = {
|
|
57
|
+
topName: undefined,
|
|
58
|
+
description: undefined,
|
|
59
|
+
parsedMessages: [],
|
|
60
|
+
};
|
|
52
61
|
const parsed = super.parseRaw2();
|
|
53
62
|
if (parsed === undefined) {
|
|
54
63
|
return;
|
|
55
64
|
}
|
|
56
|
-
|
|
65
|
+
this.xml.topName = (_c = (_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]["asx:values"]) === null || _b === void 0 ? void 0 : _b.T100A) === null || _c === void 0 ? void 0 : _c.ARBGB;
|
|
66
|
+
this.xml.description = (_f = (_e = (_d = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _d === void 0 ? void 0 : _d["asx:abap"]["asx:values"]) === null || _e === void 0 ? void 0 : _e.T100A) === null || _f === void 0 ? void 0 : _f.STEXT;
|
|
67
|
+
const t100 = (_h = (_g = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _g === void 0 ? void 0 : _g["asx:abap"]["asx:values"]) === null || _h === void 0 ? void 0 : _h.T100;
|
|
57
68
|
if (t100 === undefined) {
|
|
58
69
|
return;
|
|
59
70
|
}
|
|
60
71
|
for (const msg of (0, xml_utils_1.xmlToArray)(t100.T100)) {
|
|
61
|
-
this.parsedMessages.push(new message_1.Message(msg.MSGNR, (0, xml_utils_1.unescape)(msg.TEXT)));
|
|
72
|
+
this.xml.parsedMessages.push(new message_1.Message(msg.MSGNR, (0, xml_utils_1.unescape)(msg.TEXT), msg.ARBGB));
|
|
62
73
|
}
|
|
63
74
|
}
|
|
64
75
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -38,6 +38,7 @@ class MSAGConsistency {
|
|
|
38
38
|
return this;
|
|
39
39
|
}
|
|
40
40
|
run(obj) {
|
|
41
|
+
var _a, _b;
|
|
41
42
|
const issues = [];
|
|
42
43
|
if (!(obj instanceof objects_1.MessageClass)) {
|
|
43
44
|
return [];
|
|
@@ -86,6 +87,18 @@ class MSAGConsistency {
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
}
|
|
90
|
+
if (message.getMessageClass() !== obj.getName()) {
|
|
91
|
+
const text = `Message class "${message.getMessageClass()}" does not match filename "${obj.getName()}" for message ${message.getNumber()}`;
|
|
92
|
+
const position = new position_1.Position(1, 1);
|
|
93
|
+
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
|
|
94
|
+
issues.push(issue);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (((_a = obj.getParsed()) === null || _a === void 0 ? void 0 : _a.topName) !== obj.getName()) {
|
|
98
|
+
const text = `Message class name "${(_b = obj.getParsed()) === null || _b === void 0 ? void 0 : _b.topName}" does not match filename "${obj.getName()}"`;
|
|
99
|
+
const position = new position_1.Position(1, 1);
|
|
100
|
+
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
|
|
101
|
+
issues.push(issue);
|
|
89
102
|
}
|
|
90
103
|
return issues;
|
|
91
104
|
}
|