@abaplint/core 2.95.34 → 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.
- package/build/src/abap/2_statements/expressions/type_table.js +3 -2
- package/build/src/abap/5_syntax/basic_types.js +3 -0
- package/build/src/abap/5_syntax/expressions/component_chain.js +69 -17
- package/build/src/abap/5_syntax/expressions/component_compare_simple.js +1 -1
- package/build/src/abap/5_syntax/expressions/source.js +1 -1
- package/build/src/registry.js +1 -1
- package/package.json +2 -2
|
@@ -10,13 +10,14 @@ class TypeTable extends combi_1.Expression {
|
|
|
10
10
|
getRunnable() {
|
|
11
11
|
const header = "WITH HEADER LINE";
|
|
12
12
|
const initial = (0, combi_1.seq)("INITIAL SIZE", _1.Constant);
|
|
13
|
-
const
|
|
13
|
+
const generic = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY")), "TABLE");
|
|
14
|
+
const normal1 = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY")), "TABLE OF", (0, combi_1.opt)("REF TO"), (0, combi_1.opt)(_1.TypeName));
|
|
14
15
|
const likeType = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY")), "TABLE OF", (0, combi_1.optPrio)("REF TO"), (0, combi_1.opt)(field_chain_1.FieldChain), (0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))));
|
|
15
16
|
const rangeType = (0, combi_1.seq)("RANGE OF", _1.TypeName, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));
|
|
16
17
|
const rangeLike = (0, combi_1.seq)("RANGE OF", _1.SimpleFieldChain, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));
|
|
17
18
|
// a maximum of 15 secondary table keys can be defined
|
|
18
19
|
// "WITH" is not allowed as a field name in keys
|
|
19
|
-
const typetable = (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))));
|
|
20
|
+
const typetable = (0, combi_1.alt)(generic, (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial)))));
|
|
20
21
|
const occurs = (0, combi_1.seq)("OCCURS", _1.Integer);
|
|
21
22
|
const derived = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("TABLE FOR", (0, combi_1.altPrio)("ACTION IMPORT", "ACTION RESULT", "CREATE", "FAILED", "LOCK", "READ RESULT", "UPDATE"), _1.TypeName));
|
|
22
23
|
const oldType = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
|
|
@@ -691,6 +691,9 @@ class BasicTypes {
|
|
|
691
691
|
return new Types.UnknownType("Not a structured type");
|
|
692
692
|
}
|
|
693
693
|
foundType = foundType.getComponentByName(subs[0]);
|
|
694
|
+
if (foundType === undefined) {
|
|
695
|
+
return new Types.UnknownType(`Field "${subs[0]}" not found in structure`);
|
|
696
|
+
}
|
|
694
697
|
subs.shift();
|
|
695
698
|
}
|
|
696
699
|
return foundType;
|
|
@@ -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",
|