@abaplint/core 2.82.9 → 2.82.13
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 +9 -1
- package/build/src/abap/5_syntax/_object_oriented.js +12 -0
- package/build/src/abap/types/basic/decfloat_type.js +20 -0
- package/build/src/abap/types/basic/index.js +1 -0
- package/build/src/abap/types/class_definition.js +1 -0
- package/build/src/ddic.js +2 -0
- package/build/src/issue.js +2 -1
- package/build/src/objects/table_type.js +3 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/space_before_colon.js +7 -3
- package/build/src/rules/unknown_types.js +28 -3
- package/package.json +2 -2
package/build/abaplint.d.ts
CHANGED
|
@@ -324,6 +324,7 @@ declare namespace BasicTypes {
|
|
|
324
324
|
CSequenceType,
|
|
325
325
|
DataReference,
|
|
326
326
|
DateType,
|
|
327
|
+
DecFloatType,
|
|
327
328
|
DecFloat16Type,
|
|
328
329
|
DecFloat34Type,
|
|
329
330
|
FloatType,
|
|
@@ -1241,6 +1242,13 @@ declare class DecFloat34Type extends AbstractType {
|
|
|
1241
1242
|
containsVoid(): boolean;
|
|
1242
1243
|
}
|
|
1243
1244
|
|
|
1245
|
+
declare class DecFloatType extends AbstractType {
|
|
1246
|
+
toText(): string;
|
|
1247
|
+
isGeneric(): boolean;
|
|
1248
|
+
toABAP(): string;
|
|
1249
|
+
containsVoid(): boolean;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1244
1252
|
declare class Decimals extends Expression {
|
|
1245
1253
|
getRunnable(): IStatementRunnable;
|
|
1246
1254
|
}
|
|
@@ -3142,7 +3150,7 @@ export declare class Issue {
|
|
|
3142
3150
|
static atRow(file: IFile, row: number, message: string, key: string, severity?: Severity): Issue;
|
|
3143
3151
|
static atStatement(file: IFile, statement: StatementNode, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
3144
3152
|
static atPosition(file: IFile, start: Position, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
3145
|
-
static atRowRange(file: IFile, row: number, startCol: number, endCol: number, message: string, key: string, severity?: Severity): Issue;
|
|
3153
|
+
static atRowRange(file: IFile, row: number, startCol: number, endCol: number, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
3146
3154
|
static atRange(file: IFile, start: Position, end: Position, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
3147
3155
|
static atToken(file: IFile, token: Token, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
3148
3156
|
static atIdentifier(identifier: Identifier, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
@@ -44,6 +44,18 @@ class ObjectOriented {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
addAliasedTypes(aliases) {
|
|
48
|
+
for (const alias of aliases.getAll()) {
|
|
49
|
+
const comp = alias.getComponent();
|
|
50
|
+
const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
|
|
51
|
+
if (idef) {
|
|
52
|
+
const found = idef.getTypeDefinitions().getByName(comp.split("~")[1]);
|
|
53
|
+
if (found) {
|
|
54
|
+
this.scope.addTypeNamed(alias.getName(), found);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
47
59
|
findMethodInInterface(interfaceName, methodName) {
|
|
48
60
|
const idef = this.scope.findInterfaceDefinition(interfaceName);
|
|
49
61
|
if (idef) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DecFloatType = void 0;
|
|
4
|
+
const _abstract_type_1 = require("./_abstract_type");
|
|
5
|
+
class DecFloatType extends _abstract_type_1.AbstractType {
|
|
6
|
+
toText() {
|
|
7
|
+
return "```decfloat```";
|
|
8
|
+
}
|
|
9
|
+
isGeneric() {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
toABAP() {
|
|
13
|
+
return "decfloat";
|
|
14
|
+
}
|
|
15
|
+
containsVoid() {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.DecFloatType = DecFloatType;
|
|
20
|
+
//# sourceMappingURL=decfloat_type.js.map
|
|
@@ -16,6 +16,7 @@ __exportStar(require("./clike_type"), exports);
|
|
|
16
16
|
__exportStar(require("./csequence_type"), exports);
|
|
17
17
|
__exportStar(require("./data_reference_type"), exports);
|
|
18
18
|
__exportStar(require("./date_type"), exports);
|
|
19
|
+
__exportStar(require("./decfloat_type"), exports);
|
|
19
20
|
__exportStar(require("./decfloat16_type"), exports);
|
|
20
21
|
__exportStar(require("./decfloat34_type"), exports);
|
|
21
22
|
__exportStar(require("./float_type"), exports);
|
|
@@ -32,6 +32,7 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
32
32
|
this.parse(filename, scope);
|
|
33
33
|
const helper = new _object_oriented_1.ObjectOriented(scope);
|
|
34
34
|
helper.fromSuperClassesAndInterfaces(this);
|
|
35
|
+
helper.addAliasedTypes(this.aliases);
|
|
35
36
|
this.attributes = new class_attributes_1.Attributes(this.node, this.filename, scope);
|
|
36
37
|
this.types = this.attributes.getTypes();
|
|
37
38
|
this.methodDefs = new method_definitions_1.MethodDefinitions(this.node, this.filename, scope);
|
package/build/src/ddic.js
CHANGED
package/build/src/issue.js
CHANGED
|
@@ -48,7 +48,7 @@ class Issue {
|
|
|
48
48
|
severity,
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
static atRowRange(file, row, startCol, endCol, message, key, severity) {
|
|
51
|
+
static atRowRange(file, row, startCol, endCol, message, key, severity, fix) {
|
|
52
52
|
const start = new position_1.Position(row, startCol);
|
|
53
53
|
const end = new position_1.Position(row, endCol);
|
|
54
54
|
severity = severity !== null && severity !== void 0 ? severity : severity_1.Severity.Error;
|
|
@@ -58,6 +58,7 @@ class Issue {
|
|
|
58
58
|
key,
|
|
59
59
|
start,
|
|
60
60
|
end,
|
|
61
|
+
fix,
|
|
61
62
|
severity,
|
|
62
63
|
});
|
|
63
64
|
}
|
|
@@ -59,6 +59,9 @@ class TableType extends _abstract_object_1.AbstractObject {
|
|
|
59
59
|
else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "OBJECT") {
|
|
60
60
|
type = new Types.TableType(new basic_1.GenericObjectReferenceType(), { withHeader: false }, this.getName());
|
|
61
61
|
}
|
|
62
|
+
else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "DATA") {
|
|
63
|
+
type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), { withHeader: false }, this.getName());
|
|
64
|
+
}
|
|
62
65
|
else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype !== undefined) {
|
|
63
66
|
const lookup = ddic.lookupObject(this.parsedXML.rowtype);
|
|
64
67
|
type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
|
package/build/src/registry.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SpaceBeforeColon = exports.SpaceBeforeColonConf = void 0;
|
|
4
|
+
const position_1 = require("../position");
|
|
5
|
+
const edit_helper_1 = require("../edit_helper");
|
|
4
6
|
const issue_1 = require("../issue");
|
|
5
7
|
const _abap_rule_1 = require("./_abap_rule");
|
|
6
8
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
@@ -19,7 +21,7 @@ class SpaceBeforeColon extends _abap_rule_1.ABAPRule {
|
|
|
19
21
|
title: "Space before colon",
|
|
20
22
|
shortDescription: `Checks that there are no spaces in front of colons in chained statements.`,
|
|
21
23
|
extendedInformation: `https://docs.abapopenchecks.org/checks/80/`,
|
|
22
|
-
tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],
|
|
24
|
+
tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
23
25
|
badExample: `DATA : foo TYPE string.`,
|
|
24
26
|
goodExample: `DATA: foo TYPE string.`,
|
|
25
27
|
};
|
|
@@ -44,8 +46,10 @@ class SpaceBeforeColon extends _abap_rule_1.ABAPRule {
|
|
|
44
46
|
else if (token.getStr() === ":"
|
|
45
47
|
&& prev.getRow() === token.getRow()
|
|
46
48
|
&& prev.getCol() + prev.getStr().length < token.getCol()) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
+
const start = new position_1.Position(token.getRow(), prev.getEnd().getCol());
|
|
50
|
+
const end = new position_1.Position(token.getRow(), token.getStart().getCol());
|
|
51
|
+
const fix = edit_helper_1.EditHelper.deleteRange(file, start, end);
|
|
52
|
+
const issue = issue_1.Issue.atRowRange(file, start.getRow(), start.getCol(), end.getCol(), this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
|
|
49
53
|
issues.push(issue);
|
|
50
54
|
}
|
|
51
55
|
prev = token;
|
|
@@ -40,9 +40,27 @@ class UnknownTypes {
|
|
|
40
40
|
return [];
|
|
41
41
|
}
|
|
42
42
|
const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
|
|
43
|
-
|
|
43
|
+
const found = this.traverse(spaghetti.getTop());
|
|
44
|
+
return this.removeDuplicates(found);
|
|
44
45
|
}
|
|
45
46
|
/////////////////////
|
|
47
|
+
removeDuplicates(list) {
|
|
48
|
+
const deduplicated = [];
|
|
49
|
+
for (const result of list) {
|
|
50
|
+
let cont = false;
|
|
51
|
+
for (const d of deduplicated) {
|
|
52
|
+
if (result.getStart().equals(d.getStart())) {
|
|
53
|
+
cont = true;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (cont === true) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
deduplicated.push(result);
|
|
61
|
+
}
|
|
62
|
+
return deduplicated;
|
|
63
|
+
}
|
|
46
64
|
traverse(node) {
|
|
47
65
|
var _a;
|
|
48
66
|
const ret = [];
|
|
@@ -73,7 +91,14 @@ class UnknownTypes {
|
|
|
73
91
|
}
|
|
74
92
|
}
|
|
75
93
|
for (const v of node.getData().idefs) {
|
|
76
|
-
const found = this.
|
|
94
|
+
const found = this.checkMethodParameters(v);
|
|
95
|
+
if (found) {
|
|
96
|
+
const message = "Contains unknown, " + found.found;
|
|
97
|
+
ret.push(issue_1.Issue.atIdentifier(found.id, message, this.getMetadata().key, this.conf.severity));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (const v of node.getData().cdefs) {
|
|
101
|
+
const found = this.checkMethodParameters(v);
|
|
77
102
|
if (found) {
|
|
78
103
|
const message = "Contains unknown, " + found.found;
|
|
79
104
|
ret.push(issue_1.Issue.atIdentifier(found.id, message, this.getMetadata().key, this.conf.severity));
|
|
@@ -84,7 +109,7 @@ class UnknownTypes {
|
|
|
84
109
|
}
|
|
85
110
|
return ret;
|
|
86
111
|
}
|
|
87
|
-
|
|
112
|
+
checkMethodParameters(idef) {
|
|
88
113
|
var _a;
|
|
89
114
|
for (const m of ((_a = idef.getMethodDefinitions()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
|
|
90
115
|
for (const p of m.getParameters().getAll()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.82.
|
|
3
|
+
"version": "2.82.13",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://abaplint.org",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@microsoft/api-extractor": "^7.18.
|
|
48
|
+
"@microsoft/api-extractor": "^7.18.20",
|
|
49
49
|
"@types/chai": "^4.2.22",
|
|
50
50
|
"@types/mocha": "^9.0.0",
|
|
51
51
|
"@types/node": "^16.11.11",
|