@abaplint/cli 2.120.30 → 2.120.31

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 +55 -8
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -31478,11 +31478,20 @@ class FormParam {
31478
31478
  return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, basic_1.AnyType.get(), ["form_parameter" /* IdentifierMeta.FormParameter */]);
31479
31479
  }
31480
31480
  let bfound = new basic_types_1.BasicTypes(input).parseType(node);
31481
- const isTypeC = ((_c = node.findFirstExpression(expressions_1.TypeName)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase()) === "C";
31481
+ const typeName = (_c = node.findFirstExpression(expressions_1.TypeName)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();
31482
31482
  const hasExplicitLength = node.findFirstExpression(expressions_1.Length) !== undefined
31483
31483
  || node.findFirstExpression(expressions_1.ConstantFieldLength) !== undefined;
31484
- if (isTypeC && hasExplicitLength === false && bfound instanceof basic_1.CharacterType) {
31485
- bfound = basic_1.CGenericType.get();
31484
+ // the length cannot be specified for FORM parameters, so these types are generic
31485
+ if (hasExplicitLength === false) {
31486
+ if (typeName === "C" && bfound instanceof basic_1.CharacterType) {
31487
+ bfound = basic_1.CGenericType.get();
31488
+ }
31489
+ else if (typeName === "X" && bfound instanceof basic_1.HexType) {
31490
+ bfound = basic_1.XGenericType.get();
31491
+ }
31492
+ else if (typeName === "P" && bfound instanceof basic_1.PackedType) {
31493
+ bfound = basic_1.PGenericType.get();
31494
+ }
31486
31495
  }
31487
31496
  if (nameToken && bfound) {
31488
31497
  return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, bfound, ["form_parameter" /* IdentifierMeta.FormParameter */]);
@@ -43509,6 +43518,11 @@ class Parameter {
43509
43518
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
43510
43519
  return;
43511
43520
  }
43521
+ const radioGroup = node.findFirstExpression(Expressions.RadioGroupName);
43522
+ if (radioGroup && radioGroup.concatTokens().length > 4) {
43523
+ const message = "Radio button group name too long, " + radioGroup.concatTokens();
43524
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, radioGroup.getFirstToken(), message));
43525
+ }
43512
43526
  if (this.hasUserCommand(node) && this.hasLength(node)) {
43513
43527
  const message = "USER-COMMAND and LENGTH not possible together";
43514
43528
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
@@ -43606,6 +43620,7 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build
43606
43620
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
43607
43621
  const assert_error_1 = __webpack_require__(/*! ../assert_error */ "../core/build/src/abap/5_syntax/assert_error.js");
43608
43622
  const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "../core/build/src/abap/5_syntax/expressions/dynamic.js");
43623
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
43609
43624
  class Perform {
43610
43625
  runSyntax(node, input) {
43611
43626
  if (!(node.get() instanceof Statements.Perform)) {
@@ -43613,19 +43628,22 @@ class Perform {
43613
43628
  }
43614
43629
  ////////////////////////////
43615
43630
  // check parameters are defined
43631
+ const changing = [];
43616
43632
  for (const c of node.findDirectExpressions(Expressions.PerformChanging)) {
43617
43633
  for (const s of c.findDirectExpressions(Expressions.Target)) {
43618
- target_1.Target.runSyntax(s, input);
43634
+ changing.push({ node: s, type: target_1.Target.runSyntax(s, input) });
43619
43635
  }
43620
43636
  }
43637
+ const tables = [];
43621
43638
  for (const t of node.findDirectExpressions(Expressions.PerformTables)) {
43622
43639
  for (const s of t.findDirectExpressions(Expressions.Source)) {
43623
- source_1.Source.runSyntax(s, input);
43640
+ tables.push({ node: s, type: source_1.Source.runSyntax(s, input) });
43624
43641
  }
43625
43642
  }
43643
+ const using = [];
43626
43644
  for (const u of node.findDirectExpressions(Expressions.PerformUsing)) {
43627
43645
  for (const s of u.findDirectExpressions(Expressions.SimpleSource3)) {
43628
- source_1.Source.runSyntax(s, input);
43646
+ using.push({ node: s, type: source_1.Source.runSyntax(s, input) });
43629
43647
  }
43630
43648
  }
43631
43649
  ////////////////////////////
@@ -43650,7 +43668,36 @@ class Perform {
43650
43668
  return;
43651
43669
  }
43652
43670
  input.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.FormReference, input.filename);
43653
- // todo, also check parameters match
43671
+ ////////////////////////////
43672
+ // check parameters match
43673
+ // USING and CHANGING are interchangeable, the actual parameters form a single positional list
43674
+ if (this.checkParameters(node, tables, found.getTablesParameters(), "TABLES", input) === false) {
43675
+ return;
43676
+ }
43677
+ const formal = found.getUsingParameters().concat(found.getChangingParameters());
43678
+ this.checkParameters(node, using.concat(changing), formal, "USING/CHANGING", input);
43679
+ }
43680
+ // returns false if an issue was reported
43681
+ checkParameters(node, actual, formal, kind, input) {
43682
+ if (actual.length !== formal.length) {
43683
+ const message = `PERFORM, expected ${formal.length} ${kind} parameters, found ${actual.length}`;
43684
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
43685
+ return false;
43686
+ }
43687
+ const typeUtils = new _type_utils_1.TypeUtils(input.scope);
43688
+ for (let i = 0; i < actual.length; i++) {
43689
+ const { node: source, type } = actual[i];
43690
+ if (type === undefined) {
43691
+ continue;
43692
+ }
43693
+ const parameter = formal[i];
43694
+ if (typeUtils.isAssignableStrict(type, parameter.getType(), source) === false) {
43695
+ const message = `PERFORM parameter type not compatible, ${parameter.getName()}`;
43696
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, source.getFirstToken(), message));
43697
+ return false;
43698
+ }
43699
+ }
43700
+ return true;
43654
43701
  }
43655
43702
  }
43656
43703
  exports.Perform = Perform;
@@ -70003,7 +70050,7 @@ class Registry {
70003
70050
  }
70004
70051
  static abaplintVersion() {
70005
70052
  // magic, see build script "version.js"
70006
- return "2.120.30";
70053
+ return "2.120.31";
70007
70054
  }
70008
70055
  getDDICReferences() {
70009
70056
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.30",
3
+ "version": "2.120.31",
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.30",
42
+ "@abaplint/core": "^2.120.31",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",