@abaplint/core 2.115.18 → 2.115.20
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/function_parameters.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_field.js +2 -1
- package/build/src/lsp/_lookup.js +23 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/index.js +1 -0
- package/build/src/rules/parser_bad_exceptions.js +55 -0
- package/package.json +5 -5
|
@@ -9,7 +9,7 @@ class FunctionParameters extends combi_1.Expression {
|
|
|
9
9
|
const importing = (0, combi_1.seq)("IMPORTING", _1.ParameterListT);
|
|
10
10
|
const changing = (0, combi_1.seq)("CHANGING", _1.ParameterListT);
|
|
11
11
|
const tables = (0, combi_1.seq)("TABLES", _1.ParameterListT);
|
|
12
|
-
const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.
|
|
12
|
+
const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.altPrio)(_1.ParameterListExceptions, (0, combi_1.plus)(_1.Field)));
|
|
13
13
|
const long = (0, combi_1.seq)((0, combi_1.optPrio)(exporting), (0, combi_1.optPrio)(importing), (0, combi_1.optPrio)(tables), (0, combi_1.optPrio)(changing), (0, combi_1.optPrio)(exceptions));
|
|
14
14
|
return long;
|
|
15
15
|
}
|
|
@@ -9,7 +9,8 @@ const sql_function_1 = require("./sql_function");
|
|
|
9
9
|
const sql_path_1 = require("./sql_path");
|
|
10
10
|
class SQLField extends combi_1.Expression {
|
|
11
11
|
getRunnable() {
|
|
12
|
-
const
|
|
12
|
+
const atParen = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.SimpleFieldChain2, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
13
|
+
const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleFieldChain2, atParen)), version_1.Version.OpenABAP);
|
|
13
14
|
const as = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
14
15
|
const parenFieldName = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFieldName, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight)));
|
|
15
16
|
const field = (0, combi_1.altPrio)(_1.SQLAggregation, _1.SQLCase, sql_function_1.SQLFunction, sql_path_1.SQLPath, _1.SQLFieldName, abap, _1.Constant, parenFieldName);
|
package/build/src/lsp/_lookup.js
CHANGED
|
@@ -15,6 +15,7 @@ const objects_1 = require("../objects");
|
|
|
15
15
|
const types_1 = require("../abap/types");
|
|
16
16
|
const _statement_1 = require("../abap/2_statements/statements/_statement");
|
|
17
17
|
const include_graph_1 = require("../utils/include_graph");
|
|
18
|
+
const visibility_1 = require("../abap/4_file_information/visibility");
|
|
18
19
|
class LSPLookup {
|
|
19
20
|
static lookup(cursor, reg, obj) {
|
|
20
21
|
var _a, _b;
|
|
@@ -72,7 +73,11 @@ class LSPLookup {
|
|
|
72
73
|
const method = this.findMethodDefinition(cursor, bottomScope.getParent());
|
|
73
74
|
if (method !== undefined && method.getStart().equals(cursor.token.getStart())) {
|
|
74
75
|
const found = _lsp_utils_1.LSPUtils.identiferToLocation(method);
|
|
75
|
-
|
|
76
|
+
let hover = "Method Definition \"" + method.getName() + "\"";
|
|
77
|
+
// Method definitions have getVisibility()
|
|
78
|
+
const methodDef = method;
|
|
79
|
+
const visibilityStr = this.visibilityToString(methodDef.getVisibility());
|
|
80
|
+
hover += "\n\n" + visibilityStr;
|
|
76
81
|
return { hover, definition: found, definitionId: method, scope: bottomScope };
|
|
77
82
|
}
|
|
78
83
|
let hoverValue = "";
|
|
@@ -238,8 +243,25 @@ class LSPLookup {
|
|
|
238
243
|
}
|
|
239
244
|
return this.methodParameters(methodDef);
|
|
240
245
|
}
|
|
246
|
+
static visibilityToString(visibility) {
|
|
247
|
+
switch (visibility) {
|
|
248
|
+
case visibility_1.Visibility.Public:
|
|
249
|
+
return "PUBLIC";
|
|
250
|
+
case visibility_1.Visibility.Protected:
|
|
251
|
+
return "PROTECTED";
|
|
252
|
+
case visibility_1.Visibility.Private:
|
|
253
|
+
return "PRIVATE";
|
|
254
|
+
default:
|
|
255
|
+
return "";
|
|
256
|
+
}
|
|
257
|
+
}
|
|
241
258
|
static methodParameters(methodDef) {
|
|
242
259
|
let ret = "";
|
|
260
|
+
// Add visibility information
|
|
261
|
+
const visibilityStr = this.visibilityToString(methodDef.getVisibility());
|
|
262
|
+
if (visibilityStr) {
|
|
263
|
+
ret += visibilityStr + "\n\n";
|
|
264
|
+
}
|
|
243
265
|
const parameters = methodDef.getParameters();
|
|
244
266
|
const importing = parameters.getImporting();
|
|
245
267
|
if (importing.length > 0) {
|
package/build/src/registry.js
CHANGED
package/build/src/rules/index.js
CHANGED
|
@@ -129,6 +129,7 @@ __exportStar(require("./omit_parameter_name"), exports);
|
|
|
129
129
|
__exportStar(require("./omit_preceding_zeros"), exports);
|
|
130
130
|
__exportStar(require("./omit_receiving"), exports);
|
|
131
131
|
__exportStar(require("./parser_702_chaining"), exports);
|
|
132
|
+
__exportStar(require("./parser_bad_exceptions"), exports);
|
|
132
133
|
__exportStar(require("./parser_error"), exports);
|
|
133
134
|
__exportStar(require("./parser_missing_space"), exports);
|
|
134
135
|
__exportStar(require("./pragma_style"), exports);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParserBadExceptions = exports.ParserBadExceptionsConf = void 0;
|
|
4
|
+
const Statements = require("../abap/2_statements/statements");
|
|
5
|
+
const Expressions = require("../abap/2_statements/expressions");
|
|
6
|
+
const issue_1 = require("../issue");
|
|
7
|
+
const _abap_rule_1 = require("./_abap_rule");
|
|
8
|
+
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
9
|
+
const _irule_1 = require("./_irule");
|
|
10
|
+
// todo: this rule needs refactoring
|
|
11
|
+
class ParserBadExceptionsConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
12
|
+
}
|
|
13
|
+
exports.ParserBadExceptionsConf = ParserBadExceptionsConf;
|
|
14
|
+
class ParserBadExceptions extends _abap_rule_1.ABAPRule {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.conf = new ParserBadExceptionsConf();
|
|
18
|
+
}
|
|
19
|
+
getMetadata() {
|
|
20
|
+
return {
|
|
21
|
+
key: "parser_bad_exceptions",
|
|
22
|
+
title: "Parser Error, bad EXCEPTIONS in CALL FUNCTION",
|
|
23
|
+
shortDescription: `Checks for syntax not recognized by abaplint, related to EXCEPTIONS in CALL FUNCTION.`,
|
|
24
|
+
tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],
|
|
25
|
+
/*
|
|
26
|
+
badExample: `IF ( foo = 'bar').`,
|
|
27
|
+
goodExample: `IF ( foo = 'bar' ).`,
|
|
28
|
+
*/
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
getConfig() {
|
|
32
|
+
return this.conf;
|
|
33
|
+
}
|
|
34
|
+
setConfig(conf) {
|
|
35
|
+
this.conf = conf;
|
|
36
|
+
}
|
|
37
|
+
runParsed(file) {
|
|
38
|
+
var _a;
|
|
39
|
+
const issues = [];
|
|
40
|
+
for (const statement of file.getStatements()) {
|
|
41
|
+
if (!(statement.get() instanceof Statements.CallFunction)) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const found = (_a = statement.findDirectExpression(Expressions.FunctionParameters)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Field);
|
|
45
|
+
if (found === undefined) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
|
|
49
|
+
issues.push(issue_1.Issue.atToken(file, found.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
50
|
+
}
|
|
51
|
+
return issues;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.ParserBadExceptions = ParserBadExceptions;
|
|
55
|
+
//# sourceMappingURL=parser_bad_exceptions.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.115.
|
|
3
|
+
"version": "2.115.20",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,20 +50,20 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.
|
|
53
|
+
"@microsoft/api-extractor": "^7.56.2",
|
|
54
54
|
"@types/chai": "^4.3.20",
|
|
55
55
|
"@types/mocha": "^10.0.10",
|
|
56
|
-
"@types/node": "^24.10.
|
|
56
|
+
"@types/node": "^24.10.10",
|
|
57
57
|
"chai": "^4.5.0",
|
|
58
58
|
"eslint": "^9.39.2",
|
|
59
59
|
"mocha": "^11.7.5",
|
|
60
60
|
"c8": "^10.1.3",
|
|
61
61
|
"source-map-support": "^0.5.21",
|
|
62
|
-
"ts-json-schema-generator": "
|
|
62
|
+
"ts-json-schema-generator": "=2.4.0",
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"fast-xml-parser": "^5.3.
|
|
66
|
+
"fast-xml-parser": "^5.3.4",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"vscode-languageserver-types": "^3.17.5"
|
|
69
69
|
}
|