@abaplint/core 2.102.11 → 2.102.12
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
CHANGED
|
@@ -792,7 +792,7 @@ ${indentation}`);
|
|
|
792
792
|
if (tt === undefined) {
|
|
793
793
|
return undefined;
|
|
794
794
|
}
|
|
795
|
-
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax
|
|
795
|
+
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
796
796
|
const code = `TYPES ${uniqueName} ${tt.concatTokens()}.\n`;
|
|
797
797
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), code);
|
|
798
798
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, tt.getFirstToken().getStart(), tt.getLastToken().getEnd(), "TYPE " + uniqueName);
|
|
@@ -2537,15 +2537,15 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2537
2537
|
}
|
|
2538
2538
|
return undefined;
|
|
2539
2539
|
}
|
|
2540
|
-
uniqueName(position, filename, highSyntax
|
|
2540
|
+
uniqueName(position, filename, highSyntax) {
|
|
2541
2541
|
const spag = highSyntax.spaghetti.lookupPosition(position, filename);
|
|
2542
2542
|
if (spag === undefined) {
|
|
2543
|
-
const name =
|
|
2543
|
+
const name = "temprr" + this.counter;
|
|
2544
2544
|
this.counter++;
|
|
2545
2545
|
return name;
|
|
2546
2546
|
}
|
|
2547
2547
|
while (true) {
|
|
2548
|
-
const name =
|
|
2548
|
+
const name = "temp" + this.counter;
|
|
2549
2549
|
const exists = this.existsRecursive(spag, name);
|
|
2550
2550
|
this.counter++;
|
|
2551
2551
|
if (exists === false) {
|
|
@@ -2553,13 +2553,14 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2553
2553
|
}
|
|
2554
2554
|
}
|
|
2555
2555
|
}
|
|
2556
|
+
// todo, optimize, the findVariable() and findType() does a lot of redundant checks
|
|
2556
2557
|
existsRecursive(spag, name) {
|
|
2557
|
-
const existsDirect = spag.findVariable(name);
|
|
2558
|
+
const existsDirect = spag.findVariable(name) || spag.findType(name);
|
|
2558
2559
|
if (existsDirect) {
|
|
2559
2560
|
return true;
|
|
2560
2561
|
}
|
|
2561
2562
|
for (const child of spag.getChildren()) {
|
|
2562
|
-
if (child.findVariable(name) || this.existsRecursive(child, name)) {
|
|
2563
|
+
if (child.findVariable(name) || child.findType(name) || this.existsRecursive(child, name)) {
|
|
2563
2564
|
return true;
|
|
2564
2565
|
}
|
|
2565
2566
|
}
|