@abaplint/core 2.105.1 → 2.105.2
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/registry.js +1 -1
- package/build/src/rules/downport.js +26 -0
- package/package.json +1 -1
package/build/src/registry.js
CHANGED
|
@@ -367,6 +367,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
367
367
|
if (found) {
|
|
368
368
|
return found;
|
|
369
369
|
}
|
|
370
|
+
found = this.assignComponent(low, high, lowFile, highSyntax);
|
|
371
|
+
if (found) {
|
|
372
|
+
return found;
|
|
373
|
+
}
|
|
370
374
|
found = this.downportRefSimple(high, lowFile, highSyntax);
|
|
371
375
|
if (found) {
|
|
372
376
|
return found;
|
|
@@ -1476,6 +1480,28 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
|
1476
1480
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
|
|
1477
1481
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN table expr", this.getMetadata().key, this.conf.severity, fix);
|
|
1478
1482
|
}
|
|
1483
|
+
assignComponent(low, high, lowFile, highSyntax) {
|
|
1484
|
+
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
1485
|
+
return undefined;
|
|
1486
|
+
}
|
|
1487
|
+
if (!(high.get() instanceof Statements.Assign)) {
|
|
1488
|
+
return undefined;
|
|
1489
|
+
}
|
|
1490
|
+
const assignSource = high.findDirectExpression(Expressions.AssignSource);
|
|
1491
|
+
if (assignSource === undefined || assignSource.getFirstToken().getStr().toUpperCase() !== "COMPONENT") {
|
|
1492
|
+
return undefined;
|
|
1493
|
+
}
|
|
1494
|
+
const componentSource = assignSource.findExpressionAfterToken("COMPONENT");
|
|
1495
|
+
if (componentSource === undefined || componentSource.get() instanceof Expressions.SimpleSource3) {
|
|
1496
|
+
return undefined;
|
|
1497
|
+
}
|
|
1498
|
+
const uniqueName = this.uniqueName(assignSource.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1499
|
+
const code = `DATA(${uniqueName}) = ${componentSource.concatTokens()}.\n`;
|
|
1500
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
1501
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, componentSource.getFirstToken().getStart(), componentSource.getLastToken().getEnd(), uniqueName);
|
|
1502
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
1503
|
+
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN COMPONENT source", this.getMetadata().key, this.conf.severity, fix);
|
|
1504
|
+
}
|
|
1479
1505
|
moveWithSimpleValue(low, high, lowFile) {
|
|
1480
1506
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
1481
1507
|
return undefined;
|