@abaplint/core 2.101.2 → 2.101.4
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.
|
@@ -116,7 +116,7 @@ class ABAPFileInformation {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
parseClasses(structure) {
|
|
119
|
-
var _a
|
|
119
|
+
var _a;
|
|
120
120
|
for (const found of structure.findAllStructures(Structures.ClassDefinition)) {
|
|
121
121
|
const className = found.findFirstStatement(Statements.ClassDefinition).findFirstExpression(Expressions.ClassName).getFirstToken();
|
|
122
122
|
const methods = this.parseMethodDefinition(found.findFirstStructure(Structures.PublicSection), visibility_1.Visibility.Public);
|
|
@@ -135,8 +135,26 @@ class ABAPFileInformation {
|
|
|
135
135
|
const containsGlobal = found.findFirstExpression(Expressions.ClassGlobal);
|
|
136
136
|
const cdef = found.findFirstStatement(Statements.ClassDefinition);
|
|
137
137
|
const concat = (cdef === null || cdef === void 0 ? void 0 : cdef.concatTokens().toUpperCase()) || "";
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
let riskLevel;
|
|
139
|
+
if (concat.includes("RISK LEVEL CRITICAL")) {
|
|
140
|
+
riskLevel = _abap_file_information_1.RiskLevel.critical;
|
|
141
|
+
}
|
|
142
|
+
else if (concat.includes("RISK LEVEL DANGEROUS")) {
|
|
143
|
+
riskLevel = _abap_file_information_1.RiskLevel.dangerous;
|
|
144
|
+
}
|
|
145
|
+
else if (concat.includes("RISK LEVEL HARMLESS")) {
|
|
146
|
+
riskLevel = _abap_file_information_1.RiskLevel.harmless;
|
|
147
|
+
}
|
|
148
|
+
let duration;
|
|
149
|
+
if (concat.includes("DURATION SHORT")) {
|
|
150
|
+
duration = _abap_file_information_1.Duration.short;
|
|
151
|
+
}
|
|
152
|
+
else if (concat.includes("DURATION LONG")) {
|
|
153
|
+
duration = _abap_file_information_1.Duration.long;
|
|
154
|
+
}
|
|
155
|
+
else if (concat.includes("DURATION MEDIUM")) {
|
|
156
|
+
duration = _abap_file_information_1.Duration.medium;
|
|
157
|
+
}
|
|
140
158
|
this.classes.push({
|
|
141
159
|
name: className.getStr(),
|
|
142
160
|
identifier: new _identifier_1.Identifier(className, this.filename),
|
|
@@ -8,45 +8,50 @@ const _reference_1 = require("../_reference");
|
|
|
8
8
|
const basic_1 = require("../../types/basic");
|
|
9
9
|
const message_source_1 = require("../expressions/message_source");
|
|
10
10
|
const raise_with_1 = require("../expressions/raise_with");
|
|
11
|
+
const _object_oriented_1 = require("../_object_oriented");
|
|
12
|
+
const method_parameters_1 = require("../expressions/method_parameters");
|
|
11
13
|
class Raise {
|
|
12
14
|
runSyntax(node, scope, filename) {
|
|
13
15
|
// todo
|
|
14
|
-
var _a, _b, _c;
|
|
16
|
+
var _a, _b, _c, _d, _e;
|
|
17
|
+
const helper = new _object_oriented_1.ObjectOriented(scope);
|
|
18
|
+
let method;
|
|
15
19
|
const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const found = scope.existsObject(
|
|
20
|
+
const className = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
|
|
21
|
+
if (className) {
|
|
22
|
+
const found = scope.existsObject(className);
|
|
19
23
|
if (found.found === true && found.id) {
|
|
20
24
|
scope.addReference(classTok, found.id, found.type, filename);
|
|
25
|
+
const def = scope.findObjectDefinition(className);
|
|
26
|
+
method = (_b = helper.searchMethodName(def, "CONSTRUCTOR")) === null || _b === void 0 ? void 0 : _b.method;
|
|
21
27
|
}
|
|
22
|
-
else if (scope.getDDIC().inErrorNamespace(
|
|
23
|
-
const extra = { ooName:
|
|
28
|
+
else if (scope.getDDIC().inErrorNamespace(className) === false) {
|
|
29
|
+
const extra = { ooName: className, ooType: "Void" };
|
|
24
30
|
scope.addReference(classTok, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, extra);
|
|
31
|
+
method = new basic_1.VoidType(className);
|
|
25
32
|
}
|
|
26
33
|
else {
|
|
27
|
-
throw new Error("RAISE, unknown class " +
|
|
34
|
+
throw new Error("RAISE, unknown class " + className);
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const c = node.findExpressionAfterToken("EXCEPTION");
|
|
38
|
+
if (c instanceof nodes_1.ExpressionNode && (c.get() instanceof Expressions.SimpleSource2 || c.get() instanceof Expressions.Source)) {
|
|
39
|
+
const type = new source_1.Source().runSyntax(c, scope, filename);
|
|
40
|
+
if (type instanceof basic_1.VoidType) {
|
|
41
|
+
method = type;
|
|
42
|
+
}
|
|
43
|
+
else if (type instanceof basic_1.ObjectReferenceType) {
|
|
44
|
+
const def = scope.findObjectDefinition(type.getIdentifierName());
|
|
45
|
+
method = (_c = helper.searchMethodName(def, "CONSTRUCTOR")) === null || _c === void 0 ? void 0 : _c.method;
|
|
46
|
+
}
|
|
47
|
+
else if (type !== undefined) {
|
|
48
|
+
throw new Error("RAISE EXCEPTION, must be object reference, got " + type.constructor.name);
|
|
41
49
|
}
|
|
42
|
-
prev = c.concatTokens().toUpperCase();
|
|
43
50
|
}
|
|
44
|
-
//
|
|
51
|
+
// check parameters vs constructor
|
|
45
52
|
const param = node.findDirectExpression(Expressions.ParameterListS);
|
|
46
53
|
if (param) {
|
|
47
|
-
|
|
48
|
-
new source_1.Source().runSyntax(s, scope, filename);
|
|
49
|
-
}
|
|
54
|
+
new method_parameters_1.MethodParameters().checkExporting(param, scope, method, filename, true);
|
|
50
55
|
}
|
|
51
56
|
for (const s of node.findDirectExpressions(Expressions.RaiseWith)) {
|
|
52
57
|
new raise_with_1.RaiseWith().runSyntax(s, scope, filename);
|
|
@@ -60,8 +65,8 @@ class Raise {
|
|
|
60
65
|
for (const s of node.findDirectExpressions(Expressions.MessageSource)) {
|
|
61
66
|
new message_source_1.MessageSource().runSyntax(s, scope, filename);
|
|
62
67
|
}
|
|
63
|
-
const id = (
|
|
64
|
-
const number = (
|
|
68
|
+
const id = (_d = node.findExpressionAfterToken("ID")) === null || _d === void 0 ? void 0 : _d.concatTokens();
|
|
69
|
+
const number = (_e = node.findDirectExpression(Expressions.MessageNumber)) === null || _e === void 0 ? void 0 : _e.concatTokens();
|
|
65
70
|
if ((id === null || id === void 0 ? void 0 : id.startsWith("'")) && number) {
|
|
66
71
|
const messageClass = id.substring(1, id.length - 1).toUpperCase();
|
|
67
72
|
scope.getMSAGReferences().addUsing(filename, node.getFirstToken(), messageClass, number);
|
package/build/src/registry.js
CHANGED