@abaplint/core 2.95.32 → 2.95.34
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/5_syntax/basic_types.js +11 -4
- package/build/src/abap/types/basic/data_reference_type.js +4 -0
- package/build/src/abap/types/basic/table_type.js +4 -0
- package/build/src/objects/gateway_vocabulary_annotation.js +1 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +14 -6
- package/package.json +1 -1
|
@@ -287,17 +287,24 @@ class BasicTypes {
|
|
|
287
287
|
}
|
|
288
288
|
const typeTableKeys = node.findAllExpressions(expressions_1.TypeTableKey);
|
|
289
289
|
const firstKey = typeTableKeys[0];
|
|
290
|
+
const isNamed = (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) !== undefined;
|
|
290
291
|
const primaryKey = {
|
|
291
292
|
name: "primary_key",
|
|
292
293
|
type: type,
|
|
293
|
-
isUnique: (firstKey === null || firstKey === void 0 ? void 0 : firstKey.concatTokens().toUpperCase().includes("WITH UNIQUE ")) === true,
|
|
294
|
+
isUnique: isNamed ? false : (firstKey === null || firstKey === void 0 ? void 0 : firstKey.concatTokens().toUpperCase().includes("WITH UNIQUE ")) === true,
|
|
294
295
|
keyFields: [],
|
|
295
296
|
};
|
|
296
|
-
|
|
297
|
-
|
|
297
|
+
let start = 1;
|
|
298
|
+
if (isNamed === false) {
|
|
299
|
+
for (const k of (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpressions(expressions_1.FieldSub)) || []) {
|
|
300
|
+
primaryKey.keyFields.push(k.concatTokens().toUpperCase());
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
start = 0;
|
|
298
305
|
}
|
|
299
306
|
const secondaryKeys = [];
|
|
300
|
-
for (let i =
|
|
307
|
+
for (let i = start; i < typeTableKeys.length; i++) {
|
|
301
308
|
const row = typeTableKeys[i];
|
|
302
309
|
const name = (_b = row.findDirectExpression(expressions_1.Field)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
303
310
|
if (name === undefined) {
|
|
@@ -14,6 +14,10 @@ class DataReference extends _abstract_type_1.AbstractType {
|
|
|
14
14
|
return this.type;
|
|
15
15
|
}
|
|
16
16
|
toABAP() {
|
|
17
|
+
const type = this.type.toABAP();
|
|
18
|
+
if (type.includes(" TABLE OF ")) {
|
|
19
|
+
return ""; // hmm, should this return undefined?
|
|
20
|
+
}
|
|
17
21
|
return "REF TO " + this.type.toABAP();
|
|
18
22
|
}
|
|
19
23
|
isGeneric() {
|
|
@@ -12,9 +12,13 @@ var TableAccessType;
|
|
|
12
12
|
})(TableAccessType = exports.TableAccessType || (exports.TableAccessType = {}));
|
|
13
13
|
class TableType extends _abstract_type_1.AbstractType {
|
|
14
14
|
constructor(rowType, options, qualifiedName) {
|
|
15
|
+
var _a;
|
|
15
16
|
super({ qualifiedName: qualifiedName });
|
|
16
17
|
this.rowType = rowType;
|
|
17
18
|
this.options = options;
|
|
19
|
+
if (((_a = options.primaryKey) === null || _a === void 0 ? void 0 : _a.type) === TableAccessType.standard && options.primaryKey.isUnique === true) {
|
|
20
|
+
throw new Error("STANDARD tables cannot have UNIQUE key");
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
getOptions() {
|
|
20
24
|
return this.options;
|
package/build/src/registry.js
CHANGED
|
@@ -1545,7 +1545,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1545
1545
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
1546
1546
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline LOOP input", this.getMetadata().key, this.conf.severity, fix);
|
|
1547
1547
|
}
|
|
1548
|
-
outlineLoopTarget(node, lowFile,
|
|
1548
|
+
outlineLoopTarget(node, lowFile, highSyntax) {
|
|
1549
1549
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1550
1550
|
// also allows outlining of voided types
|
|
1551
1551
|
if (!(node.get() instanceof Statements.Loop)) {
|
|
@@ -1556,16 +1556,19 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1556
1556
|
return undefined;
|
|
1557
1557
|
}
|
|
1558
1558
|
const concat = node.concatTokens().toUpperCase();
|
|
1559
|
-
if (concat.includes("
|
|
1560
|
-
|| concat.includes(" GROUP BY ")
|
|
1561
|
-
|| concat.startsWith("LOOP AT GROUP ")) {
|
|
1559
|
+
if (concat.includes(" GROUP BY ") || concat.startsWith("LOOP AT GROUP ")) {
|
|
1562
1560
|
return undefined;
|
|
1563
1561
|
}
|
|
1562
|
+
const isReference = concat.includes(" REFERENCE INTO ");
|
|
1564
1563
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1565
1564
|
const dataTarget = (_c = (_b = node.findDirectExpression(Expressions.LoopTarget)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(Expressions.InlineData);
|
|
1566
1565
|
if (dataTarget) {
|
|
1567
1566
|
const targetName = ((_d = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || "DOWNPORT_ERROR";
|
|
1568
|
-
|
|
1567
|
+
let code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\n${indentation}`;
|
|
1568
|
+
if (isReference) {
|
|
1569
|
+
const likeName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1570
|
+
code = `DATA ${likeName} LIKE LINE OF ${sourceName}.\n${indentation}DATA ${targetName} LIKE REF TO ${likeName}.\n${indentation}`;
|
|
1571
|
+
}
|
|
1569
1572
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
|
|
1570
1573
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, dataTarget.getFirstToken().getStart(), dataTarget.getLastToken().getEnd(), targetName);
|
|
1571
1574
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -2173,10 +2176,15 @@ ${indentation} output = ${topTarget}.`;
|
|
|
2173
2176
|
else if (found.getType() instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {
|
|
2174
2177
|
continue;
|
|
2175
2178
|
}
|
|
2176
|
-
let type = found.getType().getQualifiedName()
|
|
2179
|
+
let type = found.getType().getQualifiedName()
|
|
2180
|
+
? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase()
|
|
2181
|
+
: found.getType().toABAP();
|
|
2177
2182
|
if (found.getType() instanceof basic_1.ObjectReferenceType) {
|
|
2178
2183
|
type = found.getType().toABAP();
|
|
2179
2184
|
}
|
|
2185
|
+
if (type === "") {
|
|
2186
|
+
continue;
|
|
2187
|
+
}
|
|
2180
2188
|
const code = `DATA ${name} TYPE ${type}.\n` +
|
|
2181
2189
|
" ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
2182
2190
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
|