@abaplint/transpiler-cli 2.7.29 → 2.7.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/bundle.js +60 -15
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -20773,7 +20773,10 @@ class TypeUtils {
20773
20773
  }
20774
20774
  }
20775
20775
  else if (source instanceof basic_1.XStringType) {
20776
- if (target instanceof basic_1.CLikeType) {
20776
+ if (target instanceof basic_1.CLikeType
20777
+ || target instanceof basic_1.IntegerType
20778
+ || target instanceof basic_1.ObjectReferenceType
20779
+ || target instanceof basic_1.HexType) {
20777
20780
  return false;
20778
20781
  }
20779
20782
  }
@@ -26146,22 +26149,22 @@ const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modu
26146
26149
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
26147
26150
  class Assign {
26148
26151
  runSyntax(node, scope, filename) {
26149
- var _a, _b;
26150
- const sources = node.findAllExpressions(Expressions.Source);
26151
- const firstSource = sources[0];
26152
- let sourceType = new source_1.Source().runSyntax(firstSource, scope, filename);
26153
- if (sourceType === undefined || ((_a = node.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Dynamic))) {
26152
+ var _a, _b, _c;
26153
+ const sources = ((_a = node.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.Source)) || [];
26154
+ const theSource = sources[sources.length - 1];
26155
+ let sourceType = new source_1.Source().runSyntax(theSource, scope, filename);
26156
+ if (sourceType === undefined || ((_b = node.findDirectExpression(Expressions.AssignSource)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Dynamic))) {
26154
26157
  sourceType = new basic_1.VoidType("DynamicAssign");
26155
26158
  }
26156
- for (const d of ((_b = node.findDirectExpression(Expressions.AssignSource)) === null || _b === void 0 ? void 0 : _b.findAllExpressions(Expressions.Dynamic)) || []) {
26159
+ for (const d of ((_c = node.findDirectExpression(Expressions.AssignSource)) === null || _c === void 0 ? void 0 : _c.findAllExpressions(Expressions.Dynamic)) || []) {
26157
26160
  new dynamic_1.Dynamic().runSyntax(d, scope, filename);
26158
26161
  }
26159
26162
  const target = node.findDirectExpression(Expressions.FSTarget);
26160
26163
  if (target) {
26161
26164
  new fstarget_1.FSTarget().runSyntax(target, scope, filename, sourceType);
26162
26165
  }
26163
- for (const s of sources) {
26164
- if (s === firstSource) {
26166
+ for (const s of node.findAllExpressions(Expressions.Source)) {
26167
+ if (s === theSource) {
26165
26168
  continue;
26166
26169
  }
26167
26170
  new source_1.Source().runSyntax(s, scope, filename);
@@ -47515,7 +47518,7 @@ class Registry {
47515
47518
  }
47516
47519
  static abaplintVersion() {
47517
47520
  // magic, see build script "version.sh"
47518
- return "2.101.29";
47521
+ return "2.101.34";
47519
47522
  }
47520
47523
  getDDICReferences() {
47521
47524
  return this.ddicReferences;
@@ -52515,6 +52518,10 @@ Make sure to test the downported code, it might not always be completely correct
52515
52518
  if (found) {
52516
52519
  return found;
52517
52520
  }
52521
+ found = this.downportSelectExistence(low, high, lowFile, highSyntax);
52522
+ if (found) {
52523
+ return found;
52524
+ }
52518
52525
  found = this.downportSQLExtras(low, high, lowFile, highSyntax);
52519
52526
  if (found) {
52520
52527
  return found;
@@ -52644,6 +52651,7 @@ Make sure to test the downported code, it might not always be completely correct
52644
52651
  return undefined;
52645
52652
  }
52646
52653
  //////////////////////////////////////////
52654
+ /** removes @'s */
52647
52655
  downportSQLExtras(low, high, lowFile, highSyntax) {
52648
52656
  if (!(low.get() instanceof _statement_1.Unknown)) {
52649
52657
  return undefined;
@@ -52716,6 +52724,35 @@ Make sure to test the downported code, it might not always be completely correct
52716
52724
  }
52717
52725
  return undefined;
52718
52726
  }
52727
+ downportSelectExistence(low, high, lowFile, highSyntax) {
52728
+ var _a, _b, _c, _d;
52729
+ if (!(low.get() instanceof _statement_1.Unknown)) {
52730
+ return undefined;
52731
+ }
52732
+ else if (!(high.get() instanceof Statements.Select)) {
52733
+ return undefined;
52734
+ }
52735
+ const fieldList = high.findFirstExpression(Expressions.SQLFieldList);
52736
+ if ((fieldList === null || fieldList === void 0 ? void 0 : fieldList.concatTokens().toUpperCase()) !== "@ABAP_TRUE") {
52737
+ return undefined;
52738
+ }
52739
+ const fieldName = (_b = (_a = high.findFirstExpression(Expressions.SQLCond)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
52740
+ if (fieldName === undefined) {
52741
+ return undefined;
52742
+ }
52743
+ const into = high.findFirstExpression(Expressions.SQLIntoStructure);
52744
+ if (into === undefined) {
52745
+ return undefined;
52746
+ }
52747
+ const intoName = (_d = (_c = into.findFirstExpression(Expressions.SQLTarget)) === null || _c === void 0 ? void 0 : _c.findFirstExpression(Expressions.Target)) === null || _d === void 0 ? void 0 : _d.concatTokens();
52748
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
52749
+ const fix1 = edit_helper_1.EditHelper.replaceRange(lowFile, fieldList.getFirstToken().getStart(), fieldList.getLastToken().getEnd(), fieldName);
52750
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, into === null || into === void 0 ? void 0 : into.getFirstToken().getStart(), into === null || into === void 0 ? void 0 : into.getLastToken().getEnd(), `INTO @DATA(${uniqueName})`);
52751
+ let fix = edit_helper_1.EditHelper.merge(fix2, fix1);
52752
+ const fix3 = edit_helper_1.EditHelper.insertAt(lowFile, high.getLastToken().getEnd(), `\nCLEAR ${intoName}.\nIF sy-subrc = 0.\n ${intoName} = abap_true.\nENDIF.`);
52753
+ fix = edit_helper_1.EditHelper.merge(fix, fix3);
52754
+ return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, refactor existence check", this.getMetadata().key, this.conf.severity, fix);
52755
+ }
52719
52756
  downportSelectInline(low, high, lowFile, highSyntax) {
52720
52757
  if (!(low.get() instanceof _statement_1.Unknown)) {
52721
52758
  return undefined;
@@ -56155,9 +56192,11 @@ class FunctionModuleRecommendationsConf extends _basic_rule_config_1.BasicRuleCo
56155
56192
  constructor() {
56156
56193
  super(...arguments);
56157
56194
  /** Tuple of Function Module Name to be replaced, the recommended alternative and
56158
- * the version from which the recommendation is valid.*/
56195
+ * the version from which the recommendation is valid.
56196
+ * @uniqueItems true
56197
+ */
56159
56198
  this.recommendations = [
56160
- { name: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC" },
56199
+ { name: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC or CL_ABAP_MESSAGE_DIGEST" },
56161
56200
  { name: "ECATT_CONV_XSTRING_TO_STRING", replace: "use CL_BINARY_CONVERT" },
56162
56201
  { name: "F4_FILENAME", replace: "use CL_GUI_FRONTEND_SERVICES" },
56163
56202
  { name: "FUNCTION_EXISTS", replace: "surround with try-catch CX_SY_DYN_CALL_ILLEGAL_METHOD instead" },
@@ -56166,10 +56205,11 @@ class FunctionModuleRecommendationsConf extends _basic_rule_config_1.BasicRuleCo
56166
56205
  { name: "GUID_CREATE", replace: "use CL_SYSTEM_UUID" },
56167
56206
  { name: "IGN_TIMESTAMP_DIFFERENCE", replace: "use CL_ABAP_TSTMP" },
56168
56207
  { name: "IGN_TIMESTAMP_PLUSMINUS", replace: "use CL_ABAP_TSTMP" },
56208
+ { name: "ISM_SD_GET_PRICING_CONDITIONS", replace: "use CL_PRC_RESULT_FACTORY as per note 2220005" },
56169
56209
  { name: "JOB_CREATE", replace: "use CL_BP_ABAP_JOB" },
56170
56210
  { name: "JOB_SUBMIT", replace: "use CL_BP_ABAP_JOB" },
56171
- { name: "POPUP_TO_DECIDE", replace: "use POPUP_TO_CONFIRM" },
56172
56211
  { name: "POPUP_TO_CONFIRM_STEP", replace: "use POPUP_TO_CONFIRM" },
56212
+ { name: "POPUP_TO_DECIDE", replace: "use POPUP_TO_CONFIRM" },
56173
56213
  { name: "POPUP_TO_GET_VALUE", replace: "use POPUP_GET_VALUES" },
56174
56214
  { name: "REUSE_ALV_GRID_DISPLAY", replace: "use CL_SALV_TABLE=>FACTORY or CL_GUI_ALV_GRID" },
56175
56215
  { name: "ROUND", replace: "use built in function: round()" },
@@ -63923,7 +63963,9 @@ class SelectSingleFullKey {
63923
63963
  key: "select_single_full_key",
63924
63964
  title: "Detect SELECT SINGLE which are possibily not unique",
63925
63965
  shortDescription: `Detect SELECT SINGLE which are possibily not unique`,
63926
- extendedInformation: `Table definitions must be known, ie. inside the errorNamespace`,
63966
+ extendedInformation: `Table definitions must be known, ie. inside the errorNamespace
63967
+
63968
+ If the statement contains a JOIN it is not checked`,
63927
63969
  pseudoComment: "EC CI_NOORDER",
63928
63970
  tags: [],
63929
63971
  };
@@ -63964,6 +64006,9 @@ class SelectSingleFullKey {
63964
64006
  if (!(s.get() instanceof __1.Statements.Select)) {
63965
64007
  continue;
63966
64008
  }
64009
+ else if (s.findFirstExpression(__1.Expressions.SQLJoin)) {
64010
+ continue;
64011
+ }
63967
64012
  else if (s.findTokenSequencePosition("SELECT", "SINGLE") === undefined) {
63968
64013
  continue;
63969
64014
  }
@@ -80235,7 +80280,7 @@ class Traversal {
80235
80280
  if (s === undefined) {
80236
80281
  continue;
80237
80282
  }
80238
- handle(s, name + ".get()." + v);
80283
+ handle(s, name + ".get()." + v.toLowerCase());
80239
80284
  }
80240
80285
  }
80241
80286
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.29",
3
+ "version": "2.7.31",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,12 +26,12 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.7.29",
29
+ "@abaplint/transpiler": "^2.7.31",
30
30
  "@types/glob": "^7.2.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.5",
33
- "@types/node": "^20.3.3",
34
- "@abaplint/core": "^2.101.29",
33
+ "@types/node": "^20.4.1",
34
+ "@abaplint/core": "^2.101.34",
35
35
  "progress": "^2.0.3",
36
36
  "webpack": "^5.88.1",
37
37
  "webpack-cli": "^5.1.4",