@abaplint/transpiler-cli 2.5.21 → 2.5.23

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 +41 -14
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -7452,13 +7452,14 @@ class TypeTable extends combi_1.Expression {
7452
7452
  getRunnable() {
7453
7453
  const header = "WITH HEADER LINE";
7454
7454
  const initial = (0, combi_1.seq)("INITIAL SIZE", _1.Constant);
7455
- const normal1 = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY")), "TABLE", (0, combi_1.opt)("OF"), (0, combi_1.opt)("REF TO"), (0, combi_1.opt)(_1.TypeName));
7455
+ const generic = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY")), "TABLE");
7456
+ 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));
7456
7457
  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))));
7457
7458
  const rangeType = (0, combi_1.seq)("RANGE OF", _1.TypeName, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));
7458
7459
  const rangeLike = (0, combi_1.seq)("RANGE OF", _1.SimpleFieldChain, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));
7459
7460
  // a maximum of 15 secondary table keys can be defined
7460
7461
  // "WITH" is not allowed as a field name in keys
7461
- 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))));
7462
+ 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)))));
7462
7463
  const occurs = (0, combi_1.seq)("OCCURS", _1.Integer);
7463
7464
  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));
7464
7465
  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));
@@ -20802,17 +20803,24 @@ class BasicTypes {
20802
20803
  }
20803
20804
  const typeTableKeys = node.findAllExpressions(expressions_1.TypeTableKey);
20804
20805
  const firstKey = typeTableKeys[0];
20806
+ const isNamed = (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) !== undefined;
20805
20807
  const primaryKey = {
20806
20808
  name: "primary_key",
20807
20809
  type: type,
20808
- isUnique: (firstKey === null || firstKey === void 0 ? void 0 : firstKey.concatTokens().toUpperCase().includes("WITH UNIQUE ")) === true,
20810
+ isUnique: isNamed ? false : (firstKey === null || firstKey === void 0 ? void 0 : firstKey.concatTokens().toUpperCase().includes("WITH UNIQUE ")) === true,
20809
20811
  keyFields: [],
20810
20812
  };
20811
- for (const k of (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpressions(expressions_1.FieldSub)) || []) {
20812
- primaryKey.keyFields.push(k.concatTokens().toUpperCase());
20813
+ let start = 1;
20814
+ if (isNamed === false) {
20815
+ for (const k of (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpressions(expressions_1.FieldSub)) || []) {
20816
+ primaryKey.keyFields.push(k.concatTokens().toUpperCase());
20817
+ }
20818
+ }
20819
+ else {
20820
+ start = 0;
20813
20821
  }
20814
20822
  const secondaryKeys = [];
20815
- for (let i = 1; i < typeTableKeys.length; i++) {
20823
+ for (let i = start; i < typeTableKeys.length; i++) {
20816
20824
  const row = typeTableKeys[i];
20817
20825
  const name = (_b = row.findDirectExpression(expressions_1.Field)) === null || _b === void 0 ? void 0 : _b.concatTokens();
20818
20826
  if (name === undefined) {
@@ -21199,6 +21207,9 @@ class BasicTypes {
21199
21207
  return new Types.UnknownType("Not a structured type");
21200
21208
  }
21201
21209
  foundType = foundType.getComponentByName(subs[0]);
21210
+ if (foundType === undefined) {
21211
+ return new Types.UnknownType(`Field "${subs[0]}" not found in structure`);
21212
+ }
21202
21213
  subs.shift();
21203
21214
  }
21204
21215
  return foundType;
@@ -32631,6 +32642,10 @@ class DataReference extends _abstract_type_1.AbstractType {
32631
32642
  return this.type;
32632
32643
  }
32633
32644
  toABAP() {
32645
+ const type = this.type.toABAP();
32646
+ if (type.includes(" TABLE OF ")) {
32647
+ return ""; // hmm, should this return undefined?
32648
+ }
32634
32649
  return "REF TO " + this.type.toABAP();
32635
32650
  }
32636
32651
  isGeneric() {
@@ -33376,9 +33391,13 @@ var TableAccessType;
33376
33391
  })(TableAccessType = exports.TableAccessType || (exports.TableAccessType = {}));
33377
33392
  class TableType extends _abstract_type_1.AbstractType {
33378
33393
  constructor(rowType, options, qualifiedName) {
33394
+ var _a;
33379
33395
  super({ qualifiedName: qualifiedName });
33380
33396
  this.rowType = rowType;
33381
33397
  this.options = options;
33398
+ if (((_a = options.primaryKey) === null || _a === void 0 ? void 0 : _a.type) === TableAccessType.standard && options.primaryKey.isUnique === true) {
33399
+ throw new Error("STANDARD tables cannot have UNIQUE key");
33400
+ }
33382
33401
  }
33383
33402
  getOptions() {
33384
33403
  return this.options;
@@ -42155,7 +42174,7 @@ class GatewayVocabularyAnnotation extends _abstract_object_1.AbstractObject {
42155
42174
  getAllowedNaming() {
42156
42175
  return {
42157
42176
  maxLength: 36,
42158
- allowNamespace: false,
42177
+ allowNamespace: true,
42159
42178
  };
42160
42179
  }
42161
42180
  getDescription() {
@@ -46138,7 +46157,7 @@ class Registry {
46138
46157
  }
46139
46158
  static abaplintVersion() {
46140
46159
  // magic, see build script "version.sh"
46141
- return "2.95.32";
46160
+ return "2.95.35";
46142
46161
  }
46143
46162
  getDDICReferences() {
46144
46163
  return this.references;
@@ -52220,7 +52239,7 @@ ${indentation} output = ${topTarget}.`;
52220
52239
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
52221
52240
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline LOOP input", this.getMetadata().key, this.conf.severity, fix);
52222
52241
  }
52223
- outlineLoopTarget(node, lowFile, _highSyntax) {
52242
+ outlineLoopTarget(node, lowFile, highSyntax) {
52224
52243
  var _a, _b, _c, _d, _e, _f, _g;
52225
52244
  // also allows outlining of voided types
52226
52245
  if (!(node.get() instanceof Statements.Loop)) {
@@ -52231,16 +52250,19 @@ ${indentation} output = ${topTarget}.`;
52231
52250
  return undefined;
52232
52251
  }
52233
52252
  const concat = node.concatTokens().toUpperCase();
52234
- if (concat.includes(" REFERENCE INTO ")
52235
- || concat.includes(" GROUP BY ")
52236
- || concat.startsWith("LOOP AT GROUP ")) {
52253
+ if (concat.includes(" GROUP BY ") || concat.startsWith("LOOP AT GROUP ")) {
52237
52254
  return undefined;
52238
52255
  }
52256
+ const isReference = concat.includes(" REFERENCE INTO ");
52239
52257
  const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
52240
52258
  const dataTarget = (_c = (_b = node.findDirectExpression(Expressions.LoopTarget)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(Expressions.InlineData);
52241
52259
  if (dataTarget) {
52242
52260
  const targetName = ((_d = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || "DOWNPORT_ERROR";
52243
- const code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\n${indentation}`;
52261
+ let code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\n${indentation}`;
52262
+ if (isReference) {
52263
+ const likeName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
52264
+ code = `DATA ${likeName} LIKE LINE OF ${sourceName}.\n${indentation}DATA ${targetName} LIKE REF TO ${likeName}.\n${indentation}`;
52265
+ }
52244
52266
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
52245
52267
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, dataTarget.getFirstToken().getStart(), dataTarget.getLastToken().getEnd(), targetName);
52246
52268
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
@@ -52848,10 +52870,15 @@ ${indentation} output = ${topTarget}.`;
52848
52870
  else if (found.getType() instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {
52849
52871
  continue;
52850
52872
  }
52851
- let type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();
52873
+ let type = found.getType().getQualifiedName()
52874
+ ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase()
52875
+ : found.getType().toABAP();
52852
52876
  if (found.getType() instanceof basic_1.ObjectReferenceType) {
52853
52877
  type = found.getType().toABAP();
52854
52878
  }
52879
+ if (type === "") {
52880
+ continue;
52881
+ }
52855
52882
  const code = `DATA ${name} TYPE ${type}.\n` +
52856
52883
  " ".repeat(node.getFirstToken().getStart().getCol() - 1);
52857
52884
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.21",
3
+ "version": "2.5.23",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,13 +25,13 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.5.21",
28
+ "@abaplint/transpiler": "^2.5.23",
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.32",
32
+ "@abaplint/core": "^2.95.35",
33
33
  "progress": "^2.0.3",
34
- "webpack": "^5.75.0",
34
+ "webpack": "^5.76.0",
35
35
  "webpack-cli": "^5.0.1",
36
36
  "typescript": "=4.8.4"
37
37
  }