@abaplint/core 2.95.35 → 2.95.36
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.
|
@@ -1,29 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ComponentChain = void 0;
|
|
4
|
+
const Expressions = require("../../2_statements/expressions");
|
|
4
5
|
const void_type_1 = require("../../types/basic/void_type");
|
|
5
6
|
const structure_type_1 = require("../../types/basic/structure_type");
|
|
7
|
+
const basic_1 = require("../../types/basic");
|
|
8
|
+
const types_1 = require("../../types");
|
|
9
|
+
const _reference_1 = require("../_reference");
|
|
6
10
|
class ComponentChain {
|
|
7
|
-
runSyntax(context, node) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const name = node.getFirstToken().getStr();
|
|
12
|
-
if (!(context instanceof structure_type_1.StructureType)) {
|
|
13
|
-
if (name.toUpperCase() === "TABLE_LINE") {
|
|
11
|
+
runSyntax(context, node, scope, filename) {
|
|
12
|
+
const children = node.getChildren();
|
|
13
|
+
for (let i = 0; i < children.length; i++) {
|
|
14
|
+
if (context instanceof void_type_1.VoidType || context instanceof basic_1.UnknownType) {
|
|
14
15
|
return context;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
const child = children[i];
|
|
18
|
+
if (i === 0 && child.concatTokens().toUpperCase() === "TABLE_LINE") {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
else if (child.get() instanceof Expressions.ArrowOrDash) {
|
|
22
|
+
const concat = child.concatTokens();
|
|
23
|
+
if (concat === "-") {
|
|
24
|
+
if (!(context instanceof structure_type_1.StructureType)) {
|
|
25
|
+
throw new Error("ComponentChain, not a structure");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (concat === "=>") {
|
|
29
|
+
if (!(context instanceof basic_1.ObjectReferenceType)) {
|
|
30
|
+
throw new Error("ComponentChain, not a reference");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (concat === "->") {
|
|
34
|
+
if (!(context instanceof basic_1.ObjectReferenceType) && !(context instanceof basic_1.DataReference)) {
|
|
35
|
+
throw new Error("ComponentChain, not a reference");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (child.get() instanceof Expressions.ComponentName) {
|
|
40
|
+
const name = child.concatTokens();
|
|
41
|
+
if (context instanceof basic_1.DataReference) {
|
|
42
|
+
context = context.getType();
|
|
43
|
+
if (name === "*") {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (context instanceof structure_type_1.StructureType) {
|
|
48
|
+
context = context.getComponentByName(name);
|
|
49
|
+
if (context === undefined) {
|
|
50
|
+
throw new Error("Component \"" + name + "\" not found in structure");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (context instanceof basic_1.ObjectReferenceType) {
|
|
54
|
+
const id = context.getIdentifier();
|
|
55
|
+
if (id instanceof types_1.InterfaceDefinition || id instanceof types_1.ClassDefinition) {
|
|
56
|
+
const found = id.getAttributes().findByName(name);
|
|
57
|
+
context = found === null || found === void 0 ? void 0 : found.getType();
|
|
58
|
+
if (context === undefined) {
|
|
59
|
+
throw new Error("Attribute \"" + name + "\" not found");
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const extra = {
|
|
63
|
+
ooName: id.getName(),
|
|
64
|
+
ooType: id instanceof types_1.ClassDefinition ? "CLAS" : "INTF"
|
|
65
|
+
};
|
|
66
|
+
scope.addReference(child.getFirstToken(), found, _reference_1.ReferenceType.DataWriteReference, filename, extra);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
throw new Error("ComponentChain, unexpected type2");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw new Error("ComponentChain, not a structure");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
24
77
|
}
|
|
25
|
-
|
|
26
|
-
return ret;
|
|
78
|
+
return context;
|
|
27
79
|
}
|
|
28
80
|
}
|
|
29
81
|
exports.ComponentChain = ComponentChain;
|
|
@@ -11,7 +11,7 @@ class ComponentCompareSimple {
|
|
|
11
11
|
for (const c of node.getChildren()) {
|
|
12
12
|
if (c instanceof nodes_1.ExpressionNode) {
|
|
13
13
|
if (c.get() instanceof Expressions.ComponentChainSimple) {
|
|
14
|
-
targetType = new component_chain_1.ComponentChain().runSyntax(rowType, c);
|
|
14
|
+
targetType = new component_chain_1.ComponentChain().runSyntax(rowType, c, scope, filename);
|
|
15
15
|
}
|
|
16
16
|
else if (c.get() instanceof Expressions.Dynamic) {
|
|
17
17
|
targetType = undefined;
|
|
@@ -172,7 +172,7 @@ class Source {
|
|
|
172
172
|
// console.dir("dash");
|
|
173
173
|
}
|
|
174
174
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
|
|
175
|
-
context = new component_chain_1.ComponentChain().runSyntax(context, first);
|
|
175
|
+
context = new component_chain_1.ComponentChain().runSyntax(context, first, scope, filename);
|
|
176
176
|
}
|
|
177
177
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
|
|
178
178
|
context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, _reference_1.ReferenceType.DataReadReference);
|
package/build/src/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.95.
|
|
3
|
+
"version": "2.95.36",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@microsoft/api-extractor": "^7.34.4",
|
|
51
51
|
"@types/chai": "^4.3.4",
|
|
52
52
|
"@types/mocha": "^10.0.1",
|
|
53
|
-
"@types/node": "^18.
|
|
53
|
+
"@types/node": "^18.15.0",
|
|
54
54
|
"chai": "^4.3.7",
|
|
55
55
|
"eslint": "^8.35.0",
|
|
56
56
|
"mocha": "^10.2.0",
|