@abaplint/cli 2.102.11 → 2.102.13

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 +26 -7
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -48557,7 +48557,7 @@ class Registry {
48557
48557
  }
48558
48558
  static abaplintVersion() {
48559
48559
  // magic, see build script "version.sh"
48560
- return "2.102.11";
48560
+ return "2.102.13";
48561
48561
  }
48562
48562
  getDDICReferences() {
48563
48563
  return this.ddicReferences;
@@ -53194,6 +53194,7 @@ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplin
53194
53194
  const _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js");
53195
53195
  const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
53196
53196
  const statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
53197
+ const crypto = __webpack_require__(/*! node:crypto */ "node:crypto");
53197
53198
  // todo: refactor each sub-rule to new classes?
53198
53199
  // todo: add configuration
53199
53200
  class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
@@ -53960,7 +53961,7 @@ ${indentation}`);
53960
53961
  if (tt === undefined) {
53961
53962
  return undefined;
53962
53963
  }
53963
- const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax, "ty_");
53964
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
53964
53965
  const code = `TYPES ${uniqueName} ${tt.concatTokens()}.\n`;
53965
53966
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), code);
53966
53967
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, tt.getFirstToken().getStart(), tt.getLastToken().getEnd(), "TYPE " + uniqueName);
@@ -55705,15 +55706,21 @@ ${indentation} output = ${uniqueName}.\n`;
55705
55706
  }
55706
55707
  return undefined;
55707
55708
  }
55708
- uniqueName(position, filename, highSyntax, prefix = "") {
55709
+ uniqueName(position, filename, highSyntax) {
55709
55710
  const spag = highSyntax.spaghetti.lookupPosition(position, filename);
55710
55711
  if (spag === undefined) {
55711
- const name = prefix + "temprr" + this.counter;
55712
+ const name = "temprr" + this.counter;
55712
55713
  this.counter++;
55713
55714
  return name;
55714
55715
  }
55716
+ let postfix = "";
55717
+ if (spag.getIdentifier().stype === _scope_type_1.ScopeType.ClassDefinition) {
55718
+ // try making sure this name is not used in subclasses
55719
+ const hash = crypto.createHash("sha1").update(spag.getIdentifier().sname).digest("hex");
55720
+ postfix = "_" + hash.substring(0, 10);
55721
+ }
55715
55722
  while (true) {
55716
- const name = prefix + "temp" + this.counter;
55723
+ const name = "temp" + this.counter + postfix;
55717
55724
  const exists = this.existsRecursive(spag, name);
55718
55725
  this.counter++;
55719
55726
  if (exists === false) {
@@ -55721,13 +55728,14 @@ ${indentation} output = ${uniqueName}.\n`;
55721
55728
  }
55722
55729
  }
55723
55730
  }
55731
+ // todo, optimize, the findVariable() and findType() does a lot of redundant checks
55724
55732
  existsRecursive(spag, name) {
55725
- const existsDirect = spag.findVariable(name);
55733
+ const existsDirect = spag.findVariable(name) || spag.findType(name);
55726
55734
  if (existsDirect) {
55727
55735
  return true;
55728
55736
  }
55729
55737
  for (const child of spag.getChildren()) {
55730
- if (child.findVariable(name) || this.existsRecursive(child, name)) {
55738
+ if (child.findVariable(name) || child.findType(name) || this.existsRecursive(child, name)) {
55731
55739
  return true;
55732
55740
  }
55733
55741
  }
@@ -80948,6 +80956,17 @@ module.exports = require("fs");
80948
80956
 
80949
80957
  /***/ }),
80950
80958
 
80959
+ /***/ "node:crypto":
80960
+ /*!******************************!*\
80961
+ !*** external "node:crypto" ***!
80962
+ \******************************/
80963
+ /***/ ((module) => {
80964
+
80965
+ "use strict";
80966
+ module.exports = require("node:crypto");
80967
+
80968
+ /***/ }),
80969
+
80951
80970
  /***/ "node:os":
80952
80971
  /*!**************************!*\
80953
80972
  !*** external "node:os" ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.11",
3
+ "version": "2.102.13",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.11",
41
+ "@abaplint/core": "^2.102.13",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",