@abaplint/core 2.89.10 → 2.89.11
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.
|
@@ -34,7 +34,7 @@ class Cast {
|
|
|
34
34
|
throw new Error("Type \"" + typeName + "\" not found in scope, Cast");
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
tt = new basic_1.ObjectReferenceType(found);
|
|
37
|
+
tt = new basic_1.ObjectReferenceType(found, typeName);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
new source_1.Source().addIfInferred(node, scope, filename, tt);
|
|
@@ -124,6 +124,9 @@ class Source {
|
|
|
124
124
|
if (foundType === undefined || foundType.isGeneric()) {
|
|
125
125
|
this.addIfInferred(node, scope, filename, bodyType);
|
|
126
126
|
}
|
|
127
|
+
else {
|
|
128
|
+
this.addIfInferred(node, scope, filename, foundType);
|
|
129
|
+
}
|
|
127
130
|
return foundType ? foundType : bodyType;
|
|
128
131
|
}
|
|
129
132
|
default:
|
package/build/src/registry.js
CHANGED
|
@@ -1305,7 +1305,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1305
1305
|
}
|
|
1306
1306
|
return ret;
|
|
1307
1307
|
}
|
|
1308
|
-
findType(i, lowFile, highSyntax) {
|
|
1308
|
+
findType(i, lowFile, highSyntax, ref = false) {
|
|
1309
1309
|
var _a;
|
|
1310
1310
|
const expr = i.findDirectExpression(Expressions.TypeNameOrInfer);
|
|
1311
1311
|
if (expr === undefined) {
|
|
@@ -1314,7 +1314,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1314
1314
|
const firstToken = expr.getFirstToken();
|
|
1315
1315
|
const concat = expr.concatTokens().toLowerCase();
|
|
1316
1316
|
if (concat !== "#") {
|
|
1317
|
-
return concat;
|
|
1317
|
+
return ref ? "REF TO " + concat : concat;
|
|
1318
1318
|
}
|
|
1319
1319
|
const spag = highSyntax.spaghetti.lookupPosition(firstToken.getStart(), lowFile.getFilename());
|
|
1320
1320
|
if (spag === undefined) {
|
|
@@ -1333,7 +1333,12 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1333
1333
|
if (inferred === undefined) {
|
|
1334
1334
|
return undefined;
|
|
1335
1335
|
}
|
|
1336
|
-
|
|
1336
|
+
if (inferred.getType() instanceof basic_1.ObjectReferenceType) {
|
|
1337
|
+
return inferred.getType().toABAP();
|
|
1338
|
+
}
|
|
1339
|
+
else {
|
|
1340
|
+
return (_a = inferred.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
1341
|
+
}
|
|
1337
1342
|
}
|
|
1338
1343
|
outlineFS(node, lowFile, highSyntax) {
|
|
1339
1344
|
var _a, _b;
|
|
@@ -1519,9 +1524,9 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1519
1524
|
var _a;
|
|
1520
1525
|
for (const i of node.findAllExpressionsRecursive(Expressions.Cast)) {
|
|
1521
1526
|
const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1522
|
-
const type = this.findType(i, lowFile, highSyntax);
|
|
1527
|
+
const type = this.findType(i, lowFile, highSyntax, true);
|
|
1523
1528
|
const body = (_a = i.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
1524
|
-
const abap = `DATA ${uniqueName} TYPE
|
|
1529
|
+
const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
|
|
1525
1530
|
" ".repeat(node.getFirstToken().getStart().getCol() - 1) +
|
|
1526
1531
|
`${uniqueName} ?= ${body}.\n` +
|
|
1527
1532
|
" ".repeat(node.getFirstToken().getStart().getCol() - 1);
|