@abaplint/core 2.102.14 → 2.102.15
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 +2 -0
- package/build/src/abap/5_syntax/_scope_type.js +1 -0
- package/build/src/abap/5_syntax/statements/include_type.js +1 -1
- package/build/src/abap/5_syntax/statements/method_implementation.js +3 -2
- package/build/src/abap/types/method_parameters.js +13 -6
- package/build/src/lsp/_lookup.js +4 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/function_module_recommendations.js +1 -0
- package/package.json +2 -2
package/build/abaplint.d.ts
CHANGED
|
@@ -3706,6 +3706,7 @@ declare interface IStructure {
|
|
|
3706
3706
|
declare interface IStructureComponent {
|
|
3707
3707
|
name: string;
|
|
3708
3708
|
type: AbstractType;
|
|
3709
|
+
renamingSuffix?: string;
|
|
3709
3710
|
}
|
|
3710
3711
|
|
|
3711
3712
|
declare interface IStructureRunnable {
|
|
@@ -5020,6 +5021,7 @@ export declare enum ScopeType {
|
|
|
5020
5021
|
FunctionModule = "function",
|
|
5021
5022
|
Method = "method",
|
|
5022
5023
|
MethodInstance = "method_instance",
|
|
5024
|
+
MethodDefinition = "method_definition",
|
|
5023
5025
|
For = "for",
|
|
5024
5026
|
Let = "let",
|
|
5025
5027
|
OpenSQL = "open_sql"
|
|
@@ -16,6 +16,7 @@ var ScopeType;
|
|
|
16
16
|
ScopeType["FunctionModule"] = "function";
|
|
17
17
|
ScopeType["Method"] = "method";
|
|
18
18
|
ScopeType["MethodInstance"] = "method_instance";
|
|
19
|
+
ScopeType["MethodDefinition"] = "method_definition";
|
|
19
20
|
ScopeType["For"] = "for";
|
|
20
21
|
ScopeType["Let"] = "let";
|
|
21
22
|
ScopeType["OpenSQL"] = "open_sql";
|
|
@@ -19,11 +19,12 @@ class MethodImplementation {
|
|
|
19
19
|
if (methodDefinition === undefined) {
|
|
20
20
|
throw new Error("Method definition \"" + methodName + "\" not found");
|
|
21
21
|
}
|
|
22
|
+
const start = node.getFirstToken().getStart();
|
|
22
23
|
if (methodDefinition.isStatic() === false) {
|
|
23
|
-
scope.push(_scope_type_1.ScopeType.MethodInstance, methodName,
|
|
24
|
+
scope.push(_scope_type_1.ScopeType.MethodInstance, methodName, start, filename);
|
|
24
25
|
scope.addList(classDefinition.getAttributes().getInstance());
|
|
25
26
|
}
|
|
26
|
-
scope.push(_scope_type_1.ScopeType.Method, methodName,
|
|
27
|
+
scope.push(_scope_type_1.ScopeType.Method, methodName, start, filename);
|
|
27
28
|
scope.addReference(methodToken, methodDefinition, _reference_1.ReferenceType.MethodImplementationReference, filename);
|
|
28
29
|
scope.addList(methodDefinition.getParameters().getAll());
|
|
29
30
|
for (const i of helper.findInterfaces(classDefinition)) {
|
|
@@ -11,6 +11,7 @@ const method_param_1 = require("../5_syntax/expressions/method_param");
|
|
|
11
11
|
const _object_oriented_1 = require("../5_syntax/_object_oriented");
|
|
12
12
|
const _reference_1 = require("../5_syntax/_reference");
|
|
13
13
|
const identifier_1 = require("../1_lexer/tokens/identifier");
|
|
14
|
+
const _scope_type_1 = require("../5_syntax/_scope_type");
|
|
14
15
|
// todo:
|
|
15
16
|
// this.exceptions = [];
|
|
16
17
|
// also consider RAISING vs EXCEPTIONS
|
|
@@ -28,7 +29,11 @@ class MethodParameters {
|
|
|
28
29
|
this.preferred = undefined;
|
|
29
30
|
this.exceptions = [];
|
|
30
31
|
this.filename = filename;
|
|
31
|
-
|
|
32
|
+
// need the scope for LIKE typing inside method parameters
|
|
33
|
+
const parentName = scope.getName();
|
|
34
|
+
scope.push(_scope_type_1.ScopeType.MethodDefinition, "method definition", node.getStart(), filename);
|
|
35
|
+
this.parse(node, scope, filename, parentName);
|
|
36
|
+
scope.pop(node.getEnd());
|
|
32
37
|
}
|
|
33
38
|
getFilename() {
|
|
34
39
|
return this.filename;
|
|
@@ -103,7 +108,7 @@ class MethodParameters {
|
|
|
103
108
|
return this.defaults[parameter.toUpperCase()];
|
|
104
109
|
}
|
|
105
110
|
///////////////////
|
|
106
|
-
parse(node, scope, filename) {
|
|
111
|
+
parse(node, scope, filename, parentName) {
|
|
107
112
|
var _a, _b;
|
|
108
113
|
const handler = node.findFirstExpression(Expressions.EventHandler);
|
|
109
114
|
if (handler) {
|
|
@@ -163,9 +168,9 @@ class MethodParameters {
|
|
|
163
168
|
if (returning) {
|
|
164
169
|
this.returning = new method_def_returning_1.MethodDefReturning().runSyntax(returning, scope, this.filename, ["returning" /* IdentifierMeta.MethodReturning */]);
|
|
165
170
|
}
|
|
166
|
-
this.workaroundRAP(node, scope, filename);
|
|
171
|
+
this.workaroundRAP(node, scope, filename, parentName);
|
|
167
172
|
}
|
|
168
|
-
workaroundRAP(node,
|
|
173
|
+
workaroundRAP(node, _scope, filename, parentName) {
|
|
169
174
|
const resultName = node.findExpressionAfterToken("RESULT");
|
|
170
175
|
const isRap = node.findExpressionAfterToken("IMPORTING");
|
|
171
176
|
if (isRap) {
|
|
@@ -190,7 +195,7 @@ class MethodParameters {
|
|
|
190
195
|
this.importing.push(new _typed_identifier_1.TypedIdentifier(token, filename, new basic_1.VoidType("RapMethodParameter"), ["exporting" /* IdentifierMeta.MethodExporting */]));
|
|
191
196
|
}
|
|
192
197
|
// its some kind of magic
|
|
193
|
-
if (
|
|
198
|
+
if (parentName.toUpperCase() === "CL_ABAP_BEHAVIOR_SAVER") {
|
|
194
199
|
const tempChanging = this.changing.map(c => new _typed_identifier_1.TypedIdentifier(c.getToken(), filename, new basic_1.VoidType("RapMethodParameter"), c.getMeta()));
|
|
195
200
|
while (this.changing.length > 0) {
|
|
196
201
|
this.changing.shift();
|
|
@@ -217,7 +222,9 @@ class MethodParameters {
|
|
|
217
222
|
else if (meta.includes("importing" /* IdentifierMeta.MethodImporting */)) {
|
|
218
223
|
extraMeta.push("read_only" /* IdentifierMeta.ReadOnly */);
|
|
219
224
|
}
|
|
220
|
-
|
|
225
|
+
const id = new method_param_1.MethodParam().runSyntax(p, scope, this.filename, [...meta, ...extraMeta]);
|
|
226
|
+
scope.addIdentifier(id);
|
|
227
|
+
target.push(id);
|
|
221
228
|
if (opt.getLastToken().getStr().toUpperCase() === "OPTIONAL") {
|
|
222
229
|
const name = target[target.length - 1].getName().toUpperCase();
|
|
223
230
|
this.optional.push(name);
|
package/build/src/lsp/_lookup.js
CHANGED
|
@@ -55,7 +55,7 @@ class LSPLookup {
|
|
|
55
55
|
const hover = "Type Definition, " + cursor.token.getStr() + "\n\n" + this.dumpType(type);
|
|
56
56
|
return { hover, definition: found, definitionId: type, scope: bottomScope };
|
|
57
57
|
}
|
|
58
|
-
const method = this.findMethodDefinition(cursor, bottomScope);
|
|
58
|
+
const method = this.findMethodDefinition(cursor, bottomScope.getParent());
|
|
59
59
|
if (method !== undefined && method.getStart().equals(cursor.token.getStart())) {
|
|
60
60
|
const found = _lsp_utils_1.LSPUtils.identiferToLocation(method);
|
|
61
61
|
const hover = "Method Definition \"" + method.getName() + "\"";
|
|
@@ -272,6 +272,9 @@ class LSPLookup {
|
|
|
272
272
|
}
|
|
273
273
|
static findMethodDefinition(found, scope) {
|
|
274
274
|
var _a, _b, _c, _d;
|
|
275
|
+
if (scope === undefined) {
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
275
278
|
if (scope.getIdentifier().stype !== _scope_type_1.ScopeType.ClassDefinition
|
|
276
279
|
|| !(found.snode.get() instanceof Statements.MethodDef)) {
|
|
277
280
|
return undefined;
|
package/build/src/registry.js
CHANGED
|
@@ -30,6 +30,7 @@ class FunctionModuleRecommendationsConf extends _basic_rule_config_1.BasicRuleCo
|
|
|
30
30
|
{ name: "POPUP_TO_CONFIRM_STEP", replace: "use POPUP_TO_CONFIRM" },
|
|
31
31
|
{ name: "POPUP_TO_DECIDE", replace: "use POPUP_TO_CONFIRM" },
|
|
32
32
|
{ name: "POPUP_TO_GET_VALUE", replace: "use POPUP_GET_VALUES" },
|
|
33
|
+
{ name: "QF05_RANDOM_INTEGER", replace: "use CL_ABAP_RANDOM_INT" },
|
|
33
34
|
{ name: "REUSE_ALV_GRID_DISPLAY", replace: "use CL_SALV_TABLE=>FACTORY or CL_GUI_ALV_GRID" },
|
|
34
35
|
{ name: "ROUND", replace: "use built in function: round()" },
|
|
35
36
|
{ name: "SAPGUI_PROGRESS_INDICATOR", replace: "use CL_PROGRESS_INDICATOR" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.102.
|
|
3
|
+
"version": "2.102.15",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@microsoft/api-extractor": "^7.36.3",
|
|
54
54
|
"@types/chai": "^4.3.5",
|
|
55
55
|
"@types/mocha": "^10.0.1",
|
|
56
|
-
"@types/node": "^20.4.
|
|
56
|
+
"@types/node": "^20.4.8",
|
|
57
57
|
"chai": "^4.3.7",
|
|
58
58
|
"eslint": "^8.46.0",
|
|
59
59
|
"mocha": "^10.2.0",
|