@abaplint/cli 2.120.68 → 2.120.70

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 +109 -12
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -31936,6 +31936,9 @@ class FormParam {
31936
31936
  else if (typeName === "P" && bfound instanceof basic_1.PackedType) {
31937
31937
  bfound = basic_1.PGenericType.get();
31938
31938
  }
31939
+ else if (typeName === "N" && bfound instanceof basic_1.NumericType) {
31940
+ bfound = basic_1.NGenericType.get();
31941
+ }
31939
31942
  }
31940
31943
  if (nameToken && bfound) {
31941
31944
  return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, bfound, ["form_parameter" /* IdentifierMeta.FormParameter */]);
@@ -33322,6 +33325,9 @@ class MethodParam {
33322
33325
  else if (concat === "TYPE P" || concat.startsWith("TYPE P ")) {
33323
33326
  return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, basic_1.PGenericType.get(), meta);
33324
33327
  }
33328
+ else if (concat === "TYPE N" || concat.startsWith("TYPE N ")) {
33329
+ return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, basic_1.NGenericType.get(), meta);
33330
+ }
33325
33331
  const found = new basic_types_1.BasicTypes(input).parseType(type);
33326
33332
  if (found) {
33327
33333
  return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, found, meta);
@@ -40024,9 +40030,9 @@ class CreateObject {
40024
40030
  if (name === undefined) {
40025
40031
  continue;
40026
40032
  }
40027
- const source = p.findDirectExpression(Expressions.Source);
40028
- const sourceType = source_1.Source.runSyntax(source, input);
40029
40033
  const found = allImporting === null || allImporting === void 0 ? void 0 : allImporting.find(p => p.getName().toUpperCase() === name);
40034
+ const source = p.findDirectExpression(Expressions.Source);
40035
+ const sourceType = source_1.Source.runSyntax(source, input, found === null || found === void 0 ? void 0 : found.getType());
40030
40036
  if (found === undefined) {
40031
40037
  const message = `constructor parameter "${name}" does not exist`;
40032
40038
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
@@ -51483,6 +51489,7 @@ __exportStar(__webpack_require__(/*! ./generic_object_reference_type */ "../core
51483
51489
  __exportStar(__webpack_require__(/*! ./hex_type */ "../core/build/src/abap/types/basic/hex_type.js"), exports);
51484
51490
  __exportStar(__webpack_require__(/*! ./integer_type */ "../core/build/src/abap/types/basic/integer_type.js"), exports);
51485
51491
  __exportStar(__webpack_require__(/*! ./integer8_type */ "../core/build/src/abap/types/basic/integer8_type.js"), exports);
51492
+ __exportStar(__webpack_require__(/*! ./ngeneric_type */ "../core/build/src/abap/types/basic/ngeneric_type.js"), exports);
51486
51493
  __exportStar(__webpack_require__(/*! ./numeric_generic_type */ "../core/build/src/abap/types/basic/numeric_generic_type.js"), exports);
51487
51494
  __exportStar(__webpack_require__(/*! ./numeric_type */ "../core/build/src/abap/types/basic/numeric_type.js"), exports);
51488
51495
  __exportStar(__webpack_require__(/*! ./object_reference_type */ "../core/build/src/abap/types/basic/object_reference_type.js"), exports);
@@ -51591,6 +51598,39 @@ IntegerType.singletons = new Map();
51591
51598
 
51592
51599
  /***/ },
51593
51600
 
51601
+ /***/ "../core/build/src/abap/types/basic/ngeneric_type.js"
51602
+ /*!***********************************************************!*\
51603
+ !*** ../core/build/src/abap/types/basic/ngeneric_type.js ***!
51604
+ \***********************************************************/
51605
+ (__unused_webpack_module, exports, __webpack_require__) {
51606
+
51607
+ "use strict";
51608
+
51609
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
51610
+ exports.NGenericType = void 0;
51611
+ const numeric_type_1 = __webpack_require__(/*! ./numeric_type */ "../core/build/src/abap/types/basic/numeric_type.js");
51612
+ // "TYPE n" of a method or FORM parameter, where no length can be given.
51613
+ // It is a NumericType, so everything that handles n keeps treating it as such
51614
+ class NGenericType extends numeric_type_1.NumericType {
51615
+ static get() {
51616
+ return this.singleton;
51617
+ }
51618
+ constructor() {
51619
+ super(1);
51620
+ }
51621
+ toText() {
51622
+ return "```n```";
51623
+ }
51624
+ isGeneric() {
51625
+ return true;
51626
+ }
51627
+ }
51628
+ exports.NGenericType = NGenericType;
51629
+ NGenericType.singleton = new NGenericType();
51630
+ //# sourceMappingURL=ngeneric_type.js.map
51631
+
51632
+ /***/ },
51633
+
51594
51634
  /***/ "../core/build/src/abap/types/basic/numeric_generic_type.js"
51595
51635
  /*!******************************************************************!*\
51596
51636
  !*** ../core/build/src/abap/types/basic/numeric_generic_type.js ***!
@@ -70485,7 +70525,7 @@ class Registry {
70485
70525
  }
70486
70526
  static abaplintVersion() {
70487
70527
  // magic, see build script "version.js"
70488
- return "2.120.68";
70528
+ return "2.120.70";
70489
70529
  }
70490
70530
  getDDICReferences() {
70491
70531
  return this.ddicReferences;
@@ -79984,8 +80024,17 @@ ${indentation} output = ${uniqueName}.\n`;
79984
80024
  const extra = (valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.For)) ? " " : "";
79985
80025
  data = indentation + extra + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
79986
80026
  }
80027
+ // all rows are built in the same work area, a component a row leaves out must be initial,
80028
+ // not what an earlier row (or an earlier pass of a surrounding loop) put there
80029
+ const clearRows = valueBody !== undefined && this.valueRowsNeedClear(valueBody);
80030
+ const prefix = [];
79987
80031
  for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {
79988
80032
  if (a.get() instanceof Expressions.FieldAssignment) {
80033
+ if (clearRows === true) {
80034
+ // the shared prefix applies to every following row, re-applied after each CLEAR
80035
+ prefix.push(a.concatTokens());
80036
+ continue;
80037
+ }
79989
80038
  if (added === false) {
79990
80039
  body += data;
79991
80040
  added = true;
@@ -80009,6 +80058,16 @@ ${indentation} output = ${uniqueName}.\n`;
80009
80058
  }
80010
80059
  if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {
80011
80060
  let skip = false;
80061
+ if (clearRows === true && this.isStructuredValueRow(a)) {
80062
+ if (added === false) {
80063
+ body += data;
80064
+ added = true;
80065
+ }
80066
+ body += indentation + `CLEAR ${structureName}.\n`;
80067
+ for (const p of prefix) {
80068
+ body += indentation + structureName + "-" + p + ".\n";
80069
+ }
80070
+ }
80012
80071
  for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {
80013
80072
  if (b.get() instanceof Expressions.FieldAssignment) {
80014
80073
  if (added === false) {
@@ -80087,6 +80146,39 @@ ${indentation} output = ${uniqueName}.\n`;
80087
80146
  }
80088
80147
  return undefined;
80089
80148
  }
80149
+ /** a row that is built in the work area, ie. not "( source )" or "( LINES OF source )" */
80150
+ isStructuredValueRow(row) {
80151
+ return row.findDirectExpression(Expressions.Source) === undefined
80152
+ && row.findDirectExpression(Expressions.ValueBodyLines) === undefined;
80153
+ }
80154
+ /** true if a row can observe a component that an earlier row, or an earlier pass of a surrounding loop,
80155
+ * left in the shared work area. Not the case if all rows assign the same components, and the shared
80156
+ * prefix is not changed between rows, eg. FOR rows or "( a = 1 b = 2 ) ( a = 3 b = 4 )" */
80157
+ valueRowsNeedClear(valueBody) {
80158
+ let shape = undefined;
80159
+ let rowSeen = false;
80160
+ for (const c of valueBody.getChildren()) {
80161
+ if (c.get() instanceof Expressions.FieldAssignment) {
80162
+ if (rowSeen === true) {
80163
+ return true;
80164
+ }
80165
+ }
80166
+ else if (c instanceof nodes_1.ExpressionNode
80167
+ && c.get() instanceof Expressions.ValueBodyLine
80168
+ && this.isStructuredValueRow(c)) {
80169
+ rowSeen = true;
80170
+ const current = c.findDirectExpressions(Expressions.FieldAssignment)
80171
+ .map(f => { var _a; return (_a = f.findDirectExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase().replace(/\s/g, ""); })
80172
+ .sort()
80173
+ .join(",");
80174
+ if (shape !== undefined && shape !== current) {
80175
+ return true;
80176
+ }
80177
+ shape = current;
80178
+ }
80179
+ }
80180
+ return false;
80181
+ }
80090
80182
  outlineLet(node, indentation, highSyntax, lowFile) {
80091
80183
  var _a;
80092
80184
  let ret = "";
@@ -95362,7 +95454,9 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
95362
95454
  title: "RFC error handling",
95363
95455
  tags: [_irule_1.RuleTag.SingleFile],
95364
95456
  shortDescription: `Checks that exceptions 'system_failure' and 'communication_failure' are handled in RFC calls`,
95365
- extendedInformation: `https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenrfc_exception.html`,
95457
+ extendedInformation: `RESOURCE_FAILURE is also required for asynchronous calls with DESTINATION IN GROUP.
95458
+
95459
+ https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenrfc_exception.html`,
95366
95460
  badExample: `CALL FUNCTION 'ZRFC'
95367
95461
  DESTINATION lv_rfc.`,
95368
95462
  goodExample: `CALL FUNCTION 'ZRFC'
@@ -95370,12 +95464,12 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
95370
95464
  EXCEPTIONS
95371
95465
  system_failure = 1 MESSAGE msg
95372
95466
  communication_failure = 2 MESSAGE msg
95373
- resource_failure = 3
95374
- OTHERS = 4.`,
95467
+ OTHERS = 3.`,
95375
95468
  };
95376
95469
  }
95377
- getMessage() {
95378
- return "RFC error handling: At least one unhandled exception from SYSTEM_FAILURE, COMMUNICATION_FAILURE, RESOURCE_FAILURE";
95470
+ getMessage(requireResourceFailure) {
95471
+ return "RFC error handling: At least one unhandled exception from SYSTEM_FAILURE, COMMUNICATION_FAILURE"
95472
+ + (requireResourceFailure ? ", RESOURCE_FAILURE" : "");
95379
95473
  }
95380
95474
  getConfig() {
95381
95475
  return this.conf;
@@ -95390,12 +95484,15 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
95390
95484
  if (!(stat.get() instanceof Statements.CallFunction)) {
95391
95485
  continue;
95392
95486
  }
95393
- if (!stat.findFirstExpression(Expressions.Destination)) {
95487
+ const destination = stat.findFirstExpression(Expressions.Destination);
95488
+ if (destination === undefined) {
95394
95489
  continue;
95395
95490
  }
95491
+ const requireResourceFailure = stat.findDirectTokenByText("STARTING") !== undefined
95492
+ && destination.findDirectTokenByText("GROUP") !== undefined;
95396
95493
  const list = stat.findFirstExpression(Expressions.ParameterListExceptions);
95397
95494
  if (list === undefined) {
95398
- const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
95495
+ const issue = issue_1.Issue.atToken(file, token, this.getMessage(requireResourceFailure), this.getMetadata().key, this.conf.severity);
95399
95496
  output.push(issue);
95400
95497
  continue;
95401
95498
  }
@@ -95406,8 +95503,8 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
95406
95503
  }
95407
95504
  if (names.indexOf("SYSTEM_FAILURE") < 0
95408
95505
  || names.indexOf("COMMUNICATION_FAILURE") < 0
95409
- || names.indexOf("RESOURCE_FAILURE") < 0) {
95410
- const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
95506
+ || (requireResourceFailure && names.indexOf("RESOURCE_FAILURE") < 0)) {
95507
+ const issue = issue_1.Issue.atToken(file, token, this.getMessage(requireResourceFailure), this.getMetadata().key, this.conf.severity);
95411
95508
  output.push(issue);
95412
95509
  continue;
95413
95510
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.68",
3
+ "version": "2.120.70",
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.68",
42
+ "@abaplint/core": "^2.120.70",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",