@abaplint/core 2.79.8 → 2.79.9

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.
@@ -249,6 +249,7 @@ class BuiltIn {
249
249
  components.push({ name: "index", type: new basic_1.IntegerType() });
250
250
  components.push({ name: "langu", type: new basic_1.CharacterType(1) });
251
251
  components.push({ name: "ldbpg", type: new basic_1.CharacterType(40) });
252
+ components.push({ name: "pdest", type: new basic_1.CharacterType(4) });
252
253
  components.push({ name: "lilli", type: new basic_1.IntegerType() });
253
254
  components.push({ name: "linct", type: new basic_1.IntegerType() });
254
255
  components.push({ name: "linno", type: new basic_1.IntegerType() });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RenameDataElement = void 0;
4
+ const __1 = require("..");
5
+ const renamer_helper_1 = require("./renamer_helper");
6
+ class RenameDataElement {
7
+ constructor(reg) {
8
+ this.reg = reg;
9
+ }
10
+ buildEdits(obj, oldName, newName) {
11
+ if (!(obj instanceof __1.DataElement)) {
12
+ throw new Error("RenameDataElement, not a data element");
13
+ }
14
+ let changes = [];
15
+ const helper = new renamer_helper_1.RenamerHelper(this.reg);
16
+ changes = changes.concat(helper.buildXMLFileEdits(obj, "ROLLNAME", oldName, newName));
17
+ changes = changes.concat(helper.renameFiles(obj, oldName, newName));
18
+ return {
19
+ documentChanges: changes,
20
+ };
21
+ }
22
+ }
23
+ exports.RenameDataElement = RenameDataElement;
24
+ //# sourceMappingURL=rename_data_element.js.map
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RenameDomain = void 0;
4
+ const __1 = require("..");
5
+ const renamer_helper_1 = require("./renamer_helper");
6
+ class RenameDomain {
7
+ constructor(reg) {
8
+ this.reg = reg;
9
+ }
10
+ buildEdits(obj, oldName, newName) {
11
+ if (!(obj instanceof __1.Domain)) {
12
+ throw new Error("RenameDomain, not a domain");
13
+ }
14
+ let changes = [];
15
+ const helper = new renamer_helper_1.RenamerHelper(this.reg);
16
+ changes = changes.concat(helper.buildXMLFileEdits(obj, "DOMNAME", oldName, newName));
17
+ changes = changes.concat(helper.renameFiles(obj, oldName, newName));
18
+ return {
19
+ documentChanges: changes,
20
+ };
21
+ }
22
+ }
23
+ exports.RenameDomain = RenameDomain;
24
+ //# sourceMappingURL=rename_domain.js.map
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Renamer = void 0;
4
4
  const vscode_languageserver_types_1 = require("vscode-languageserver-types");
5
5
  const memory_file_1 = require("../../files/memory_file");
6
+ const rename_data_element_1 = require("./rename_data_element");
7
+ const rename_domain_1 = require("./rename_domain");
6
8
  const rename_global_class_1 = require("./rename_global_class");
7
9
  const rename_global_interface_1 = require("./rename_global_interface");
8
10
  class Renamer {
@@ -40,6 +42,10 @@ class Renamer {
40
42
  switch (type) {
41
43
  case "CLAS":
42
44
  return new rename_global_class_1.RenameGlobalClass(this.reg);
45
+ case "DTEL":
46
+ return new rename_data_element_1.RenameDataElement(this.reg);
47
+ case "DOMA":
48
+ return new rename_domain_1.RenameDomain(this.reg);
43
49
  case "INTF":
44
50
  return new rename_global_interface_1.RenameGlobalInterface(this.reg);
45
51
  default:
@@ -35,11 +35,12 @@ class RenamerHelper {
35
35
  }
36
36
  const tag = xmlTag.toUpperCase();
37
37
  const search = "<" + tag + ">" + oldName.toUpperCase() + "</" + tag + ">";
38
+ const length = tag.length + 2;
38
39
  const rows = xml.getRawRows();
39
40
  for (let i = 0; i < rows.length; i++) {
40
41
  const index = rows[i].indexOf(search);
41
42
  if (index >= 0) {
42
- const range = vscode_languageserver_types_1.Range.create(i, index + 9, i, index + oldName.length + 9);
43
+ const range = vscode_languageserver_types_1.Range.create(i, index + length, i, index + oldName.length + length);
43
44
  changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: xml.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, newName.toUpperCase())]));
44
45
  }
45
46
  }
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.79.8";
71
+ return "2.79.9";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -7,6 +7,11 @@ const _irule_1 = require("./_irule");
7
7
  const __1 = require("..");
8
8
  /** Checks that constants classes are in sync with domain fixed values */
9
9
  class ConstantClassesConf extends _basic_rule_config_1.BasicRuleConfig {
10
+ constructor() {
11
+ super(...arguments);
12
+ /** Specify a list of domain-class pairs which will be validated */
13
+ this.mapping = [];
14
+ }
10
15
  }
11
16
  exports.ConstantClassesConf = ConstantClassesConf;
12
17
  class ConstantClasses {
@@ -26,11 +26,9 @@ class ExitOrCheck extends _abap_rule_1.ABAPRule {
26
26
  title: "Find EXIT or CHECK outside loops",
27
27
  shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.
28
28
  Use RETURN to leave procesing blocks instead.`,
29
- extendedInformation: `
30
- https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm
29
+ extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm
31
30
  https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm
32
- https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return
33
- `,
31
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return`,
34
32
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
35
33
  };
36
34
  }
@@ -44,19 +42,20 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-re
44
42
  const issues = [];
45
43
  const stack = [];
46
44
  for (const statement of file.getStatements()) {
47
- if (statement.get() instanceof Statements.Loop
48
- || statement.get() instanceof Statements.While
49
- || statement.get() instanceof Statements.SelectLoop
50
- || statement.get() instanceof Statements.Do) {
45
+ const get = statement.get();
46
+ if (get instanceof Statements.Loop
47
+ || get instanceof Statements.While
48
+ || get instanceof Statements.SelectLoop
49
+ || get instanceof Statements.Do) {
51
50
  stack.push(statement);
52
51
  }
53
- else if (statement.get() instanceof Statements.EndLoop
54
- || statement.get() instanceof Statements.EndWhile
55
- || statement.get() instanceof Statements.EndSelect
56
- || statement.get() instanceof Statements.EndDo) {
52
+ else if (get instanceof Statements.EndLoop
53
+ || get instanceof Statements.EndWhile
54
+ || get instanceof Statements.EndSelect
55
+ || get instanceof Statements.EndDo) {
57
56
  stack.pop();
58
57
  }
59
- else if (this.conf.allowCheck === false && statement.get() instanceof Statements.Check && stack.length === 0) {
58
+ else if (this.conf.allowCheck === false && get instanceof Statements.Check && stack.length === 0) {
60
59
  const message = "CHECK is not allowed outside of loops";
61
60
  let tokensString = statement.concatTokens();
62
61
  tokensString = tokensString.slice(statement.getFirstToken().getEnd().getCol());
@@ -65,7 +64,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-re
65
64
  const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);
66
65
  issues.push(issue);
67
66
  }
68
- else if (this.conf.allowExit === false && statement.get() instanceof Statements.Exit && stack.length === 0) {
67
+ else if (this.conf.allowExit === false && get instanceof Statements.Exit && stack.length === 0) {
69
68
  const message = "EXIT is not allowed outside of loops";
70
69
  const fix = edit_helper_1.EditHelper.replaceToken(file, statement.getFirstToken(), "RETURN");
71
70
  const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);
@@ -186,12 +186,10 @@ class UnusedVariables {
186
186
  if (statement === undefined) {
187
187
  return undefined;
188
188
  }
189
- else if (statement.get() instanceof Statements.FunctionModule) {
190
- return undefined; // function module parameters are not part of the code
191
- }
192
- else {
189
+ else if (statement.get() instanceof Statements.Data) {
193
190
  return edit_helper_1.EditHelper.deleteStatement(file, statement);
194
191
  }
192
+ return undefined;
195
193
  }
196
194
  }
197
195
  exports.UnusedVariables = UnusedVariables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.79.8",
3
+ "version": "2.79.9",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -54,21 +54,21 @@
54
54
  },
55
55
  "homepage": "https://abaplint.org",
56
56
  "devDependencies": {
57
- "@microsoft/api-extractor": "^7.18.10",
57
+ "@microsoft/api-extractor": "^7.18.11",
58
58
  "@types/chai": "^4.2.22",
59
59
  "@types/mocha": "^9.0.0",
60
- "@types/node": "^16.9.6",
60
+ "@types/node": "^16.10.2",
61
61
  "chai": "^4.3.4",
62
62
  "eslint": "^7.32.0",
63
63
  "madge": "^5.0.1",
64
- "mocha": "^9.1.1",
64
+ "mocha": "^9.1.2",
65
65
  "c8": "^7.9.0",
66
66
  "source-map-support": "^0.5.20",
67
67
  "ts-json-schema-generator": "^0.95.0",
68
68
  "typescript": "^4.4.3"
69
69
  },
70
70
  "dependencies": {
71
- "fast-xml-parser": "^3.20.0",
71
+ "fast-xml-parser": "^3.20.3",
72
72
  "json5": "^2.2.0",
73
73
  "vscode-languageserver-protocol": "^3.16.0",
74
74
  "vscode-languageserver-types": "^3.16.0"