@abaplint/cli 2.118.8 → 2.118.10

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 +93 -4
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -31834,7 +31834,7 @@ class CreateObject {
31834
31834
  this.validateParameters(cdef, node, input);
31835
31835
  }
31836
31836
  static checkInstantiationAllowed(cdef, input) {
31837
- var _a, _b;
31837
+ var _a, _b, _c, _d;
31838
31838
  const createVis = cdef.getCreateVisibility();
31839
31839
  if (createVis === visibility_1.Visibility.Public) {
31840
31840
  return undefined;
@@ -31851,14 +31851,23 @@ class CreateObject {
31851
31851
  input.scope.isLocalFriend(cdef.getName(), enclosingClass)) {
31852
31852
  return undefined;
31853
31853
  }
31854
+ // subclasses of friends also have friendship
31855
+ let enclosingSup = (_a = input.scope.findClassDefinition(enclosingClass)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
31856
+ while (enclosingSup !== undefined) {
31857
+ if (cdef.getFriends().some(f => f.toUpperCase() === enclosingSup.toUpperCase()) ||
31858
+ input.scope.isLocalFriend(cdef.getName(), enclosingSup)) {
31859
+ return undefined;
31860
+ }
31861
+ enclosingSup = (_b = input.scope.findClassDefinition(enclosingSup)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
31862
+ }
31854
31863
  if (createVis === visibility_1.Visibility.Protected) {
31855
31864
  // subclasses are also allowed
31856
- let sup = (_a = input.scope.findClassDefinition(enclosingClass)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
31865
+ let sup = (_c = input.scope.findClassDefinition(enclosingClass)) === null || _c === void 0 ? void 0 : _c.getSuperClass();
31857
31866
  while (sup !== undefined) {
31858
31867
  if (sup.toUpperCase() === cdef.getName().toUpperCase()) {
31859
31868
  return undefined;
31860
31869
  }
31861
- sup = (_b = input.scope.findClassDefinition(sup)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
31870
+ sup = (_d = input.scope.findClassDefinition(sup)) === null || _d === void 0 ? void 0 : _d.getSuperClass();
31862
31871
  }
31863
31872
  }
31864
31873
  return cdef.getName() + " cannot be instantiated, class is defined as " +
@@ -53407,6 +53416,83 @@ exports.RenameMessageClass = RenameMessageClass;
53407
53416
 
53408
53417
  /***/ },
53409
53418
 
53419
+ /***/ "./node_modules/@abaplint/core/build/src/objects/rename/rename_program.js"
53420
+ /*!********************************************************************************!*\
53421
+ !*** ./node_modules/@abaplint/core/build/src/objects/rename/rename_program.js ***!
53422
+ \********************************************************************************/
53423
+ (__unused_webpack_module, exports, __webpack_require__) {
53424
+
53425
+ "use strict";
53426
+
53427
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
53428
+ exports.RenameProgram = void 0;
53429
+ const Statements = __webpack_require__(/*! ../../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
53430
+ const Expressions = __webpack_require__(/*! ../../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
53431
+ const vscode_languageserver_types_1 = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/umd/main.js");
53432
+ const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/objects/index.js");
53433
+ const renamer_helper_1 = __webpack_require__(/*! ./renamer_helper */ "./node_modules/@abaplint/core/build/src/objects/rename/renamer_helper.js");
53434
+ const _lsp_utils_1 = __webpack_require__(/*! ../../lsp/_lsp_utils */ "./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js");
53435
+ const _abap_object_1 = __webpack_require__(/*! ../_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
53436
+ class RenameProgram {
53437
+ constructor(reg) {
53438
+ this.reg = reg;
53439
+ }
53440
+ buildEdits(obj, oldName, newName) {
53441
+ if (!(obj instanceof __1.Program)) {
53442
+ throw new Error("RenameProgram, not a program");
53443
+ }
53444
+ const main = obj.getMainABAPFile();
53445
+ if (main === undefined) {
53446
+ throw new Error(`Main file not found, ${obj.getType()} ${obj.getName()}`);
53447
+ }
53448
+ let changes = [];
53449
+ const helper = new renamer_helper_1.RenamerHelper(this.reg);
53450
+ changes = changes.concat(helper.buildXMLFileEdits(obj, "NAME", oldName, newName));
53451
+ changes = changes.concat(helper.renameFiles(obj, oldName, newName));
53452
+ const edits = [];
53453
+ for (const s of main.getStatements()) {
53454
+ if (s.get() instanceof Statements.Report || s.get() instanceof Statements.Program) {
53455
+ const exp = s.findFirstExpression(Expressions.ReportName);
53456
+ if (exp) {
53457
+ edits.push(vscode_languageserver_types_1.TextEdit.replace(_lsp_utils_1.LSPUtils.tokenToRange(exp.getFirstToken()), newName.toLowerCase()));
53458
+ }
53459
+ }
53460
+ }
53461
+ if (edits.length > 0) {
53462
+ changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: main.getFilename(), version: 1 }, edits));
53463
+ }
53464
+ // Rename INCLUDE statements in all ABAP objects
53465
+ for (const o of this.reg.getObjects()) {
53466
+ if (o instanceof _abap_object_1.ABAPObject && o !== obj) {
53467
+ for (const file of o.getABAPFiles()) {
53468
+ const includeEdits = [];
53469
+ for (const s of file.getStatements()) {
53470
+ if (s.get() instanceof Statements.Include ||
53471
+ s.get() instanceof Statements.Submit ||
53472
+ s.get() instanceof Statements.Perform) {
53473
+ for (const exp of s.findAllExpressions(Expressions.IncludeName)) {
53474
+ if (exp && exp.getFirstToken().getStr().toUpperCase() === oldName.toUpperCase()) {
53475
+ includeEdits.push(vscode_languageserver_types_1.TextEdit.replace(_lsp_utils_1.LSPUtils.tokenToRange(exp.getFirstToken()), newName.toLowerCase()));
53476
+ }
53477
+ }
53478
+ }
53479
+ }
53480
+ if (includeEdits.length > 0) {
53481
+ changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: file.getFilename(), version: 1 }, includeEdits));
53482
+ }
53483
+ }
53484
+ }
53485
+ }
53486
+ return {
53487
+ documentChanges: changes,
53488
+ };
53489
+ }
53490
+ }
53491
+ exports.RenameProgram = RenameProgram;
53492
+ //# sourceMappingURL=rename_program.js.map
53493
+
53494
+ /***/ },
53495
+
53410
53496
  /***/ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table.js"
53411
53497
  /*!******************************************************************************!*\
53412
53498
  !*** ./node_modules/@abaplint/core/build/src/objects/rename/rename_table.js ***!
@@ -53498,6 +53584,7 @@ const rename_data_element_1 = __webpack_require__(/*! ./rename_data_element */ "
53498
53584
  const rename_domain_1 = __webpack_require__(/*! ./rename_domain */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_domain.js");
53499
53585
  const rename_global_class_1 = __webpack_require__(/*! ./rename_global_class */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_global_class.js");
53500
53586
  const rename_global_interface_1 = __webpack_require__(/*! ./rename_global_interface */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_global_interface.js");
53587
+ const rename_program_1 = __webpack_require__(/*! ./rename_program */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_program.js");
53501
53588
  const rename_table_1 = __webpack_require__(/*! ./rename_table */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table.js");
53502
53589
  const rename_table_type_1 = __webpack_require__(/*! ./rename_table_type */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table_type.js");
53503
53590
  const rename_message_class_1 = __webpack_require__(/*! ./rename_message_class */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_message_class.js");
@@ -53552,6 +53639,8 @@ class Renamer {
53552
53639
  return new rename_table_type_1.RenameTableType(this.reg);
53553
53640
  case "INTF":
53554
53641
  return new rename_global_interface_1.RenameGlobalInterface(this.reg);
53642
+ case "PROG":
53643
+ return new rename_program_1.RenameProgram(this.reg);
53555
53644
  case "MSAG":
53556
53645
  return new rename_message_class_1.RenameMessageClass(this.reg);
53557
53646
  case "SICF":
@@ -56039,7 +56128,7 @@ class Registry {
56039
56128
  }
56040
56129
  static abaplintVersion() {
56041
56130
  // magic, see build script "version.sh"
56042
- return "2.118.8";
56131
+ return "2.118.10";
56043
56132
  }
56044
56133
  getDDICReferences() {
56045
56134
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.118.8",
3
+ "version": "2.118.10",
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.118.8",
41
+ "@abaplint/core": "^2.118.10",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",