@abaplint/core 2.95.15 → 2.95.17

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.
@@ -5927,6 +5927,7 @@ declare class TableType extends AbstractObject {
5927
5927
  };
5928
5928
  getDescription(): string | undefined;
5929
5929
  setDirty(): void;
5930
+ private buildTableOptions;
5930
5931
  parseType(reg: IRegistry): AbstractType;
5931
5932
  private parseXML;
5932
5933
  }
@@ -10,6 +10,7 @@ const class_data_1 = require("../statements/class_data");
10
10
  class ClassData {
11
11
  runSyntax(node, scope, filename) {
12
12
  const name = node.findFirstExpression(Expressions.NamespaceSimpleName).getFirstToken();
13
+ const values = {};
13
14
  const components = [];
14
15
  for (const c of node.getChildren()) {
15
16
  const ctyp = c.get();
@@ -17,11 +18,12 @@ class ClassData {
17
18
  const found = new class_data_1.ClassData().runSyntax(c, scope, filename);
18
19
  if (found) {
19
20
  components.push({ name: found.getName(), type: found.getType() });
21
+ values[found.getName()] = found.getValue();
20
22
  }
21
23
  }
22
24
  // todo, nested structures and INCLUDES
23
25
  }
24
- return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), ["static" /* IdentifierMeta.Static */]);
26
+ return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), ["static" /* IdentifierMeta.Static */], values);
25
27
  }
26
28
  }
27
29
  exports.ClassData = ClassData;
@@ -14,6 +14,7 @@ class Data {
14
14
  var _a;
15
15
  const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();
16
16
  let table = false;
17
+ const values = {};
17
18
  const components = [];
18
19
  for (const c of node.getChildren()) {
19
20
  const ctyp = c.get();
@@ -21,6 +22,7 @@ class Data {
21
22
  const found = new data_1.Data().runSyntax(c, scope, filename);
22
23
  if (found) {
23
24
  components.push({ name: found.getName(), type: found.getType() });
25
+ values[found.getName()] = found.getValue();
24
26
  }
25
27
  }
26
28
  else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {
@@ -75,7 +77,7 @@ class Data {
75
77
  return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true }));
76
78
  }
77
79
  else {
78
- return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components));
80
+ return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), undefined, values);
79
81
  }
80
82
  }
81
83
  }
@@ -5,6 +5,7 @@ const _abstract_object_1 = require("./_abstract_object");
5
5
  const Types = require("../abap/types/basic");
6
6
  const ddic_1 = require("../ddic");
7
7
  const basic_1 = require("../abap/types/basic");
8
+ const xml_utils_1 = require("../xml_utils");
8
9
  class TableType extends _abstract_object_1.AbstractObject {
9
10
  constructor() {
10
11
  super(...arguments);
@@ -27,44 +28,78 @@ class TableType extends _abstract_object_1.AbstractObject {
27
28
  this.parsedXML = undefined;
28
29
  super.setDirty();
29
30
  }
31
+ buildTableOptions() {
32
+ var _a, _b, _c;
33
+ const tableOptions = {
34
+ withHeader: false,
35
+ secondary: [],
36
+ };
37
+ for (const k of ((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.dd43v) || []) {
38
+ const fields = [];
39
+ for (const f of ((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.dd42v) || []) {
40
+ if (f.keyname === k.keyname) {
41
+ fields.push(f.keyfield);
42
+ }
43
+ }
44
+ let accessType = basic_1.TableAccessType.standard;
45
+ switch (k.accessmode) {
46
+ case "S":
47
+ accessType = basic_1.TableAccessType.sorted;
48
+ break;
49
+ case "H":
50
+ accessType = basic_1.TableAccessType.hashed;
51
+ break;
52
+ default:
53
+ break;
54
+ }
55
+ (_c = tableOptions.secondary) === null || _c === void 0 ? void 0 : _c.push({
56
+ name: k.keyname,
57
+ type: accessType,
58
+ keyFields: fields,
59
+ isUnique: k.unique,
60
+ });
61
+ }
62
+ return tableOptions;
63
+ }
30
64
  parseType(reg) {
31
65
  this.parseXML();
32
66
  const ddic = new ddic_1.DDIC(reg);
33
67
  const references = [];
34
68
  let type;
69
+ const tableOptions = this.buildTableOptions();
35
70
  if (this.parsedXML === undefined) {
36
71
  type = new Types.UnknownType("Table Type, parser error", this.getName());
37
72
  }
38
73
  else if (this.parsedXML.rowkind === "S") {
39
74
  const lookup = ddic.lookupTableOrView(this.parsedXML.rowtype);
40
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
75
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
41
76
  if (lookup.object) {
42
77
  references.push({ object: lookup.object });
43
78
  }
44
79
  }
45
80
  else if (this.parsedXML.rowkind === "E") {
46
81
  const lookup = ddic.lookupDataElement(this.parsedXML.rowtype);
47
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
82
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
48
83
  if (lookup.object) {
49
84
  references.push({ object: lookup.object });
50
85
  }
51
86
  }
52
87
  else if (this.parsedXML.rowkind === "L") {
53
88
  const lookup = ddic.lookupTableType(this.parsedXML.rowtype);
54
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
89
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
55
90
  if (lookup.object) {
56
91
  references.push({ object: lookup.object });
57
92
  }
58
93
  }
59
94
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "OBJECT") {
60
- type = new Types.TableType(new basic_1.GenericObjectReferenceType(), { withHeader: false }, this.getName());
95
+ type = new Types.TableType(new basic_1.GenericObjectReferenceType(), tableOptions, this.getName());
61
96
  }
62
97
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "DATA") {
63
- type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), { withHeader: false }, this.getName());
98
+ type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), tableOptions, this.getName());
64
99
  }
65
100
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype !== undefined) {
66
101
  const lookup = ddic.lookupObject(this.parsedXML.rowtype);
67
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
102
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
68
103
  if (lookup.object) {
69
104
  references.push({ object: lookup.object });
70
105
  }
@@ -75,7 +110,7 @@ class TableType extends _abstract_object_1.AbstractObject {
75
110
  }
76
111
  else {
77
112
  const row = ddic.textToType(this.parsedXML.datatype, this.parsedXML.leng, this.parsedXML.decimals, this.getName());
78
- type = new Types.TableType(row, { withHeader: false }, this.getName());
113
+ type = new Types.TableType(row, tableOptions, this.getName());
79
114
  }
80
115
  }
81
116
  else {
@@ -86,20 +121,39 @@ class TableType extends _abstract_object_1.AbstractObject {
86
121
  }
87
122
  ////////////////////
88
123
  parseXML() {
124
+ var _a, _b;
89
125
  if (this.parsedXML !== undefined) {
90
126
  return;
91
127
  }
92
- this.parsedXML = {};
128
+ this.parsedXML = {
129
+ dd42v: [],
130
+ dd43v: [],
131
+ };
93
132
  const parsed = super.parseRaw2();
94
133
  if (parsed === undefined || parsed.abapGit === undefined) {
95
134
  return;
96
135
  }
97
- const dd40v = parsed.abapGit["asx:abap"]["asx:values"].DD40V;
136
+ const values = parsed.abapGit["asx:abap"]["asx:values"];
137
+ const dd40v = values.DD40V;
98
138
  this.parsedXML.rowtype = dd40v.ROWTYPE ? dd40v.ROWTYPE : "";
99
139
  this.parsedXML.rowkind = dd40v.ROWKIND ? dd40v.ROWKIND : "";
100
140
  this.parsedXML.datatype = dd40v.DATATYPE;
101
141
  this.parsedXML.leng = dd40v.LENG;
102
142
  this.parsedXML.decimals = dd40v.DECIMALS;
143
+ for (const x of (0, xml_utils_1.xmlToArray)((_a = values.DD42V) === null || _a === void 0 ? void 0 : _a.DD42V)) {
144
+ this.parsedXML.dd42v.push({
145
+ keyname: x.SECKEYNAME || "",
146
+ keyfield: x.KEYFIELD || "",
147
+ });
148
+ }
149
+ for (const x of (0, xml_utils_1.xmlToArray)((_b = values.DD43V) === null || _b === void 0 ? void 0 : _b.DD43V)) {
150
+ this.parsedXML.dd43v.push({
151
+ keyname: x.SECKEYNAME || "",
152
+ accessmode: x.ACCESSMODE || "",
153
+ kind: x.KIND || "",
154
+ unique: x.SECKEYUNIQUE === "X",
155
+ });
156
+ }
103
157
  }
104
158
  }
105
159
  exports.TableType = TableType;
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.95.15";
66
+ return "2.95.17";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -28,8 +28,10 @@ class Abapdoc extends _abap_rule_1.ABAPRule {
28
28
  shortDescription: `Various checks regarding abapdoc.
29
29
  Base rule checks for existence of abapdoc for public class methods and all interface methods.
30
30
 
31
- Plus class and interface definitions.`,
32
- tags: [_irule_1.RuleTag.SingleFile],
31
+ Plus class and interface definitions.
32
+
33
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-only-for-public-apis`,
34
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
33
35
  };
34
36
  }
35
37
  getConfig() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.95.15",
3
+ "version": "2.95.17",
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.13.0",
53
+ "@types/node": "^18.14.0",
54
54
  "chai": "^4.3.7",
55
55
  "eslint": "^8.34.0",
56
56
  "mocha": "^10.2.0",
@@ -62,6 +62,6 @@
62
62
  "dependencies": {
63
63
  "fast-xml-parser": "^4.1.2",
64
64
  "json5": "^2.2.3",
65
- "vscode-languageserver-types": "^3.17.2"
65
+ "vscode-languageserver-types": "^3.17.3"
66
66
  }
67
67
  }