@abaplint/cli 2.119.67 → 2.120.1

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 +659 -41
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -26002,7 +26002,7 @@ class CurrentScope {
26002
26002
  return this.reg.getConfig().getLanguageVersion();
26003
26003
  }
26004
26004
  getOpenABAP() {
26005
- return this.reg.getConfig().getOpenABAP();
26005
+ return this.reg.getConfig().isOpenABAP();
26006
26006
  }
26007
26007
  getRegistry() {
26008
26008
  return this.reg;
@@ -29006,6 +29006,75 @@ exports.BasicTypes = BasicTypes;
29006
29006
 
29007
29007
  /***/ },
29008
29008
 
29009
+ /***/ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js"
29010
+ /*!***************************************************************************!*\
29011
+ !*** ../core/build/src/abap/5_syntax/expressions/_check_offset_length.js ***!
29012
+ \***************************************************************************/
29013
+ (__unused_webpack_module, exports, __webpack_require__) {
29014
+
29015
+ "use strict";
29016
+
29017
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29018
+ if (k2 === undefined) k2 = k;
29019
+ var desc = Object.getOwnPropertyDescriptor(m, k);
29020
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
29021
+ desc = { enumerable: true, get: function() { return m[k]; } };
29022
+ }
29023
+ Object.defineProperty(o, k2, desc);
29024
+ }) : (function(o, m, k, k2) {
29025
+ if (k2 === undefined) k2 = k;
29026
+ o[k2] = m[k];
29027
+ }));
29028
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29029
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29030
+ }) : function(o, v) {
29031
+ o["default"] = v;
29032
+ });
29033
+ var __importStar = (this && this.__importStar) || (function () {
29034
+ var ownKeys = function(o) {
29035
+ ownKeys = Object.getOwnPropertyNames || function (o) {
29036
+ var ar = [];
29037
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29038
+ return ar;
29039
+ };
29040
+ return ownKeys(o);
29041
+ };
29042
+ return function (mod) {
29043
+ if (mod && mod.__esModule) return mod;
29044
+ var result = {};
29045
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
29046
+ __setModuleDefault(result, mod);
29047
+ return result;
29048
+ };
29049
+ })();
29050
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
29051
+ exports.checkOffsetLength = checkOffsetLength;
29052
+ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
29053
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
29054
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
29055
+ const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
29056
+ // Offsets or lengths cannot be specified for STRING or XSTRING fields
29057
+ // passed as a method parameter source. Returns true if an issue was reported.
29058
+ function checkOffsetLength(source, sourceType, method, input) {
29059
+ const chain = source.findDirectExpression(Expressions.FieldChain);
29060
+ const isCalculated = source.findDirectExpression(Expressions.Source) !== undefined;
29061
+ const hasOffsetOrLength = chain !== undefined
29062
+ && isCalculated === false
29063
+ && (chain.findDirectExpression(Expressions.FieldOffset) !== undefined
29064
+ || chain.findDirectExpression(Expressions.FieldLength) !== undefined);
29065
+ if (hasOffsetOrLength
29066
+ && !(method instanceof _builtin_1.BuiltInMethod)
29067
+ && (sourceType instanceof basic_1.StringType || sourceType instanceof basic_1.XStringType)) {
29068
+ const message = `Offsets or lengths cannot be specified for fields of type "STRING" or "XSTRING" in the current statement`;
29069
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, source.getFirstToken(), message));
29070
+ return true;
29071
+ }
29072
+ return false;
29073
+ }
29074
+ //# sourceMappingURL=_check_offset_length.js.map
29075
+
29076
+ /***/ },
29077
+
29009
29078
  /***/ "../core/build/src/abap/5_syntax/expressions/attribute_chain.js"
29010
29079
  /*!**********************************************************************!*\
29011
29080
  !*** ../core/build/src/abap/5_syntax/expressions/attribute_chain.js ***!
@@ -32150,7 +32219,7 @@ const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_s
32150
32219
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
32151
32220
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
32152
32221
  const constant_1 = __webpack_require__(/*! ./constant */ "../core/build/src/abap/5_syntax/expressions/constant.js");
32153
- const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
32222
+ const _check_offset_length_1 = __webpack_require__(/*! ./_check_offset_length */ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js");
32154
32223
  class MethodCallParam {
32155
32224
  static runSyntax(node, input, method) {
32156
32225
  if (!(node.get() instanceof Expressions.MethodCallParam)) {
@@ -32211,17 +32280,7 @@ class MethodCallParam {
32211
32280
  let sourceType = undefined;
32212
32281
  if (child.get() instanceof Expressions.Source) {
32213
32282
  sourceType = source_1.Source.runSyntax(child, input, targetType);
32214
- const chain = child.findDirectExpression(Expressions.FieldChain);
32215
- const isCalculated = child.findDirectExpression(Expressions.Source) !== undefined;
32216
- const hasOffsetOrLength = chain !== undefined
32217
- && isCalculated === false
32218
- && (chain.findDirectExpression(Expressions.FieldOffset) !== undefined
32219
- || chain.findDirectExpression(Expressions.FieldLength) !== undefined);
32220
- if (hasOffsetOrLength
32221
- && !(method instanceof _builtin_1.BuiltInMethod)
32222
- && (sourceType instanceof basic_1.StringType || sourceType instanceof basic_1.XStringType)) {
32223
- const message = `Offsets or lengths cannot be specified for fields of type "STRING" or "XSTRING" in the current statement`;
32224
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
32283
+ if ((0, _check_offset_length_1.checkOffsetLength)(child, sourceType, method, input)) {
32225
32284
  return;
32226
32285
  }
32227
32286
  }
@@ -32480,6 +32539,7 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
32480
32539
  const assert_error_1 = __webpack_require__(/*! ../assert_error */ "../core/build/src/abap/5_syntax/assert_error.js");
32481
32540
  const field_chain_1 = __webpack_require__(/*! ./field_chain */ "../core/build/src/abap/5_syntax/expressions/field_chain.js");
32482
32541
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
32542
+ const _check_offset_length_1 = __webpack_require__(/*! ./_check_offset_length */ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js");
32483
32543
  class MethodParameters {
32484
32544
  constructor() {
32485
32545
  this.requiredParameters = undefined;
@@ -32650,7 +32710,6 @@ class MethodParameters {
32650
32710
  }
32651
32711
  }
32652
32712
  parameterListS(node, input, method) {
32653
- var _a;
32654
32713
  if (node === undefined) {
32655
32714
  return [];
32656
32715
  }
@@ -32658,14 +32717,21 @@ class MethodParameters {
32658
32717
  throw new assert_error_1.AssertError("parameterListS, unexpected node");
32659
32718
  }
32660
32719
  const ret = [];
32720
+ const supplied = new Set();
32661
32721
  for (const c of node.getChildren()) {
32662
32722
  if (!(c.get() instanceof Expressions.ParameterS) || !(c instanceof nodes_1.ExpressionNode)) {
32663
32723
  throw new assert_error_1.AssertError("parameterListS, unexpected node, child");
32664
32724
  }
32665
- const name = (_a = c.findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toUpperCase();
32666
- if (name === undefined) {
32725
+ const nameNode = c.findDirectExpression(Expressions.ParameterName);
32726
+ const name = nameNode === null || nameNode === void 0 ? void 0 : nameNode.getFirstToken().getStr().toUpperCase();
32727
+ if (name === undefined || nameNode === undefined) {
32667
32728
  throw new assert_error_1.AssertError("parameterListS, no name determined");
32668
32729
  }
32730
+ if (supplied.has(name)) {
32731
+ const message = `Method parameter "${name}" is supplied more than once`;
32732
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), message));
32733
+ }
32734
+ supplied.add(name);
32669
32735
  const source = c.findDirectExpression(Expressions.Source);
32670
32736
  if (source === undefined) {
32671
32737
  throw new assert_error_1.AssertError("parameterListS, no source found");
@@ -32683,6 +32749,7 @@ class MethodParameters {
32683
32749
  targetType = method;
32684
32750
  }
32685
32751
  let sourceType = source_1.Source.runSyntax(source, input, targetType);
32752
+ (0, _check_offset_length_1.checkOffsetLength)(source, sourceType, method, input);
32686
32753
  if (sourceType === undefined) {
32687
32754
  if (method instanceof basic_1.VoidType) {
32688
32755
  sourceType = method;
@@ -32698,7 +32765,6 @@ class MethodParameters {
32698
32765
  return ret;
32699
32766
  }
32700
32767
  parameterListT(node, input) {
32701
- var _a;
32702
32768
  if (node === undefined) {
32703
32769
  return [];
32704
32770
  }
@@ -32706,14 +32772,21 @@ class MethodParameters {
32706
32772
  throw new assert_error_1.AssertError("parameterListT, unexpected node");
32707
32773
  }
32708
32774
  const ret = [];
32775
+ const supplied = new Set();
32709
32776
  for (const c of node.getChildren()) {
32710
32777
  if (!(c.get() instanceof Expressions.ParameterT) || !(c instanceof nodes_1.ExpressionNode)) {
32711
32778
  throw new assert_error_1.AssertError("parameterListT, unexpected node, child");
32712
32779
  }
32713
- const name = (_a = c.findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toUpperCase();
32714
- if (name === undefined) {
32780
+ const nameNode = c.findDirectExpression(Expressions.ParameterName);
32781
+ const name = nameNode === null || nameNode === void 0 ? void 0 : nameNode.getFirstToken().getStr().toUpperCase();
32782
+ if (name === undefined || nameNode === undefined) {
32715
32783
  throw new assert_error_1.AssertError("parameterListT, no name determined");
32716
32784
  }
32785
+ if (supplied.has(name)) {
32786
+ const message = `Method parameter "${name}" is supplied more than once`;
32787
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), message));
32788
+ }
32789
+ supplied.add(name);
32717
32790
  const target = c.findDirectExpression(Expressions.Target);
32718
32791
  if (target === undefined) {
32719
32792
  throw new assert_error_1.AssertError("parameterListT, no target found");
@@ -37242,6 +37315,7 @@ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/
37242
37315
  const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build/src/abap/5_syntax/expressions/target.js");
37243
37316
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
37244
37317
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
37318
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
37245
37319
  class Catch {
37246
37320
  runSyntax(node, input) {
37247
37321
  var _a, _b;
@@ -37292,7 +37366,22 @@ class Catch {
37292
37366
  }
37293
37367
  }
37294
37368
  else if (target) {
37295
- target_1.Target.runSyntax(target, input);
37369
+ const targetType = target_1.Target.runSyntax(target, input);
37370
+ if (targetType instanceof basic_1.ObjectReferenceType) {
37371
+ for (const c of node.findDirectExpressions(Expressions.ClassName)) {
37372
+ const token = c.getFirstToken();
37373
+ const className = token.getStr().toUpperCase();
37374
+ const found = input.scope.existsObject(className);
37375
+ if (found === null || found === void 0 ? void 0 : found.id) {
37376
+ const catchType = new basic_1.ObjectReferenceType(found.id);
37377
+ if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(catchType, targetType) === false) {
37378
+ const message = "CATCH target not compatible with " + className;
37379
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
37380
+ return;
37381
+ }
37382
+ }
37383
+ }
37384
+ }
37296
37385
  }
37297
37386
  }
37298
37387
  }
@@ -53616,7 +53705,7 @@ class CDSDefineAbstract extends combi_1.Expression {
53616
53705
  getRunnable() {
53617
53706
  const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", _1.CDSType, ";");
53618
53707
  const compsiOrAssoci = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), cds_name_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
53619
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), "ABSTRACT", "ENTITY", cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.alt)(field, compsiOrAssoci)), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
53708
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), "ABSTRACT", "ENTITY", cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.alt)(field, compsiOrAssoci)), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
53620
53709
  }
53621
53710
  }
53622
53711
  exports.CDSDefineAbstract = CDSDefineAbstract;
@@ -53642,7 +53731,7 @@ class CDSDefineCustom extends combi_1.Expression {
53642
53731
  getRunnable() {
53643
53732
  const field = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", cds_type_1.CDSType, ";");
53644
53733
  const compsiOrAssoci = (0, combi_1.seq)(cds_name_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
53645
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE"), (0, combi_1.opt)((0, combi_1.str)("ROOT")), (0, combi_1.str)("CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
53734
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.str)("CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
53646
53735
  }
53647
53736
  }
53648
53737
  exports.CDSDefineCustom = CDSDefineCustom;
@@ -53672,7 +53761,7 @@ class CDSDefineExternalEntity extends combi_1.Expression {
53672
53761
  const body = (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp));
53673
53762
  const externalEntity = (0, combi_1.seq)((0, combi_1.opt)("WRITABLE"), "EXTERNAL", "ENTITY", _1.CDSName, (0, combi_1.opt)(externalName), (0, combi_1.opt)(_1.CDSWithParameters));
53674
53763
  const staticEntity = (0, combi_1.seq)("STATIC", "ENTITY", _1.CDSName, (0, combi_1.opt)(externalName));
53675
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.alt)(externalEntity, staticEntity), (0, combi_1.str)("{"), body, (0, combi_1.str)("}"), (0, combi_1.opt)((0, combi_1.seq)("WITH", "FEDERATED", "DATA", (0, combi_1.optPrio)((0, combi_1.alt)((0, combi_1.seq)("PROVIDED", "AT", "RUNTIME"), (0, combi_1.seq)("PROVIDED", "BY", _1.CDSName))))), (0, combi_1.opt)(";"));
53764
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.alt)(externalEntity, staticEntity), (0, combi_1.str)("{"), body, (0, combi_1.str)("}"), (0, combi_1.opt)((0, combi_1.seq)("WITH", "FEDERATED", "DATA", (0, combi_1.optPrio)((0, combi_1.alt)((0, combi_1.seq)("PROVIDED", "AT", "RUNTIME"), (0, combi_1.seq)("PROVIDED", "BY", _1.CDSName))))), (0, combi_1.opt)(";"));
53676
53765
  }
53677
53766
  }
53678
53767
  exports.CDSDefineExternalEntity = CDSDefineExternalEntity;
@@ -53704,7 +53793,7 @@ class CDSDefineHierarchy extends combi_1.Expression {
53704
53793
  const depthValue = (0, combi_1.altPrio)(_1.CDSString, _1.CDSInteger, _1.CDSPrefixedName);
53705
53794
  const loadMode = (0, combi_1.altPrio)("BULK", "INCREMENTAL", _1.CDSPrefixedName);
53706
53795
  const hierarchyBody = (0, combi_1.seq)("SOURCE", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), "CHILD", "TO", "PARENT", "ASSOCIATION", _1.CDSName, (0, combi_1.opt)(directory), (0, combi_1.opt)(datePeriod), (0, combi_1.opt)((0, combi_1.seq)("START", "WHERE", _1.CDSCondition)), (0, combi_1.opt)(siblingsOrder), (0, combi_1.opt)((0, combi_1.seq)("LOAD", loadMode)), (0, combi_1.opt)((0, combi_1.seq)("DEPTH", depthValue)), (0, combi_1.opt)((0, combi_1.seq)("NODETYPE", _1.CDSName)), (0, combi_1.opt)((0, combi_1.seq)("MULTIPLE", "PARENTS", (0, combi_1.altPrio)("NOT ALLOWED", "ALLOWED", (0, combi_1.seq)("LEAVES", (0, combi_1.optPrio)("ONLY"))))), (0, combi_1.opt)((0, combi_1.seq)("ORPHANS", (0, combi_1.altPrio)("IGNORE", "ROOT", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("CYCLES", (0, combi_1.altPrio)("BREAKUP", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("GENERATE", "SPANTREE")), (0, combi_1.opt)((0, combi_1.seq)("CACHE", (0, combi_1.altPrio)("ON", "OFF", "FORCE"))));
53707
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", "HIERARCHY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), "AS", "PARENT", "CHILD", "HIERARCHY", "(", hierarchyBody, ")", "{", (0, combi_1.seq)(field, (0, combi_1.star)((0, combi_1.seq)(",", field))), "}", (0, combi_1.opt)(";"));
53796
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), "HIERARCHY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), "AS", "PARENT", "CHILD", "HIERARCHY", "(", hierarchyBody, ")", "{", (0, combi_1.seq)(field, (0, combi_1.star)((0, combi_1.seq)(",", field))), "}", (0, combi_1.opt)(";"));
53708
53797
  }
53709
53798
  }
53710
53799
  exports.CDSDefineHierarchy = CDSDefineHierarchy;
@@ -53729,7 +53818,7 @@ class CDSDefineProjection extends combi_1.Expression {
53729
53818
  getRunnable() {
53730
53819
  // redefine association _Assoc redirected to [composition child | parent] Entity
53731
53820
  const redefineAssoc = (0, combi_1.seq)("REDEFINE", "ASSOCIATION", _1.CDSName, "REDIRECTED", "TO", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("COMPOSITION", "CHILD"), "PARENT")), _1.CDSName);
53732
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), (0, combi_1.opt)("TRANSIENT"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), _1.CDSName, (0, combi_1.opt)(_1.CDSProviderContract), (0, combi_1.opt)(_1.CDSWithParameters), "AS PROJECTION ON", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, redefineAssoc)), (0, combi_1.str)("{"), (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSWhere), (0, combi_1.opt)(";"));
53821
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.opt)("TRANSIENT"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), _1.CDSName, (0, combi_1.opt)(_1.CDSProviderContract), (0, combi_1.opt)(_1.CDSWithParameters), "AS PROJECTION ON", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, redefineAssoc)), (0, combi_1.str)("{"), (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSWhere), (0, combi_1.opt)(";"));
53733
53822
  }
53734
53823
  }
53735
53824
  exports.CDSDefineProjection = CDSDefineProjection;
@@ -53758,7 +53847,7 @@ class CDSDefineTableEntity extends combi_1.Expression {
53758
53847
  const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
53759
53848
  const elements = (0, combi_1.seq)((0, combi_1.str)("{"), (0, combi_1.altPrio)("*", elementList), (0, combi_1.str)("}"));
53760
53849
  const selectBody = (0, combi_1.seq)("AS", "SELECT", "FROM", _1.CDSSource, (0, combi_1.star)(_1.CDSJoin), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSComposition, _1.CDSAssociation)), (0, combi_1.opt)(elements), (0, combi_1.optPrio)(_1.CDSWhere));
53761
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), "TABLE", "ENTITY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.str)("{"), inlineBody, (0, combi_1.str)("}")), selectBody), (0, combi_1.opt)(";"));
53850
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), "TABLE", "ENTITY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.str)("{"), inlineBody, (0, combi_1.str)("}")), selectBody), (0, combi_1.opt)(";"));
53762
53851
  }
53763
53852
  }
53764
53853
  exports.CDSDefineTableEntity = CDSDefineTableEntity;
@@ -54700,7 +54789,7 @@ class Config {
54700
54789
  }
54701
54790
  return (0, version_1.versionToABAPRelease)(v);
54702
54791
  }
54703
- getOpenABAP() {
54792
+ isOpenABAP() {
54704
54793
  return this.getRelease() === version_1.Release["open-abap"];
54705
54794
  }
54706
54795
  getVersion() {
@@ -68847,7 +68936,7 @@ class Registry {
68847
68936
  }
68848
68937
  static abaplintVersion() {
68849
68938
  // magic, see build script "version.js"
68850
- return "2.119.67";
68939
+ return "2.120.1";
68851
68940
  }
68852
68941
  getDDICReferences() {
68853
68942
  return this.ddicReferences;
@@ -73550,6 +73639,270 @@ exports.ClassicExceptionsOverlap = ClassicExceptionsOverlap;
73550
73639
 
73551
73640
  /***/ },
73552
73641
 
73642
+ /***/ "../core/build/src/rules/clear_exporting_parameters.js"
73643
+ /*!*************************************************************!*\
73644
+ !*** ../core/build/src/rules/clear_exporting_parameters.js ***!
73645
+ \*************************************************************/
73646
+ (__unused_webpack_module, exports, __webpack_require__) {
73647
+
73648
+ "use strict";
73649
+
73650
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
73651
+ if (k2 === undefined) k2 = k;
73652
+ var desc = Object.getOwnPropertyDescriptor(m, k);
73653
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
73654
+ desc = { enumerable: true, get: function() { return m[k]; } };
73655
+ }
73656
+ Object.defineProperty(o, k2, desc);
73657
+ }) : (function(o, m, k, k2) {
73658
+ if (k2 === undefined) k2 = k;
73659
+ o[k2] = m[k];
73660
+ }));
73661
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
73662
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
73663
+ }) : function(o, v) {
73664
+ o["default"] = v;
73665
+ });
73666
+ var __importStar = (this && this.__importStar) || (function () {
73667
+ var ownKeys = function(o) {
73668
+ ownKeys = Object.getOwnPropertyNames || function (o) {
73669
+ var ar = [];
73670
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
73671
+ return ar;
73672
+ };
73673
+ return ownKeys(o);
73674
+ };
73675
+ return function (mod) {
73676
+ if (mod && mod.__esModule) return mod;
73677
+ var result = {};
73678
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
73679
+ __setModuleDefault(result, mod);
73680
+ return result;
73681
+ };
73682
+ })();
73683
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
73684
+ exports.ClearExportingParameters = exports.ClearExportingParametersConf = void 0;
73685
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
73686
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
73687
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
73688
+ const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
73689
+ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
73690
+ const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
73691
+ const objects_1 = __webpack_require__(/*! ../objects */ "../core/build/src/objects/index.js");
73692
+ const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
73693
+ const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
73694
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
73695
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
73696
+ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
73697
+ class ClearExportingParametersConf extends _basic_rule_config_1.BasicRuleConfig {
73698
+ constructor() {
73699
+ super(...arguments);
73700
+ /** Skip specific parameter names, case insensitive
73701
+ * @uniqueItems true
73702
+ */
73703
+ this.skipNames = [];
73704
+ }
73705
+ }
73706
+ exports.ClearExportingParametersConf = ClearExportingParametersConf;
73707
+ class ClearExportingParameters {
73708
+ constructor() {
73709
+ this.conf = new ClearExportingParametersConf();
73710
+ }
73711
+ getMetadata() {
73712
+ return {
73713
+ key: "clear_exporting_parameters",
73714
+ title: "Clear EXPORTING parameters",
73715
+ shortDescription: `Checks that EXPORTING parameters passed by reference are cleared or assigned before they are read`,
73716
+ extendedInformation: `An EXPORTING parameter passed by reference behaves like a CHANGING parameter: it is not
73717
+ initialized when the method is called, so it can still contain a value supplied by the caller. Clear or overwrite it
73718
+ before reading it, so a leftover value is not accidentally used.
73719
+
73720
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#clear-or-overwrite-exporting-reference-parameters
73721
+
73722
+ https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenref_transf_output_param_guidl.htm
73723
+
73724
+ Note: EXPORTING parameters passed by VALUE are always initialized and are therefore not reported.
73725
+ Reading and writing the parameter in the same statement (e.g. "ev_result = ev_result + 1") is reported,
73726
+ as the source is evaluated before the parameter is assigned.
73727
+ Objects containing parser or syntax errors are not reported.
73728
+
73729
+ Only class and interface method implementations are checked, function module parameters are currently not supported.`,
73730
+ tags: [_irule_1.RuleTag.Styleguide],
73731
+ badExample: `CLASS lcl DEFINITION.
73732
+ PUBLIC SECTION.
73733
+ METHODS foo EXPORTING ev_result TYPE i.
73734
+ ENDCLASS.
73735
+ CLASS lcl IMPLEMENTATION.
73736
+ METHOD foo.
73737
+ ev_result = ev_result + 1.
73738
+ ENDMETHOD.
73739
+ ENDCLASS.`,
73740
+ goodExample: `CLASS lcl DEFINITION.
73741
+ PUBLIC SECTION.
73742
+ METHODS foo EXPORTING ev_result TYPE i.
73743
+ ENDCLASS.
73744
+ CLASS lcl IMPLEMENTATION.
73745
+ METHOD foo.
73746
+ CLEAR ev_result.
73747
+ ev_result = ev_result + 1.
73748
+ ENDMETHOD.
73749
+ ENDCLASS.`,
73750
+ };
73751
+ }
73752
+ getConfig() {
73753
+ return this.conf;
73754
+ }
73755
+ setConfig(conf) {
73756
+ this.conf = conf;
73757
+ if (this.conf.skipNames === undefined) {
73758
+ this.conf.skipNames = [];
73759
+ }
73760
+ }
73761
+ initialize(reg) {
73762
+ this.reg = reg;
73763
+ return this;
73764
+ }
73765
+ run(obj) {
73766
+ if (!(obj instanceof _abap_object_1.ABAPObject) || obj instanceof objects_1.Interface) {
73767
+ return [];
73768
+ }
73769
+ for (const file of obj.getABAPFiles()) {
73770
+ for (const statement of file.getStatements()) {
73771
+ if (statement.get() instanceof _statement_1.Unknown) {
73772
+ return []; // contains parser errors
73773
+ }
73774
+ }
73775
+ }
73776
+ const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
73777
+ if (syntax.issues.length > 0) {
73778
+ return []; // contains syntax errors
73779
+ }
73780
+ const issues = [];
73781
+ this.traverse(syntax.spaghetti.getTop(), obj, issues);
73782
+ return issues;
73783
+ }
73784
+ traverse(node, obj, issues) {
73785
+ if (node.getIdentifier().stype === _scope_type_1.ScopeType.Method) {
73786
+ this.checkMethod(node, obj, issues);
73787
+ }
73788
+ for (const child of node.getChildren()) {
73789
+ this.traverse(child, obj, issues);
73790
+ }
73791
+ }
73792
+ checkMethod(node, obj, issues) {
73793
+ const parameters = this.findExportingByReference(node, obj);
73794
+ if (parameters.length === 0) {
73795
+ return;
73796
+ }
73797
+ const references = this.collectReferences(node);
73798
+ for (const parameter of parameters) {
73799
+ const issue = this.checkParameter(parameter, references, obj);
73800
+ if (issue !== undefined) {
73801
+ issues.push(issue);
73802
+ }
73803
+ }
73804
+ }
73805
+ findExportingByReference(node, obj) {
73806
+ var _a;
73807
+ const ret = [];
73808
+ const vars = node.getData().vars;
73809
+ for (const name in vars) {
73810
+ const parameter = vars[name];
73811
+ const meta = parameter.getMeta();
73812
+ if (meta.includes("exporting" /* IdentifierMeta.MethodExporting */) === false
73813
+ || meta.includes("pass_by_value" /* IdentifierMeta.PassByValue */) === true) {
73814
+ continue;
73815
+ }
73816
+ else if ((_a = this.conf.skipNames) === null || _a === void 0 ? void 0 : _a.some(s => s.toUpperCase() === name.toUpperCase())) {
73817
+ continue;
73818
+ }
73819
+ const type = parameter.getType();
73820
+ if (type instanceof basic_1.VoidType || type instanceof basic_1.UnknownType) {
73821
+ continue; // e.g. RAP magic parameters, or unresolved types
73822
+ }
73823
+ else if (this.isPassByValue(parameter, obj) === true) {
73824
+ continue; // VALUE(..) parameters are always initialized
73825
+ }
73826
+ ret.push(parameter);
73827
+ }
73828
+ return ret;
73829
+ }
73830
+ isPassByValue(parameter, obj) {
73831
+ var _a;
73832
+ // the PassByValue meta is not set for EXPORTING parameters, so determine it from the definition
73833
+ const file = obj.getABAPFileByName(parameter.getFilename());
73834
+ if (file === undefined) {
73835
+ return false;
73836
+ }
73837
+ const statement = edit_helper_1.EditHelper.findStatement(parameter.getToken(), file);
73838
+ if (statement === undefined) {
73839
+ return false;
73840
+ }
73841
+ for (const param of statement.findAllExpressions(Expressions.MethodParam)) {
73842
+ const nameToken = (_a = param.findFirstExpression(Expressions.MethodParamName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
73843
+ if (nameToken !== undefined && nameToken.getStart().equals(parameter.getStart())) {
73844
+ return param.getFirstToken().getStr().toUpperCase() === "VALUE";
73845
+ }
73846
+ }
73847
+ return false;
73848
+ }
73849
+ collectReferences(node) {
73850
+ // methods do not nest, so all descendant scopes (FOR, LET, ...) belong to this method
73851
+ const ret = [...node.getData().references];
73852
+ for (const child of node.getChildren()) {
73853
+ ret.push(...this.collectReferences(child));
73854
+ }
73855
+ return ret;
73856
+ }
73857
+ checkParameter(parameter, references, obj) {
73858
+ let firstRead = undefined;
73859
+ let earliestWrite = undefined;
73860
+ for (const reference of references) {
73861
+ if (reference.resolved === undefined || parameter.equals(reference.resolved) === false) {
73862
+ continue;
73863
+ }
73864
+ const pos = reference.position.getStart();
73865
+ if (reference.referenceType === _reference_1.ReferenceType.DataReadReference) {
73866
+ if (firstRead === undefined || pos.isBefore(firstRead.position.getStart())) {
73867
+ firstRead = reference;
73868
+ }
73869
+ }
73870
+ else if (reference.referenceType === _reference_1.ReferenceType.DataWriteReference) {
73871
+ if (earliestWrite === undefined || pos.isBefore(earliestWrite)) {
73872
+ earliestWrite = pos;
73873
+ }
73874
+ }
73875
+ }
73876
+ if (firstRead === undefined) {
73877
+ return undefined; // never read, no hazard
73878
+ }
73879
+ // the parameter is safe only if it is written in a statement strictly before the first read
73880
+ const readStatement = this.statementStart(firstRead.position.getStart(), obj);
73881
+ const writeStatement = earliestWrite === undefined ? undefined : this.statementStart(earliestWrite, obj);
73882
+ if (writeStatement !== undefined && readStatement !== undefined && writeStatement.isBefore(readStatement)) {
73883
+ return undefined;
73884
+ }
73885
+ const message = `EXPORTING parameter "${parameter.getName().toLowerCase()}" read before it is cleared or assigned`;
73886
+ return issue_1.Issue.atIdentifier(firstRead.position, message, this.getMetadata().key, this.conf.severity);
73887
+ }
73888
+ statementStart(pos, obj) {
73889
+ for (const file of obj.getABAPFiles()) {
73890
+ for (const statement of file.getStatements()) {
73891
+ const start = statement.getStart();
73892
+ const end = statement.getEnd();
73893
+ if (pos.equals(start) || (pos.isAfter(start) && pos.isBefore(end))) {
73894
+ return start;
73895
+ }
73896
+ }
73897
+ }
73898
+ return undefined;
73899
+ }
73900
+ }
73901
+ exports.ClearExportingParameters = ClearExportingParameters;
73902
+ //# sourceMappingURL=clear_exporting_parameters.js.map
73903
+
73904
+ /***/ },
73905
+
73553
73906
  /***/ "../core/build/src/rules/cloud_types.js"
73554
73907
  /*!**********************************************!*\
73555
73908
  !*** ../core/build/src/rules/cloud_types.js ***!
@@ -75465,7 +75818,7 @@ Make sure to test the downported code, it might not always be completely correct
75465
75818
  initialize(reg) {
75466
75819
  this.lowReg = reg;
75467
75820
  const config = this.lowReg.getConfig();
75468
- if (config.getRelease() === version_1.Release.v702 || config.getOpenABAP()) {
75821
+ if (config.getRelease() === version_1.Release.v702 || config.isOpenABAP()) {
75469
75822
  this.initHighReg();
75470
75823
  }
75471
75824
  return this;
@@ -75498,7 +75851,7 @@ Make sure to test the downported code, it might not always be completely correct
75498
75851
  const ret = [];
75499
75852
  this.counter = 1;
75500
75853
  const config = this.lowReg.getConfig();
75501
- if (config.getRelease() !== version_1.Release.v702 && !config.getOpenABAP()) {
75854
+ if (config.getRelease() !== version_1.Release.v702 && !config.isOpenABAP()) {
75502
75855
  return ret;
75503
75856
  }
75504
75857
  else if (!(lowObj instanceof _abap_object_1.ABAPObject)) {
@@ -76370,7 +76723,7 @@ ${indentation}`);
76370
76723
  outlineCatchSimple(node, lowFile) {
76371
76724
  // outlines "CATCH cx_bcs INTO DATA(lx_bcs_excep).", note that this does not need to look at types
76372
76725
  var _a, _b;
76373
- if (this.lowReg.getConfig().getOpenABAP()) {
76726
+ if (this.lowReg.getConfig().isOpenABAP()) {
76374
76727
  return undefined;
76375
76728
  }
76376
76729
  if (!(node.get() instanceof Statements.Catch)) {
@@ -76419,7 +76772,7 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
76419
76772
  if (!(node.get() instanceof Statements.Move)) {
76420
76773
  return undefined;
76421
76774
  }
76422
- if (this.lowReg.getConfig().getOpenABAP()) {
76775
+ if (this.lowReg.getConfig().isOpenABAP()) {
76423
76776
  return undefined;
76424
76777
  }
76425
76778
  const target = node.findFirstExpression(Expressions.Target);
@@ -76475,7 +76828,7 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
76475
76828
  return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
76476
76829
  }
76477
76830
  partiallyImplemented(node, lowFile) {
76478
- if (this.lowReg.getConfig().getOpenABAP()) {
76831
+ if (this.lowReg.getConfig().isOpenABAP()) {
76479
76832
  return undefined;
76480
76833
  }
76481
76834
  if (node.get() instanceof Statements.InterfaceDef) {
@@ -77151,7 +77504,7 @@ ${indentation} output = ${uniqueName}.\n`;
77151
77504
  if (!(node.get() instanceof Statements.Loop)) {
77152
77505
  return undefined;
77153
77506
  }
77154
- if (this.lowReg.getConfig().getOpenABAP()) {
77507
+ if (this.lowReg.getConfig().isOpenABAP()) {
77155
77508
  return undefined;
77156
77509
  }
77157
77510
  const source = (_a = node.findDirectExpression(Expressions.LoopSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.SimpleSource2);
@@ -77827,7 +78180,7 @@ ${indentation} output = ${uniqueName}.\n`;
77827
78180
  outlineData(node, lowFile, highSyntax) {
77828
78181
  // hmm, no guard here, as DATA(SDF) is valid in 702
77829
78182
  var _a, _b;
77830
- if (this.lowReg.getConfig().getOpenABAP()) {
78183
+ if (this.lowReg.getConfig().isOpenABAP()) {
77831
78184
  return undefined;
77832
78185
  }
77833
78186
  for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {
@@ -78046,7 +78399,7 @@ ${indentation} output = ${uniqueName}.\n`;
78046
78399
  return false;
78047
78400
  }
78048
78401
  replaceXsdBool(node, lowFile, highSyntax) {
78049
- if (this.lowReg.getConfig().getOpenABAP()) {
78402
+ if (this.lowReg.getConfig().isOpenABAP()) {
78050
78403
  return undefined;
78051
78404
  }
78052
78405
  const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
@@ -78175,7 +78528,7 @@ ${indentation} output = ${uniqueName}.\n`;
78175
78528
  }
78176
78529
  replaceLineFunctions(node, lowFile, highSyntax, highFile) {
78177
78530
  var _a, _b;
78178
- if (this.lowReg.getConfig().getOpenABAP()) {
78531
+ if (this.lowReg.getConfig().isOpenABAP()) {
78179
78532
  return undefined;
78180
78533
  }
78181
78534
  const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
@@ -82349,6 +82702,7 @@ __exportStar(__webpack_require__(/*! ./check_subrc */ "../core/build/src/rules/c
82349
82702
  __exportStar(__webpack_require__(/*! ./check_syntax */ "../core/build/src/rules/check_syntax.js"), exports);
82350
82703
  __exportStar(__webpack_require__(/*! ./check_text_elements */ "../core/build/src/rules/check_text_elements.js"), exports);
82351
82704
  __exportStar(__webpack_require__(/*! ./check_transformation_exists */ "../core/build/src/rules/check_transformation_exists.js"), exports);
82705
+ __exportStar(__webpack_require__(/*! ./clear_exporting_parameters */ "../core/build/src/rules/clear_exporting_parameters.js"), exports);
82352
82706
  __exportStar(__webpack_require__(/*! ./class_attribute_names */ "../core/build/src/rules/class_attribute_names.js"), exports);
82353
82707
  __exportStar(__webpack_require__(/*! ./classic_exceptions_overlap */ "../core/build/src/rules/classic_exceptions_overlap.js"), exports);
82354
82708
  __exportStar(__webpack_require__(/*! ./cloud_types */ "../core/build/src/rules/cloud_types.js"), exports);
@@ -82454,6 +82808,7 @@ __exportStar(__webpack_require__(/*! ./preferred_compare_operator */ "../core/bu
82454
82808
  __exportStar(__webpack_require__(/*! ./prefix_is_current_class */ "../core/build/src/rules/prefix_is_current_class.js"), exports);
82455
82809
  __exportStar(__webpack_require__(/*! ./reduce_procedural_code */ "../core/build/src/rules/reduce_procedural_code.js"), exports);
82456
82810
  __exportStar(__webpack_require__(/*! ./reduce_string_templates */ "../core/build/src/rules/reduce_string_templates.js"), exports);
82811
+ __exportStar(__webpack_require__(/*! ./redundant_conversion */ "../core/build/src/rules/redundant_conversion.js"), exports);
82457
82812
  __exportStar(__webpack_require__(/*! ./release_idoc */ "../core/build/src/rules/release_idoc.js"), exports);
82458
82813
  __exportStar(__webpack_require__(/*! ./remove_descriptions */ "../core/build/src/rules/remove_descriptions.js"), exports);
82459
82814
  __exportStar(__webpack_require__(/*! ./rfc_error_handling */ "../core/build/src/rules/rfc_error_handling.js"), exports);
@@ -82659,7 +83014,7 @@ class InlineDataOldVersions extends _abap_rule_1.ABAPRule {
82659
83014
  runParsed(file) {
82660
83015
  const issues = [];
82661
83016
  if ((0, version_1.releaseAtLeast)(this.reg.getConfig().getRelease(), version_1.Release.v740sp02)
82662
- || this.reg.getConfig().getOpenABAP()
83017
+ || this.reg.getConfig().isOpenABAP()
82663
83018
  || this.reg.getConfig().getLanguageVersion() === version_1.LanguageVersion.Cloud) {
82664
83019
  return [];
82665
83020
  }
@@ -86781,7 +87136,7 @@ Not considered optional branches:
86781
87136
  const release = this.reg.getConfig().getRelease();
86782
87137
  if (release === version_1.Release.v700
86783
87138
  || release === version_1.Release.v702
86784
- || this.reg.getConfig().getOpenABAP()) {
87139
+ || this.reg.getConfig().isOpenABAP()) {
86785
87140
  return [];
86786
87141
  }
86787
87142
  const struc = file.getStructure();
@@ -90932,6 +91287,269 @@ exports.ReduceStringTemplates = ReduceStringTemplates;
90932
91287
 
90933
91288
  /***/ },
90934
91289
 
91290
+ /***/ "../core/build/src/rules/redundant_conversion.js"
91291
+ /*!*******************************************************!*\
91292
+ !*** ../core/build/src/rules/redundant_conversion.js ***!
91293
+ \*******************************************************/
91294
+ (__unused_webpack_module, exports, __webpack_require__) {
91295
+
91296
+ "use strict";
91297
+
91298
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
91299
+ if (k2 === undefined) k2 = k;
91300
+ var desc = Object.getOwnPropertyDescriptor(m, k);
91301
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
91302
+ desc = { enumerable: true, get: function() { return m[k]; } };
91303
+ }
91304
+ Object.defineProperty(o, k2, desc);
91305
+ }) : (function(o, m, k, k2) {
91306
+ if (k2 === undefined) k2 = k;
91307
+ o[k2] = m[k];
91308
+ }));
91309
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
91310
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
91311
+ }) : function(o, v) {
91312
+ o["default"] = v;
91313
+ });
91314
+ var __importStar = (this && this.__importStar) || (function () {
91315
+ var ownKeys = function(o) {
91316
+ ownKeys = Object.getOwnPropertyNames || function (o) {
91317
+ var ar = [];
91318
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
91319
+ return ar;
91320
+ };
91321
+ return ownKeys(o);
91322
+ };
91323
+ return function (mod) {
91324
+ if (mod && mod.__esModule) return mod;
91325
+ var result = {};
91326
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
91327
+ __setModuleDefault(result, mod);
91328
+ return result;
91329
+ };
91330
+ })();
91331
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
91332
+ exports.RedundantConversion = exports.RedundantConversionConf = void 0;
91333
+ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
91334
+ const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
91335
+ const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
91336
+ const constant_1 = __webpack_require__(/*! ../abap/5_syntax/expressions/constant */ "../core/build/src/abap/5_syntax/expressions/constant.js");
91337
+ const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
91338
+ const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
91339
+ const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
91340
+ const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
91341
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
91342
+ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
91343
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
91344
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
91345
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
91346
+ const version_1 = __webpack_require__(/*! ../version */ "../core/build/src/version.js");
91347
+ class RedundantConversionConf extends _basic_rule_config_1.BasicRuleConfig {
91348
+ }
91349
+ exports.RedundantConversionConf = RedundantConversionConf;
91350
+ class RedundantConversion {
91351
+ constructor() {
91352
+ this.conf = new RedundantConversionConf();
91353
+ }
91354
+ getMetadata() {
91355
+ return {
91356
+ key: "redundant_conversion",
91357
+ title: "Redundant Conversion",
91358
+ shortDescription: `Find redundant CONV expressions`,
91359
+ extendedInformation: `Reports CONV expressions whose operand already has the conversion's target type.`,
91360
+ tags: [_irule_1.RuleTag.Quickfix],
91361
+ badExample: `DATA text TYPE string.
91362
+ text = CONV string( text ).`,
91363
+ goodExample: `DATA text TYPE string.
91364
+ text = text.`,
91365
+ };
91366
+ }
91367
+ getConfig() {
91368
+ return this.conf;
91369
+ }
91370
+ setConfig(conf) {
91371
+ this.conf = conf;
91372
+ }
91373
+ initialize(reg) {
91374
+ this.reg = reg;
91375
+ return this;
91376
+ }
91377
+ run(obj) {
91378
+ var _a, _b;
91379
+ if (!(0, version_1.releaseAtLeast)(this.reg.getConfig().getRelease(), version_1.Release.v740sp02)
91380
+ && !this.reg.getConfig().isOpenABAP()) {
91381
+ return [];
91382
+ }
91383
+ if (!(obj instanceof _abap_object_1.ABAPObject)) {
91384
+ return [];
91385
+ }
91386
+ const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
91387
+ if (syntax.issues.length > 0) {
91388
+ return [];
91389
+ }
91390
+ const issues = [];
91391
+ for (const file of obj.getABAPFiles()) {
91392
+ const structure = file.getStructure();
91393
+ if (structure === undefined) {
91394
+ continue;
91395
+ }
91396
+ for (const source of structure.findAllExpressions(Expressions.Source)) {
91397
+ if (source.getFirstToken().getStr().toUpperCase() !== "CONV") {
91398
+ continue;
91399
+ }
91400
+ const typeExpression = source.findDirectExpression(Expressions.TypeNameOrInfer);
91401
+ const bodySource = (_a = source.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source);
91402
+ if (typeExpression === undefined
91403
+ || bodySource === undefined) {
91404
+ continue;
91405
+ }
91406
+ const scope = syntax.spaghetti.lookupPosition(source.getFirstToken().getStart(), file.getFilename());
91407
+ if (scope === undefined) {
91408
+ continue;
91409
+ }
91410
+ const target = (_b = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.InferredType
91411
+ && reference.position.getStart().equals(typeExpression.getFirstToken().getStart()))) === null || _b === void 0 ? void 0 : _b.resolved;
91412
+ const operandType = this.sourceType(bodySource, scope);
91413
+ if (!(target instanceof _typed_identifier_1.TypedIdentifier)) {
91414
+ continue;
91415
+ }
91416
+ const operandHasSameType = operandType !== undefined && this.sameType(target.getType(), operandType);
91417
+ const arithmeticHasSameContext = this.arithmeticUsesSameTargetType(source, bodySource, file, scope, target.getType());
91418
+ if (operandHasSameType === false && arithmeticHasSameContext === false) {
91419
+ continue;
91420
+ }
91421
+ const closingParen = source.getDirectTokens().find(token => token.getStr() === ")" && token.getStart().isAfter(bodySource.getLastToken().getStart()));
91422
+ if (closingParen === undefined) {
91423
+ continue;
91424
+ }
91425
+ const preserveParentheses = bodySource.findDirectExpression(Expressions.ArithOperator) !== undefined
91426
+ || bodySource.findDirectTokenByText("&&") !== undefined;
91427
+ // Apply the later edit first so the original positions remain valid when
91428
+ // both parts of the CONV wrapper are changed on the same line.
91429
+ const fix = edit_helper_1.EditHelper.merge(edit_helper_1.EditHelper.replaceRange(file, bodySource.getLastToken().getEnd(), closingParen.getEnd(), preserveParentheses ? ")" : ""), edit_helper_1.EditHelper.replaceRange(file, source.getFirstToken().getStart(), bodySource.getFirstToken().getStart(), preserveParentheses ? "(" : ""));
91430
+ issues.push(issue_1.Issue.atRange(file, source.getFirstToken().getStart(), closingParen.getEnd(), "Redundant CONV expression", this.getMetadata().key, this.conf.severity, fix));
91431
+ }
91432
+ }
91433
+ return issues;
91434
+ }
91435
+ arithmeticUsesSameTargetType(conversion, bodySource, file, scope, conversionType) {
91436
+ var _a, _b;
91437
+ if (bodySource.findDirectExpression(Expressions.ArithOperator) === undefined) {
91438
+ return false;
91439
+ }
91440
+ const statement = file.getStatements().find(candidate => candidate.includesToken(conversion.getFirstToken()));
91441
+ if (!((statement === null || statement === void 0 ? void 0 : statement.get()) instanceof Statements.Move)) {
91442
+ return false;
91443
+ }
91444
+ const targetToken = (_a = statement.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
91445
+ if (targetToken === undefined) {
91446
+ return false;
91447
+ }
91448
+ const assignmentTarget = (_b = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.DataWriteReference
91449
+ && reference.position.getStart().equals(targetToken.getStart()))) === null || _b === void 0 ? void 0 : _b.resolved;
91450
+ return assignmentTarget instanceof _typed_identifier_1.TypedIdentifier
91451
+ && this.sameType(conversionType, assignmentTarget.getType());
91452
+ }
91453
+ sourceType(source, scope) {
91454
+ let context;
91455
+ for (const child of source.getChildren()) {
91456
+ if (!(child instanceof nodes_1.ExpressionNode)) {
91457
+ continue;
91458
+ }
91459
+ else if (child.get() instanceof Expressions.FieldChain) {
91460
+ context = this.fieldChainType(child, scope);
91461
+ if (context === undefined) {
91462
+ return undefined;
91463
+ }
91464
+ }
91465
+ else if (child.get() instanceof Expressions.Constant) {
91466
+ context = this.infer(context, constant_1.Constant.runSyntax(child));
91467
+ }
91468
+ else if (child.get() instanceof Expressions.Source) {
91469
+ context = this.infer(context, this.sourceType(child, scope));
91470
+ }
91471
+ else if (child.get() instanceof Expressions.ArithOperator) {
91472
+ if (child.concatTokens() === "**") {
91473
+ context = new basic_1.FloatType();
91474
+ }
91475
+ }
91476
+ else {
91477
+ return undefined;
91478
+ }
91479
+ }
91480
+ if (source.findDirectTokenByText("&&")) {
91481
+ return basic_1.StringType.get();
91482
+ }
91483
+ return context;
91484
+ }
91485
+ fieldChainType(fieldChain, scope) {
91486
+ var _a;
91487
+ const operand = (_a = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.DataReadReference
91488
+ && reference.position.getStart().equals(fieldChain.getFirstToken().getStart()))) === null || _a === void 0 ? void 0 : _a.resolved;
91489
+ if (!(operand instanceof _typed_identifier_1.TypedIdentifier)) {
91490
+ return undefined;
91491
+ }
91492
+ let type = operand.getType();
91493
+ for (const child of fieldChain.getChildren()) {
91494
+ if (!(child instanceof nodes_1.ExpressionNode)
91495
+ || child.get() instanceof Expressions.SourceField) {
91496
+ continue;
91497
+ }
91498
+ else if (child.get() instanceof Expressions.ComponentName) {
91499
+ if (type instanceof basic_1.TableType) {
91500
+ type = type.getRowType();
91501
+ }
91502
+ if (!(type instanceof basic_1.StructureType)) {
91503
+ return undefined;
91504
+ }
91505
+ type = type.getComponentByName(child.concatTokens());
91506
+ }
91507
+ else {
91508
+ // Offsets, table expressions, attributes, and dereferences need more
91509
+ // context than the initial data reference provides.
91510
+ return undefined;
91511
+ }
91512
+ }
91513
+ return type;
91514
+ }
91515
+ infer(context, found) {
91516
+ if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
91517
+ return context;
91518
+ }
91519
+ else if (context instanceof basic_1.IntegerType && found instanceof basic_1.HexType) {
91520
+ return context;
91521
+ }
91522
+ else if ((context instanceof basic_1.IntegerType || context instanceof basic_1.FloatType) && (found === null || found === void 0 ? void 0 : found.isGeneric())) {
91523
+ return context;
91524
+ }
91525
+ return found;
91526
+ }
91527
+ sameType(first, second) {
91528
+ var _a, _b;
91529
+ if (first instanceof basic_1.UnknownType
91530
+ || second instanceof basic_1.UnknownType
91531
+ || first instanceof basic_1.VoidType
91532
+ || second instanceof basic_1.VoidType
91533
+ || first.isGeneric()
91534
+ || second.isGeneric()) {
91535
+ return false;
91536
+ }
91537
+ if (first.constructor !== second.constructor) {
91538
+ return false;
91539
+ }
91540
+ if (first instanceof basic_1.StructureType || first instanceof basic_1.TableType) {
91541
+ const firstName = (_a = first.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
91542
+ const secondName = (_b = second.getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toUpperCase();
91543
+ return firstName !== undefined && firstName === secondName;
91544
+ }
91545
+ return first.toABAP() === second.toABAP();
91546
+ }
91547
+ }
91548
+ exports.RedundantConversion = RedundantConversion;
91549
+ //# sourceMappingURL=redundant_conversion.js.map
91550
+
91551
+ /***/ },
91552
+
90935
91553
  /***/ "../core/build/src/rules/release_idoc.js"
90936
91554
  /*!***********************************************!*\
90937
91555
  !*** ../core/build/src/rules/release_idoc.js ***!
@@ -92884,7 +93502,7 @@ class SQLEscapeHostVariables extends _abap_rule_1.ABAPRule {
92884
93502
  }
92885
93503
  if (!(0, version_1.releaseAtLeast)(this.reg.getConfig().getRelease(), version_1.Release.v740sp02)
92886
93504
  && this.reg.getConfig().getLanguageVersion() !== version_1.LanguageVersion.Cloud
92887
- && !this.reg.getConfig().getOpenABAP()) {
93505
+ && !this.reg.getConfig().isOpenABAP()) {
92888
93506
  return [];
92889
93507
  }
92890
93508
  for (const s of file.getStatements()) {
@@ -96922,7 +97540,7 @@ ENDIF.`,
96922
97540
  }
96923
97541
  const release = this.reg.getConfig().getRelease();
96924
97542
  const langVers = this.reg.getConfig().getLanguageVersion();
96925
- if (this.reg.getConfig().getOpenABAP()) {
97543
+ if (this.reg.getConfig().isOpenABAP()) {
96926
97544
  return [];
96927
97545
  }
96928
97546
  else if (!(0, version_1.releaseAtLeast)(release, version_1.Release.v740sp02) && langVers !== version_1.LanguageVersion.Cloud) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.67",
3
+ "version": "2.120.1",
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.119.67",
42
+ "@abaplint/core": "^2.120.1",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",