@abaplint/cli 2.120.113 → 2.120.114

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 +61 -24
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -30039,6 +30039,18 @@ class BasicTypes {
30039
30039
  else if (type instanceof Types.TimeType) {
30040
30040
  type = new Types.TimeType(data);
30041
30041
  }
30042
+ else if (type instanceof Types.PackedType) {
30043
+ type = new Types.PackedType(type.getLength(), type.getDecimals(), data);
30044
+ }
30045
+ else if (type instanceof Types.DecFloat16Type) {
30046
+ type = new Types.DecFloat16Type(data);
30047
+ }
30048
+ else if (type instanceof Types.DecFloat34Type) {
30049
+ type = new Types.DecFloat34Type(data);
30050
+ }
30051
+ else if (type instanceof Types.UTCLongType) {
30052
+ type = new Types.UTCLongType(data);
30053
+ }
30042
30054
  else if (type instanceof basic_1.StructureType) {
30043
30055
  type = new basic_1.StructureType(type.getComponents().slice(), qualifiedName, undefined, type.getDescription());
30044
30056
  }
@@ -31259,10 +31271,13 @@ exports.checkHeaderLine = checkHeaderLine;
31259
31271
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
31260
31272
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
31261
31273
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
31274
+ const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
31262
31275
  // A table with header line written without [] is the header line, not the table body,
31263
- // so it cannot be passed to a table typed method parameter. Returns true if an issue was reported.
31264
- function checkHeaderLine(source, sourceType, parameterType, input) {
31276
+ // so it cannot be passed to a table typed method parameter. Built-in functions like lines( ) use
31277
+ // the table body, so they are not checked. Returns true if an issue was reported.
31278
+ function checkHeaderLine(source, sourceType, parameterType, method, input) {
31265
31279
  if (source === undefined
31280
+ || method instanceof _builtin_1.BuiltInMethod
31266
31281
  || !(parameterType instanceof basic_1.TableType)
31267
31282
  || !(sourceType instanceof basic_1.TableType)
31268
31283
  || sourceType.isWithHeader() === false) {
@@ -35248,7 +35263,7 @@ class MethodCallParam {
35248
35263
  else if ((0, _check_text_symbol_1.checkTextSymbol)(child, targetType, input)) {
35249
35264
  return;
35250
35265
  }
35251
- else if ((0, _check_header_line_1.checkHeaderLine)(child, sourceType, targetType, input)) {
35266
+ else if ((0, _check_header_line_1.checkHeaderLine)(child, sourceType, targetType, method, input)) {
35252
35267
  return;
35253
35268
  }
35254
35269
  else if (this.isAssignable(sourceType, targetType, child, method, input) === false) {
@@ -35680,7 +35695,7 @@ class MethodParameters {
35680
35695
  if ((0, _check_text_symbol_1.checkTextSymbol)(item.source, parameter.getType(), input)) {
35681
35696
  return;
35682
35697
  }
35683
- else if ((0, _check_header_line_1.checkHeaderLine)(item.source, item.sourceType, parameter.getType(), input)) {
35698
+ else if ((0, _check_header_line_1.checkHeaderLine)(item.source, item.sourceType, parameter.getType(), method, input)) {
35684
35699
  return;
35685
35700
  }
35686
35701
  else if (assignable(item.sourceType, parameter.getType(), item.source) === false) {
@@ -57330,7 +57345,6 @@ class MethodParameters {
57330
57345
  try {
57331
57346
  this.parse(node, input, parentName, abstractMethod);
57332
57347
  this.checkNameLengths(input);
57333
- this.checkDuplicateNames();
57334
57348
  }
57335
57349
  finally {
57336
57350
  input.scope.pop(node.getEnd());
@@ -57467,19 +57481,21 @@ class MethodParameters {
57467
57481
  }
57468
57482
  const returning = node.findFirstExpression(Expressions.MethodDefReturning);
57469
57483
  if (returning) {
57470
- this.returning = method_def_returning_1.MethodDefReturning.runSyntax(returning, input, ["returning" /* IdentifierMeta.MethodReturning */]);
57484
+ const id = method_def_returning_1.MethodDefReturning.runSyntax(returning, input, ["returning" /* IdentifierMeta.MethodReturning */]);
57485
+ if (this.isDuplicateName(id, input) === false) {
57486
+ this.returning = id;
57487
+ }
57471
57488
  }
57472
57489
  this.workaroundRAP(node, input, parentName);
57473
57490
  }
57474
- checkDuplicateNames() {
57475
- const names = new Set();
57476
- for (const parameter of this.getAll()) {
57477
- const name = parameter.getName().toUpperCase();
57478
- if (names.has(name)) {
57479
- throw new Error(`Method parameter "${name}" already defined`);
57480
- }
57481
- names.add(name);
57491
+ /** reports a parameter with the name of an earlier one, the method definition is kept without it */
57492
+ isDuplicateName(id, input) {
57493
+ const name = id.getName().toUpperCase();
57494
+ if (this.getAll().some(p => p.getName().toUpperCase() === name)) {
57495
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, id.getToken(), `Method parameter "${name}" already defined`));
57496
+ return true;
57482
57497
  }
57498
+ return false;
57483
57499
  }
57484
57500
  checkNameLengths(input) {
57485
57501
  for (const parameter of this.getAll()) {
@@ -57555,7 +57571,8 @@ class MethodParameters {
57555
57571
  add(target, source, input, meta, abstractMethod) {
57556
57572
  var _a;
57557
57573
  this.checkKeywordNames(source, input);
57558
- for (const opt of source.findAllExpressions(Expressions.MethodParamOptional)) {
57574
+ const optionals = source.findAllExpressions(Expressions.MethodParamOptional);
57575
+ for (const opt of optionals) {
57559
57576
  const p = opt.findDirectExpression(Expressions.MethodParam);
57560
57577
  if (p === undefined) {
57561
57578
  continue;
@@ -57571,6 +57588,9 @@ class MethodParameters {
57571
57588
  extraMeta.push("abstract" /* IdentifierMeta.Abstract */);
57572
57589
  }
57573
57590
  const id = method_param_1.MethodParam.runSyntax(p, input, [...meta, ...extraMeta]);
57591
+ if (this.isDuplicateName(id, input)) {
57592
+ continue;
57593
+ }
57574
57594
  input.scope.addIdentifier(id);
57575
57595
  target.push(id);
57576
57596
  const optionalToken = opt.findDirectTokenByText("OPTIONAL");
@@ -57591,13 +57611,16 @@ class MethodParameters {
57591
57611
  }
57592
57612
  }
57593
57613
  }
57594
- if (target.length > 0) {
57614
+ if (optionals.length > 0) {
57595
57615
  return;
57596
57616
  }
57597
57617
  const params = source.findAllExpressions(Expressions.MethodParam);
57598
57618
  for (const param of params) {
57599
57619
  const extraMeta = this.isPassByValue(param) ? ["pass_by_value" /* IdentifierMeta.PassByValue */] : [];
57600
- target.push(method_param_1.MethodParam.runSyntax(param, input, [...meta, ...extraMeta]));
57620
+ const id = method_param_1.MethodParam.runSyntax(param, input, [...meta, ...extraMeta]);
57621
+ if (this.isDuplicateName(id, input) === false) {
57622
+ target.push(id);
57623
+ }
57601
57624
  }
57602
57625
  }
57603
57626
  // A system reads a plain parameter name as a keyword wherever that keyword can stand, measured on 758:
@@ -74789,7 +74812,7 @@ class Registry {
74789
74812
  }
74790
74813
  static abaplintVersion() {
74791
74814
  // magic, see build script "version.js"
74792
- return "2.120.113";
74815
+ return "2.120.114";
74793
74816
  }
74794
74817
  getDDICReferences() {
74795
74818
  return this.ddicReferences;
@@ -95430,12 +95453,11 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
95430
95453
  const name = m.objectName + "~" + m.method.name;
95431
95454
  let found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());
95432
95455
  if (found === undefined) {
95433
- // try looking for ALIASes
95434
- for (const alias of def.aliases) {
95435
- if (alias.component.toUpperCase() === name.toUpperCase()) {
95436
- found = impl.methods.find(m => m.getName().toUpperCase() === alias.name.toUpperCase());
95437
- break;
95438
- }
95456
+ // try looking for ALIASes, also the ones inherited from super classes,
95457
+ // "METHODS alias_name REDEFINITION" implements the method through an alias of the super class
95458
+ const alias = this.findAlias(def, name);
95459
+ if (alias !== undefined) {
95460
+ found = impl.methods.find(m => m.getName().toUpperCase() === alias.toUpperCase());
95439
95461
  }
95440
95462
  }
95441
95463
  if (found === undefined && def.superClassName !== undefined) {
@@ -95458,6 +95480,21 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
95458
95480
  }
95459
95481
  return found !== undefined;
95460
95482
  }
95483
+ /** name of the alias for the component, in the class or in one of its super classes */
95484
+ findAlias(def, component) {
95485
+ var _a;
95486
+ const visited = new Set();
95487
+ let current = def;
95488
+ while (current !== undefined && !visited.has(current.name.toUpperCase())) {
95489
+ visited.add(current.name.toUpperCase());
95490
+ const alias = current.aliases.find(a => a.component.toUpperCase() === component.toUpperCase());
95491
+ if (alias !== undefined) {
95492
+ return alias.name;
95493
+ }
95494
+ current = current.superClassName ? (_a = this.findClass(current.superClassName)) === null || _a === void 0 ? void 0 : _a.def : undefined;
95495
+ }
95496
+ return undefined;
95497
+ }
95461
95498
  viaAliasInInterface(m, intf, impl) {
95462
95499
  for (const a of intf.aliases) {
95463
95500
  if (a.component.toUpperCase() === m.objectName.toUpperCase() + "~" + m.method.name.toUpperCase()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.113",
3
+ "version": "2.120.114",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.113",
42
+ "@abaplint/core": "^2.120.114",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",