@abaplint/transpiler-cli 2.4.17 → 2.4.18

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.
Files changed (2) hide show
  1. package/build/bundle.js +72 -10
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -44709,6 +44709,7 @@ const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node
44709
44709
  const Types = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
44710
44710
  const ddic_1 = __webpack_require__(/*! ../ddic */ "./node_modules/@abaplint/core/build/src/ddic.js");
44711
44711
  const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
44712
+ const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
44712
44713
  class TableType extends _abstract_object_1.AbstractObject {
44713
44714
  constructor() {
44714
44715
  super(...arguments);
@@ -44731,44 +44732,78 @@ class TableType extends _abstract_object_1.AbstractObject {
44731
44732
  this.parsedXML = undefined;
44732
44733
  super.setDirty();
44733
44734
  }
44735
+ buildTableOptions() {
44736
+ var _a, _b, _c;
44737
+ const tableOptions = {
44738
+ withHeader: false,
44739
+ secondary: [],
44740
+ };
44741
+ for (const k of ((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.dd43v) || []) {
44742
+ const fields = [];
44743
+ for (const f of ((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.dd42v) || []) {
44744
+ if (f.keyname === k.keyname) {
44745
+ fields.push(f.keyfield);
44746
+ }
44747
+ }
44748
+ let accessType = basic_1.TableAccessType.standard;
44749
+ switch (k.accessmode) {
44750
+ case "S":
44751
+ accessType = basic_1.TableAccessType.sorted;
44752
+ break;
44753
+ case "H":
44754
+ accessType = basic_1.TableAccessType.hashed;
44755
+ break;
44756
+ default:
44757
+ break;
44758
+ }
44759
+ (_c = tableOptions.secondary) === null || _c === void 0 ? void 0 : _c.push({
44760
+ name: k.keyname,
44761
+ type: accessType,
44762
+ keyFields: fields,
44763
+ isUnique: k.unique,
44764
+ });
44765
+ }
44766
+ return tableOptions;
44767
+ }
44734
44768
  parseType(reg) {
44735
44769
  this.parseXML();
44736
44770
  const ddic = new ddic_1.DDIC(reg);
44737
44771
  const references = [];
44738
44772
  let type;
44773
+ const tableOptions = this.buildTableOptions();
44739
44774
  if (this.parsedXML === undefined) {
44740
44775
  type = new Types.UnknownType("Table Type, parser error", this.getName());
44741
44776
  }
44742
44777
  else if (this.parsedXML.rowkind === "S") {
44743
44778
  const lookup = ddic.lookupTableOrView(this.parsedXML.rowtype);
44744
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
44779
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
44745
44780
  if (lookup.object) {
44746
44781
  references.push({ object: lookup.object });
44747
44782
  }
44748
44783
  }
44749
44784
  else if (this.parsedXML.rowkind === "E") {
44750
44785
  const lookup = ddic.lookupDataElement(this.parsedXML.rowtype);
44751
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
44786
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
44752
44787
  if (lookup.object) {
44753
44788
  references.push({ object: lookup.object });
44754
44789
  }
44755
44790
  }
44756
44791
  else if (this.parsedXML.rowkind === "L") {
44757
44792
  const lookup = ddic.lookupTableType(this.parsedXML.rowtype);
44758
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
44793
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
44759
44794
  if (lookup.object) {
44760
44795
  references.push({ object: lookup.object });
44761
44796
  }
44762
44797
  }
44763
44798
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "OBJECT") {
44764
- type = new Types.TableType(new basic_1.GenericObjectReferenceType(), { withHeader: false }, this.getName());
44799
+ type = new Types.TableType(new basic_1.GenericObjectReferenceType(), tableOptions, this.getName());
44765
44800
  }
44766
44801
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "DATA") {
44767
- type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), { withHeader: false }, this.getName());
44802
+ type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), tableOptions, this.getName());
44768
44803
  }
44769
44804
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype !== undefined) {
44770
44805
  const lookup = ddic.lookupObject(this.parsedXML.rowtype);
44771
- type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
44806
+ type = new Types.TableType(lookup.type, tableOptions, this.getName());
44772
44807
  if (lookup.object) {
44773
44808
  references.push({ object: lookup.object });
44774
44809
  }
@@ -44779,7 +44814,7 @@ class TableType extends _abstract_object_1.AbstractObject {
44779
44814
  }
44780
44815
  else {
44781
44816
  const row = ddic.textToType(this.parsedXML.datatype, this.parsedXML.leng, this.parsedXML.decimals, this.getName());
44782
- type = new Types.TableType(row, { withHeader: false }, this.getName());
44817
+ type = new Types.TableType(row, tableOptions, this.getName());
44783
44818
  }
44784
44819
  }
44785
44820
  else {
@@ -44790,20 +44825,39 @@ class TableType extends _abstract_object_1.AbstractObject {
44790
44825
  }
44791
44826
  ////////////////////
44792
44827
  parseXML() {
44828
+ var _a, _b;
44793
44829
  if (this.parsedXML !== undefined) {
44794
44830
  return;
44795
44831
  }
44796
- this.parsedXML = {};
44832
+ this.parsedXML = {
44833
+ dd42v: [],
44834
+ dd43v: [],
44835
+ };
44797
44836
  const parsed = super.parseRaw2();
44798
44837
  if (parsed === undefined || parsed.abapGit === undefined) {
44799
44838
  return;
44800
44839
  }
44801
- const dd40v = parsed.abapGit["asx:abap"]["asx:values"].DD40V;
44840
+ const values = parsed.abapGit["asx:abap"]["asx:values"];
44841
+ const dd40v = values.DD40V;
44802
44842
  this.parsedXML.rowtype = dd40v.ROWTYPE ? dd40v.ROWTYPE : "";
44803
44843
  this.parsedXML.rowkind = dd40v.ROWKIND ? dd40v.ROWKIND : "";
44804
44844
  this.parsedXML.datatype = dd40v.DATATYPE;
44805
44845
  this.parsedXML.leng = dd40v.LENG;
44806
44846
  this.parsedXML.decimals = dd40v.DECIMALS;
44847
+ for (const x of (0, xml_utils_1.xmlToArray)((_a = values.DD42V) === null || _a === void 0 ? void 0 : _a.DD42V)) {
44848
+ this.parsedXML.dd42v.push({
44849
+ keyname: x.SECKEYNAME || "",
44850
+ keyfield: x.KEYFIELD || "",
44851
+ });
44852
+ }
44853
+ for (const x of (0, xml_utils_1.xmlToArray)((_b = values.DD43V) === null || _b === void 0 ? void 0 : _b.DD43V)) {
44854
+ this.parsedXML.dd43v.push({
44855
+ keyname: x.SECKEYNAME || "",
44856
+ accessmode: x.ACCESSMODE || "",
44857
+ kind: x.KIND || "",
44858
+ unique: x.SECKEYUNIQUE === "X",
44859
+ });
44860
+ }
44807
44861
  }
44808
44862
  }
44809
44863
  exports.TableType = TableType;
@@ -45859,7 +45913,7 @@ class Registry {
45859
45913
  }
45860
45914
  static abaplintVersion() {
45861
45915
  // magic, see build script "version.sh"
45862
- return "2.95.15";
45916
+ return "2.95.16";
45863
45917
  }
45864
45918
  getDDICReferences() {
45865
45919
  return this.references;
@@ -67054,6 +67108,14 @@ class ComponentCompareTranspiler {
67054
67108
  else if (concat.endsWith("IS INITIAL")) {
67055
67109
  return new chunk_1.Chunk(`(I) => {return abap.compare.initial(I.${component});}`);
67056
67110
  }
67111
+ if (concat.startsWith(component.toUpperCase() + " IN ")) {
67112
+ const source = traversal.traverse(node.findDirectExpression(core_1.Expressions.Source)).getCode();
67113
+ return new chunk_1.Chunk(`(I) => {return ${pre}abap.compare.in(I.${component}, ${source});}`);
67114
+ }
67115
+ else if (concat.startsWith(component.toUpperCase() + " NOT IN ")) {
67116
+ const source = traversal.traverse(node.findDirectExpression(core_1.Expressions.Source)).getCode();
67117
+ return new chunk_1.Chunk(`(I) => {return !abap.compare.in(I.${component}, ${source});}`);
67118
+ }
67057
67119
  if ((concat.startsWith("NOT") && concat.endsWith("IS BOUND"))
67058
67120
  || concat.endsWith("IS NOT BOUND")) {
67059
67121
  return new chunk_1.Chunk(`(I) => {return abap.compare.initial(I.${component});}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.4.17",
3
+ "version": "2.4.18",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,11 +25,11 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.4.17",
28
+ "@abaplint/transpiler": "^2.4.18",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
- "@abaplint/core": "^2.95.15",
32
+ "@abaplint/core": "^2.95.16",
33
33
  "progress": "^2.0.3",
34
34
  "webpack": "^5.75.0",
35
35
  "webpack-cli": "^5.0.1",