@abaplint/core 2.83.10 → 2.83.14
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/types/basic/decfloat16_type.js +1 -1
- package/build/src/abap/types/basic/decfloat34_type.js +1 -1
- package/build/src/abap/types/basic/string_type.js +1 -1
- package/build/src/abap/types/basic/utc_long_type.js +1 -1
- package/build/src/abap/types/basic/xstring_type.js +1 -1
- package/build/src/cds/cds_lexer.js +4 -1
- package/build/src/ddic.js +6 -15
- package/build/src/objects/data_definition.js +8 -0
- package/build/src/objects/table.js +8 -2
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +22 -2
- package/build/src/rules/unnecessary_chaining.js +1 -1
- package/package.json +2 -2
package/build/abaplint.d.ts
CHANGED
|
@@ -1242,6 +1242,7 @@ declare class DataDefinition extends AbstractObject {
|
|
|
1242
1242
|
allowNamespace: boolean;
|
|
1243
1243
|
};
|
|
1244
1244
|
getSQLViewName(): string | undefined;
|
|
1245
|
+
getDefinitionName(): string | undefined;
|
|
1245
1246
|
getDescription(): string | undefined;
|
|
1246
1247
|
parseType(reg: IRegistry): AbstractType;
|
|
1247
1248
|
getParsedData(): ParsedDataDefinition | undefined;
|
|
@@ -4079,6 +4080,7 @@ declare class ParenRightW extends Token {
|
|
|
4079
4080
|
|
|
4080
4081
|
declare type ParsedDataDefinition = {
|
|
4081
4082
|
sqlViewName: string | undefined;
|
|
4083
|
+
definitionName: string | undefined;
|
|
4082
4084
|
fields: {
|
|
4083
4085
|
key: boolean;
|
|
4084
4086
|
name: string;
|
|
@@ -82,7 +82,10 @@ class CDSLexer {
|
|
|
82
82
|
}
|
|
83
83
|
// multi line comment handling
|
|
84
84
|
if (mode === Mode.MultiLineComment) {
|
|
85
|
-
if (
|
|
85
|
+
if (next === "\n") {
|
|
86
|
+
row++;
|
|
87
|
+
}
|
|
88
|
+
else if (prev === "*" && next === "/") {
|
|
86
89
|
mode = Mode.Default;
|
|
87
90
|
}
|
|
88
91
|
continue;
|
package/build/src/ddic.js
CHANGED
|
@@ -143,6 +143,7 @@ class DDIC {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
lookupNoVoid(name) {
|
|
146
|
+
var _a;
|
|
146
147
|
const foundTABL = this.reg.getObject("TABL", name);
|
|
147
148
|
if (foundTABL) {
|
|
148
149
|
return { type: foundTABL.parseType(this.reg), object: foundTABL };
|
|
@@ -155,10 +156,6 @@ class DDIC {
|
|
|
155
156
|
if (foundTTYP) {
|
|
156
157
|
return { type: foundTTYP.parseType(this.reg), object: foundTTYP };
|
|
157
158
|
}
|
|
158
|
-
const foundDDLS = this.reg.getObject("DDLS", name);
|
|
159
|
-
if (foundDDLS) {
|
|
160
|
-
return { type: foundDDLS.parseType(this.reg), object: foundDDLS };
|
|
161
|
-
}
|
|
162
159
|
const foundDTEL = this.reg.getObject("DTEL", name);
|
|
163
160
|
if (foundDTEL) {
|
|
164
161
|
return { type: foundDTEL.parseType(this.reg), object: foundDTEL };
|
|
@@ -166,7 +163,7 @@ class DDIC {
|
|
|
166
163
|
const upper = name.toUpperCase();
|
|
167
164
|
for (const obj of this.reg.getObjectsByType("DDLS")) {
|
|
168
165
|
const ddls = obj;
|
|
169
|
-
if (ddls.getSQLViewName() === upper) {
|
|
166
|
+
if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {
|
|
170
167
|
return { type: ddls.parseType(this.reg), object: obj };
|
|
171
168
|
}
|
|
172
169
|
}
|
|
@@ -213,6 +210,7 @@ class DDIC {
|
|
|
213
210
|
}
|
|
214
211
|
}
|
|
215
212
|
lookupTableOrView(name) {
|
|
213
|
+
var _a;
|
|
216
214
|
if (name === undefined) {
|
|
217
215
|
return { type: new Types.UnknownType("undefined, lookupTableOrView") };
|
|
218
216
|
}
|
|
@@ -220,20 +218,17 @@ class DDIC {
|
|
|
220
218
|
if (foundTABL) {
|
|
221
219
|
return { type: foundTABL.parseType(this.reg), object: foundTABL };
|
|
222
220
|
}
|
|
223
|
-
const foundDDLS = this.reg.getObject("DDLS", name);
|
|
224
|
-
if (foundDDLS) {
|
|
225
|
-
return { type: foundDDLS.parseType(this.reg), object: foundDDLS };
|
|
226
|
-
}
|
|
227
221
|
const upper = name.toUpperCase();
|
|
228
222
|
for (const obj of this.reg.getObjectsByType("DDLS")) {
|
|
229
223
|
const ddls = obj;
|
|
230
|
-
if (ddls.getSQLViewName() === upper) {
|
|
224
|
+
if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {
|
|
231
225
|
return { type: ddls.parseType(this.reg), object: ddls };
|
|
232
226
|
}
|
|
233
227
|
}
|
|
234
228
|
return this.lookupView(name);
|
|
235
229
|
}
|
|
236
230
|
lookupTableOrView2(name) {
|
|
231
|
+
var _a;
|
|
237
232
|
if (name === undefined) {
|
|
238
233
|
return undefined;
|
|
239
234
|
}
|
|
@@ -245,14 +240,10 @@ class DDIC {
|
|
|
245
240
|
if (foundVIEW) {
|
|
246
241
|
return foundVIEW;
|
|
247
242
|
}
|
|
248
|
-
const foundDDLS = this.reg.getObject("DDLS", name);
|
|
249
|
-
if (foundDDLS) {
|
|
250
|
-
return foundDDLS;
|
|
251
|
-
}
|
|
252
243
|
const upper = name.toUpperCase();
|
|
253
244
|
for (const obj of this.reg.getObjectsByType("DDLS")) {
|
|
254
245
|
const ddls = obj;
|
|
255
|
-
if (ddls.getSQLViewName() === upper) {
|
|
246
|
+
if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {
|
|
256
247
|
return ddls;
|
|
257
248
|
}
|
|
258
249
|
}
|
|
@@ -25,6 +25,11 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
25
25
|
this.parse();
|
|
26
26
|
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.sqlViewName;
|
|
27
27
|
}
|
|
28
|
+
getDefinitionName() {
|
|
29
|
+
var _a;
|
|
30
|
+
this.parse();
|
|
31
|
+
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.definitionName;
|
|
32
|
+
}
|
|
28
33
|
getDescription() {
|
|
29
34
|
// todo
|
|
30
35
|
return undefined;
|
|
@@ -53,12 +58,14 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
53
58
|
return this.parserError;
|
|
54
59
|
}
|
|
55
60
|
parse() {
|
|
61
|
+
var _a, _b;
|
|
56
62
|
if (this.isDirty() === false) {
|
|
57
63
|
return { updated: false, runtime: 0 };
|
|
58
64
|
}
|
|
59
65
|
const start = Date.now();
|
|
60
66
|
this.parsedData = {
|
|
61
67
|
sqlViewName: undefined,
|
|
68
|
+
definitionName: undefined,
|
|
62
69
|
fields: [],
|
|
63
70
|
sources: [],
|
|
64
71
|
relations: [],
|
|
@@ -68,6 +75,7 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
68
75
|
this.findSQLViewName();
|
|
69
76
|
this.parsedData.tree = new cds_parser_1.CDSParser().parse(this.findSourceFile());
|
|
70
77
|
if (this.parsedData.tree) {
|
|
78
|
+
this.parsedData.definitionName = (_b = (_a = this.parsedData.tree) === null || _a === void 0 ? void 0 : _a.findFirstExpression(expressions_1.CDSName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
|
|
71
79
|
this.findSourcesAndRelations(this.parsedData.tree);
|
|
72
80
|
this.findFieldNames(this.parsedData.tree);
|
|
73
81
|
}
|
|
@@ -90,8 +90,13 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
90
90
|
found = found.getType();
|
|
91
91
|
}
|
|
92
92
|
if (found instanceof Types.StructureType) {
|
|
93
|
-
|
|
94
|
-
components.push({ name:
|
|
93
|
+
if (field.GROUPNAME !== undefined) {
|
|
94
|
+
components.push({ name: field.GROUPNAME, type: found });
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
for (const c of found.getComponents()) {
|
|
98
|
+
components.push({ name: c.name, type: c.type });
|
|
99
|
+
}
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
else if ((((_a = field.PRECFIELD) === null || _a === void 0 ? void 0 : _a.startsWith("CI_")) || ((_b = field.PRECFIELD) === null || _b === void 0 ? void 0 : _b.startsWith("SI_")))
|
|
@@ -241,6 +246,7 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
241
246
|
DATATYPE: field.DATATYPE,
|
|
242
247
|
DECIMALS: field.DECIMALS,
|
|
243
248
|
KEYFLAG: field.KEYFLAG,
|
|
249
|
+
GROUPNAME: field.GROUPNAME,
|
|
244
250
|
});
|
|
245
251
|
}
|
|
246
252
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -19,7 +19,7 @@ const _typed_identifier_1 = require("../abap/types/_typed_identifier");
|
|
|
19
19
|
const basic_1 = require("../abap/types/basic");
|
|
20
20
|
const config_1 = require("../config");
|
|
21
21
|
const tokens_1 = require("../abap/1_lexer/tokens");
|
|
22
|
-
// todo: refactor each sub-rule to new classes
|
|
22
|
+
// todo: refactor each sub-rule to new classes?
|
|
23
23
|
class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
24
24
|
}
|
|
25
25
|
exports.DownportConf = DownportConf;
|
|
@@ -52,6 +52,7 @@ Current rules:
|
|
|
52
52
|
* SELECT INTO @DATA definitions are outlined
|
|
53
53
|
* Some occurrences of string template formatting option ALPHA changed to function module call
|
|
54
54
|
* SELECT/INSERT/MODIFY/DELETE/UPDATE "," in field list removed, "@" in source/targets removed
|
|
55
|
+
* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
|
|
55
56
|
|
|
56
57
|
Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,
|
|
57
58
|
tags: [_irule_1.RuleTag.Experimental, _irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],
|
|
@@ -143,7 +144,11 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
143
144
|
if (low.getFirstToken().getStart() instanceof position_1.VirtualPosition) {
|
|
144
145
|
return undefined;
|
|
145
146
|
}
|
|
146
|
-
let found = this.
|
|
147
|
+
let found = this.partiallyImplemented(high, lowFile);
|
|
148
|
+
if (found) {
|
|
149
|
+
return found;
|
|
150
|
+
}
|
|
151
|
+
found = this.emptyKey(high, lowFile);
|
|
147
152
|
if (found) {
|
|
148
153
|
return found;
|
|
149
154
|
}
|
|
@@ -428,6 +433,21 @@ ${indentation}`);
|
|
|
428
433
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
429
434
|
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
430
435
|
}
|
|
436
|
+
partiallyImplemented(node, lowFile) {
|
|
437
|
+
if (node.get() instanceof Statements.InterfaceDef) {
|
|
438
|
+
const partially = node.findDirectTokenByText("PARTIALLY");
|
|
439
|
+
if (partially === undefined) {
|
|
440
|
+
return undefined;
|
|
441
|
+
}
|
|
442
|
+
const implemented = node.findDirectTokenByText("IMPLEMENTED");
|
|
443
|
+
if (implemented === undefined) {
|
|
444
|
+
return undefined;
|
|
445
|
+
}
|
|
446
|
+
const fix = edit_helper_1.EditHelper.deleteRange(lowFile, partially.getStart(), implemented.getEnd());
|
|
447
|
+
return issue_1.Issue.atToken(lowFile, partially, "Downport PARTIALLY IMPLEMENTED", this.getMetadata().key, this.conf.severity, fix);
|
|
448
|
+
}
|
|
449
|
+
return undefined;
|
|
450
|
+
}
|
|
431
451
|
emptyKey(node, lowFile) {
|
|
432
452
|
for (let i of node.findAllExpressions(Expressions.TypeTable)) {
|
|
433
453
|
const key = i.findDirectExpression(Expressions.TypeTableKey);
|
|
@@ -58,7 +58,7 @@ class UnnecessaryChaining extends _abap_rule_1.ABAPRule {
|
|
|
58
58
|
}
|
|
59
59
|
const fix = edit_helper_1.EditHelper.deleteRange(file, colon.getStart(), colon.getEnd());
|
|
60
60
|
const message = "Unnecessary chaining";
|
|
61
|
-
const issue = issue_1.Issue.
|
|
61
|
+
const issue = issue_1.Issue.atToken(file, colon, message, this.getMetadata().key, this.conf.severity, fix);
|
|
62
62
|
issues.push(issue);
|
|
63
63
|
}
|
|
64
64
|
return issues;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.83.
|
|
3
|
+
"version": "2.83.14",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"chai": "^4.3.4",
|
|
53
53
|
"eslint": "^8.5.0",
|
|
54
54
|
"mocha": "^9.1.3",
|
|
55
|
-
"c8": "^7.
|
|
55
|
+
"c8": "^7.11.0",
|
|
56
56
|
"source-map-support": "^0.5.21",
|
|
57
57
|
"ts-json-schema-generator": "^0.97.0",
|
|
58
58
|
"typescript": "^4.5.4"
|