@abaplint/cli 2.102.2 → 2.102.4

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/cli.js +71 -11
  2. package/package.json +4 -4
package/build/cli.js CHANGED
@@ -21205,6 +21205,7 @@ const _typed_identifier_1 = __webpack_require__(/*! ../types/_typed_identifier *
21205
21205
  const basic_1 = __webpack_require__(/*! ../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
21206
21206
  const ddic_1 = __webpack_require__(/*! ../../ddic */ "./node_modules/@abaplint/core/build/src/ddic.js");
21207
21207
  const _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
21208
+ const _reference_1 = __webpack_require__(/*! ./_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
21208
21209
  class Procedural {
21209
21210
  constructor(reg, scope) {
21210
21211
  this.scope = scope;
@@ -21278,7 +21279,19 @@ class Procedural {
21278
21279
  if (param.type === undefined || param.type === "") {
21279
21280
  found = new basic_1.AnyType();
21280
21281
  }
21281
- else {
21282
+ else if (param.type.includes("=>")) {
21283
+ // then its a type from global INTF or CLAS
21284
+ const [clas, name] = param.type.split("=>");
21285
+ const def = this.scope.findObjectDefinition(clas);
21286
+ if (def) {
21287
+ const type = def.getTypeDefinitions().getByName(name);
21288
+ if (type) {
21289
+ this.scope.addReference(nameToken, type, _reference_1.ReferenceType.TypeReference, filename);
21290
+ found = type.getType();
21291
+ }
21292
+ }
21293
+ }
21294
+ if (found === undefined) {
21282
21295
  found = ddic.lookup(param.type).type;
21283
21296
  }
21284
21297
  if (param.direction === types_1.FunctionModuleParameterDirection.tables) {
@@ -21637,7 +21650,11 @@ class TypeUtils {
21637
21650
  /*
21638
21651
  console.dir(source);
21639
21652
  console.dir(target);
21653
+ console.dir(calculated);
21640
21654
  */
21655
+ if (calculated && source instanceof basic_1.StringType && target instanceof basic_1.XStringType) {
21656
+ return false;
21657
+ }
21641
21658
  if (calculated) {
21642
21659
  return this.isAssignable(source, target);
21643
21660
  }
@@ -21688,6 +21705,9 @@ class TypeUtils {
21688
21705
  }
21689
21706
  return false;
21690
21707
  }
21708
+ else if (target instanceof cgeneric_type_1.CGenericType) {
21709
+ return false;
21710
+ }
21691
21711
  else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
21692
21712
  if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
21693
21713
  return true;
@@ -24632,6 +24652,7 @@ class MethodCallParam {
24632
24652
  sourceType = new source_1.Source().runSyntax(child, scope, filename, targetType);
24633
24653
  }
24634
24654
  const calculated = child.findFirstExpression(Expressions.MethodCallChain) !== undefined
24655
+ || child.findFirstExpression(Expressions.StringTemplate) !== undefined
24635
24656
  || child.findFirstExpression(Expressions.ArithOperator) !== undefined;
24636
24657
  if (sourceType === undefined) {
24637
24658
  throw new Error("No source type determined, method source");
@@ -24889,10 +24910,13 @@ class MethodParameters {
24889
24910
  }
24890
24911
  for (const item of items) {
24891
24912
  const parameter = allImporting.find(p => p.getName().toUpperCase() === item.name);
24913
+ const calculated = item.source.findFirstExpression(Expressions.MethodCallChain) !== undefined
24914
+ || item.source.findFirstExpression(Expressions.StringTemplate) !== undefined
24915
+ || item.source.findFirstExpression(Expressions.ArithOperator) !== undefined;
24892
24916
  if (parameter === undefined) {
24893
24917
  throw new Error("Method importing parameter \"" + item.name + "\" does not exist");
24894
24918
  }
24895
- else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(item.sourceType, parameter.getType()) === false) {
24919
+ else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(item.sourceType, parameter.getType(), calculated) === false) {
24896
24920
  throw new Error("Method parameter type not compatible, " + item.name);
24897
24921
  }
24898
24922
  this.requiredParameters.delete(item.name);
@@ -26050,9 +26074,10 @@ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/
26050
26074
  class StringTemplate {
26051
26075
  runSyntax(node, scope, filename) {
26052
26076
  const typeUtils = new _type_utils_1.TypeUtils(scope);
26077
+ const ret = basic_1.StringType.get();
26053
26078
  for (const templateSource of node.findAllExpressions(Expressions.StringTemplateSource)) {
26054
26079
  const s = templateSource.findDirectExpression(Expressions.Source);
26055
- const type = new source_1.Source().runSyntax(s, scope, filename, basic_1.StringType.get());
26080
+ const type = new source_1.Source().runSyntax(s, scope, filename, ret);
26056
26081
  if (type === undefined) {
26057
26082
  throw new Error("No target type determined");
26058
26083
  }
@@ -26076,7 +26101,7 @@ class StringTemplate {
26076
26101
  throw new Error("Cannot apply ALPHA to this type");
26077
26102
  }
26078
26103
  }
26079
- return basic_1.StringType.get();
26104
+ return ret;
26080
26105
  }
26081
26106
  }
26082
26107
  exports.StringTemplate = StringTemplate;
@@ -47313,23 +47338,52 @@ class TableType extends _abstract_object_1.AbstractObject {
47313
47338
  };
47314
47339
  }
47315
47340
  getDescription() {
47316
- // todo
47317
- return undefined;
47341
+ var _a;
47342
+ this.parseXML();
47343
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.ddtext;
47318
47344
  }
47319
47345
  setDirty() {
47320
47346
  this.parsedXML = undefined;
47321
47347
  super.setDirty();
47322
47348
  }
47323
47349
  buildTableOptions() {
47324
- var _a, _b, _c;
47350
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
47351
+ let primaryKey = undefined;
47352
+ if (((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.accessmode) === "S") {
47353
+ primaryKey = {
47354
+ isUnique: ((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.keykind) === "U",
47355
+ type: basic_1.TableAccessType.sorted,
47356
+ keyFields: [],
47357
+ name: "primary_key",
47358
+ };
47359
+ for (const f of ((_c = this.parsedXML) === null || _c === void 0 ? void 0 : _c.dd42v) || []) {
47360
+ if (f.keyname === "") {
47361
+ primaryKey.keyFields.push(f.keyfield);
47362
+ }
47363
+ }
47364
+ }
47365
+ else if (((_d = this.parsedXML) === null || _d === void 0 ? void 0 : _d.accessmode) === "H") {
47366
+ primaryKey = {
47367
+ isUnique: ((_e = this.parsedXML) === null || _e === void 0 ? void 0 : _e.keykind) === "U",
47368
+ type: basic_1.TableAccessType.hashed,
47369
+ keyFields: [],
47370
+ name: "primary_key",
47371
+ };
47372
+ for (const f of ((_f = this.parsedXML) === null || _f === void 0 ? void 0 : _f.dd42v) || []) {
47373
+ if (f.keyname === "") {
47374
+ primaryKey.keyFields.push(f.keyfield);
47375
+ }
47376
+ }
47377
+ }
47325
47378
  const tableOptions = {
47326
47379
  withHeader: false,
47327
47380
  keyType: Types.TableKeyType.user,
47381
+ primaryKey: primaryKey,
47328
47382
  secondary: [],
47329
47383
  };
47330
- for (const k of ((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.dd43v) || []) {
47384
+ for (const k of ((_g = this.parsedXML) === null || _g === void 0 ? void 0 : _g.dd43v) || []) {
47331
47385
  const fields = [];
47332
- for (const f of ((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.dd42v) || []) {
47386
+ for (const f of ((_h = this.parsedXML) === null || _h === void 0 ? void 0 : _h.dd42v) || []) {
47333
47387
  if (f.keyname === k.keyname) {
47334
47388
  fields.push(f.keyfield);
47335
47389
  }
@@ -47345,7 +47399,7 @@ class TableType extends _abstract_object_1.AbstractObject {
47345
47399
  default:
47346
47400
  break;
47347
47401
  }
47348
- (_c = tableOptions.secondary) === null || _c === void 0 ? void 0 : _c.push({
47402
+ (_j = tableOptions.secondary) === null || _j === void 0 ? void 0 : _j.push({
47349
47403
  name: k.keyname,
47350
47404
  type: accessType,
47351
47405
  keyFields: fields,
@@ -47433,6 +47487,9 @@ class TableType extends _abstract_object_1.AbstractObject {
47433
47487
  this.parsedXML.datatype = dd40v.DATATYPE;
47434
47488
  this.parsedXML.leng = dd40v.LENG;
47435
47489
  this.parsedXML.decimals = dd40v.DECIMALS;
47490
+ this.parsedXML.accessmode = dd40v.ACCESSMODE;
47491
+ this.parsedXML.keykind = dd40v.KEYKIND;
47492
+ this.parsedXML.ddtext = dd40v.DDTEXT;
47436
47493
  for (const x of (0, xml_utils_1.xmlToArray)((_a = values.DD42V) === null || _a === void 0 ? void 0 : _a.DD42V)) {
47437
47494
  this.parsedXML.dd42v.push({
47438
47495
  keyname: x.SECKEYNAME || "",
@@ -48472,7 +48529,7 @@ class Registry {
48472
48529
  }
48473
48530
  static abaplintVersion() {
48474
48531
  // magic, see build script "version.sh"
48475
- return "2.102.2";
48532
+ return "2.102.4";
48476
48533
  }
48477
48534
  getDDICReferences() {
48478
48535
  return this.ddicReferences;
@@ -63844,6 +63901,8 @@ class PreferPragmas extends _abap_rule_1.ABAPRule {
63844
63901
  shortDescription: `prefer pragmas over pseudo comments `,
63845
63902
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-pragmas-to-pseudo-comments`,
63846
63903
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
63904
+ badExample: `DATA foo1 TYPE i. "#EC NEEDED`,
63905
+ goodExample: `DATA foo2 TYPE i ##NEEDED.`,
63847
63906
  };
63848
63907
  }
63849
63908
  getConfig() {
@@ -71782,6 +71841,7 @@ const parseXml = function(xmlData) {
71782
71841
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
71783
71842
  if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
71784
71843
  tagName = tagName.substr(0, tagName.length - 1);
71844
+ jPath = jPath.substr(0, jPath.length - 1);
71785
71845
  tagExp = tagName;
71786
71846
  }else{
71787
71847
  tagExp = tagExp.substr(0, tagExp.length - 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.2",
3
+ "version": "2.102.4",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.2",
41
+ "@abaplint/core": "^2.102.4",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
45
45
  "@types/mocha": "^10.0.1",
46
- "@types/node": "^20.4.2",
46
+ "@types/node": "^20.4.4",
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.7",
49
49
  "chalk": "^5.3.0",
@@ -55,7 +55,7 @@
55
55
  "mocha": "^10.2.0",
56
56
  "progress": "^2.0.3",
57
57
  "typescript": "^5.1.6",
58
- "webpack": "^5.88.1",
58
+ "webpack": "^5.88.2",
59
59
  "webpack-cli": "^5.1.4",
60
60
  "xml-js": "^1.6.11"
61
61
  },