@abaplint/core 2.89.10 → 2.89.13
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/expressions/cast.js +1 -1
- package/build/src/abap/5_syntax/expressions/reduce_body.js +9 -0
- package/build/src/abap/5_syntax/expressions/source.js +3 -0
- package/build/src/abap/5_syntax/structures/type_enum.js +7 -1
- package/build/src/abap/types/basic/enum_type.js +1 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +10 -5
- package/package.json +3 -3
|
@@ -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);
|
|
@@ -8,11 +8,17 @@ const inline_field_definition_1 = require("./inline_field_definition");
|
|
|
8
8
|
const unknown_type_1 = require("../../types/basic/unknown_type");
|
|
9
9
|
const _scope_type_1 = require("../_scope_type");
|
|
10
10
|
const reduce_next_1 = require("./reduce_next");
|
|
11
|
+
const let_1 = require("./let");
|
|
11
12
|
class ReduceBody {
|
|
12
13
|
runSyntax(node, scope, filename) {
|
|
13
14
|
if (node === undefined) {
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
17
|
+
let scoped = false;
|
|
18
|
+
const letNode = node.findDirectExpression(Expressions.Let);
|
|
19
|
+
if (letNode) {
|
|
20
|
+
scoped = new let_1.Let().runSyntax(letNode, scope, filename);
|
|
21
|
+
}
|
|
16
22
|
for (const i of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {
|
|
17
23
|
new inline_field_definition_1.InlineFieldDefinition().runSyntax(i, scope, filename);
|
|
18
24
|
}
|
|
@@ -25,6 +31,9 @@ class ReduceBody {
|
|
|
25
31
|
for (const s of node.findDirectExpressions(Expressions.ReduceNext)) {
|
|
26
32
|
new reduce_next_1.ReduceNext().runSyntax(s, scope, filename);
|
|
27
33
|
}
|
|
34
|
+
if (scoped === true) {
|
|
35
|
+
scope.pop(node.getLastToken().getEnd());
|
|
36
|
+
}
|
|
28
37
|
while (scope.getType() === _scope_type_1.ScopeType.For) {
|
|
29
38
|
scope.pop(node.getLastToken().getEnd());
|
|
30
39
|
}
|
|
@@ -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:
|
|
@@ -8,6 +8,7 @@ const basic_1 = require("../../types/basic");
|
|
|
8
8
|
const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
9
9
|
const _reference_1 = require("../_reference");
|
|
10
10
|
const enum_type_1 = require("../../types/basic/enum_type");
|
|
11
|
+
const _scope_type_1 = require("../_scope_type");
|
|
11
12
|
class TypeEnum {
|
|
12
13
|
runSyntax(node, scope, filename) {
|
|
13
14
|
var _a;
|
|
@@ -48,7 +49,12 @@ class TypeEnum {
|
|
|
48
49
|
}
|
|
49
50
|
const name = begin.findFirstExpression(Expressions.NamespaceSimpleName);
|
|
50
51
|
if (name) {
|
|
51
|
-
|
|
52
|
+
let qualifiedName = name.concatTokens();
|
|
53
|
+
if (scope.getType() === _scope_type_1.ScopeType.ClassDefinition
|
|
54
|
+
|| scope.getType() === _scope_type_1.ScopeType.Interface) {
|
|
55
|
+
qualifiedName = scope.getName() + "=>" + qualifiedName;
|
|
56
|
+
}
|
|
57
|
+
const id = new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), filename, new enum_type_1.EnumType(qualifiedName), ["enum" /* Enum */]);
|
|
52
58
|
scope.addType(id);
|
|
53
59
|
types.push(id);
|
|
54
60
|
}
|
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);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.89.
|
|
3
|
+
"version": "2.89.13",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"@microsoft/api-extractor": "^7.23.0",
|
|
49
49
|
"@types/chai": "^4.3.1",
|
|
50
50
|
"@types/mocha": "^9.1.1",
|
|
51
|
-
"@types/node": "^17.0.
|
|
51
|
+
"@types/node": "^17.0.30",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
53
|
"eslint": "^8.14.0",
|
|
54
54
|
"mocha": "^9.2.2",
|
|
55
55
|
"c8": "^7.11.2",
|
|
56
56
|
"source-map-support": "^0.5.21",
|
|
57
57
|
"ts-json-schema-generator": "^1.0.0",
|
|
58
|
-
"typescript": "^4.6.
|
|
58
|
+
"typescript": "^4.6.4"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"fast-xml-parser": "^4.0.7",
|