@abaplint/core 2.99.8 → 2.99.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.
@@ -4555,7 +4555,7 @@ declare class PrivateSection implements IStructure {
4555
4555
  }
4556
4556
 
4557
4557
  declare class Program extends ABAPObject {
4558
- private isIncludeValue;
4558
+ private parsedXML;
4559
4559
  getType(): string;
4560
4560
  getSequencedFiles(): readonly ABAPFile[];
4561
4561
  getDescription(): string | undefined;
@@ -4565,6 +4565,8 @@ declare class Program extends ABAPObject {
4565
4565
  };
4566
4566
  setDirty(): void;
4567
4567
  isInclude(): boolean;
4568
+ isModulePool(): boolean;
4569
+ parseXML(): void;
4568
4570
  }
4569
4571
 
4570
4572
  declare class Program_2 implements IStatement {
@@ -113,6 +113,7 @@ class StatementParser {
113
113
  const concat = statement.concatTokens().toUpperCase();
114
114
  if (concat.startsWith("CALL METHOD ") === false
115
115
  && concat.startsWith("RAISE EXCEPTION TYPE ") === false
116
+ && concat.startsWith("READ TABLE ") === false
116
117
  && concat.startsWith("LOOP AT ") === false
117
118
  && concat.startsWith("CALL FUNCTION ") === false) {
118
119
  for (const { first, second } of this.buildSplits(statement.getTokens())) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Tables = void 0;
4
4
  const Expressions = require("../../2_statements/expressions");
5
5
  const _typed_identifier_1 = require("../../types/_typed_identifier");
6
- const basic_1 = require("../../types/basic");
6
+ const unknown_type_1 = require("../../types/basic/unknown_type");
7
7
  class Tables {
8
8
  runSyntax(node, scope, filename) {
9
9
  var _a, _b;
@@ -15,13 +15,15 @@ class Tables {
15
15
  if (name.startsWith("*")) {
16
16
  name = name.substr(1);
17
17
  }
18
+ // lookupTableOrView will also give Unknown and Void
18
19
  const found = (_b = scope.getDDIC()) === null || _b === void 0 ? void 0 : _b.lookupTableOrView(name);
19
20
  if (found) {
20
21
  scope.getDDICReferences().addUsing(scope.getParentObj(), { object: found.object, filename: filename, token: nameToken });
21
22
  scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, found.type));
22
23
  return;
23
24
  }
24
- scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.UnknownType("Tables, fallback")));
25
+ // this should never happen,
26
+ scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, new unknown_type_1.UnknownType("Tables, fallback")));
25
27
  }
26
28
  }
27
29
  exports.Tables = Tables;
@@ -60,21 +60,27 @@ class LSPLookup {
60
60
  const hover = "Method Definition \"" + method.getName() + "\"";
61
61
  return { hover, definition: found, definitionId: method, scope: bottomScope };
62
62
  }
63
+ let hoverValue = "";
64
+ const ddicRefs = reg.getDDICReferences().listByFilename(cursor.identifier.getFilename(), cursor.identifier.getStart().getRow());
65
+ for (const d of ddicRefs) {
66
+ if (d.object && d.token && d.token.getStart().equals(cursor.identifier.getStart())) {
67
+ hoverValue += `DDIC: ${d.object.getType()} ${d.object.getName()}`;
68
+ }
69
+ }
63
70
  const variable = bottomScope.findVariable(cursor.token.getStr());
64
71
  if (variable !== undefined && variable.getStart().equals(cursor.token.getStart())) {
65
72
  const hover = "Variable Definition\n\n" + this.dumpType(variable);
73
+ if (hoverValue !== "") {
74
+ hoverValue = hover + "\n_________________\n" + hoverValue;
75
+ }
76
+ else {
77
+ hoverValue = hover;
78
+ }
66
79
  let location = undefined;
67
80
  if (variable.getMeta().includes("built-in" /* IdentifierMeta.BuiltIn */) === false) {
68
81
  location = _lsp_utils_1.LSPUtils.identiferToLocation(variable);
69
82
  }
70
- return { hover, definition: location, implementation: location, definitionId: variable, scope: bottomScope };
71
- }
72
- let hoverValue = "";
73
- const ddicRefs = reg.getDDICReferences().listByFilename(cursor.identifier.getFilename(), cursor.identifier.getStart().getRow());
74
- for (const d of ddicRefs) {
75
- if (d.object && d.token && d.token.getStart().equals(cursor.identifier.getStart())) {
76
- hoverValue += `DDIC: ${d.object.getType()} ${d.object.getName()}`;
77
- }
83
+ return { hover: hoverValue, definition: location, implementation: location, definitionId: variable, scope: bottomScope };
78
84
  }
79
85
  const refs = this.searchReferences(bottomScope, cursor.token);
80
86
  if (refs.length > 0) {
@@ -3,10 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Program = void 0;
4
4
  const _abap_object_1 = require("./_abap_object");
5
5
  class Program extends _abap_object_1.ABAPObject {
6
- constructor() {
7
- super(...arguments);
8
- this.isIncludeValue = undefined;
9
- }
10
6
  getType() {
11
7
  return "PROG";
12
8
  }
@@ -28,15 +24,25 @@ class Program extends _abap_object_1.ABAPObject {
28
24
  };
29
25
  }
30
26
  setDirty() {
31
- this.isIncludeValue = undefined;
27
+ this.parsedXML = undefined;
32
28
  super.setDirty();
33
29
  }
34
30
  isInclude() {
35
- if (this.isIncludeValue === undefined) {
31
+ this.parseXML();
32
+ return this.parsedXML.isInclude;
33
+ }
34
+ isModulePool() {
35
+ this.parseXML();
36
+ return this.parsedXML.isModulePool;
37
+ }
38
+ parseXML() {
39
+ if (this.parsedXML === undefined) {
36
40
  const file = this.getXMLFile();
37
- this.isIncludeValue = file ? file.getRaw().includes("<SUBC>I</SUBC>") : false;
41
+ this.parsedXML = {
42
+ isInclude: file ? file.getRaw().includes("<SUBC>I</SUBC>") : false,
43
+ isModulePool: file ? file.getRaw().includes("<SUBC>M</SUBC>") : false,
44
+ };
38
45
  }
39
- return this.isIncludeValue;
40
46
  }
41
47
  }
42
48
  exports.Program = Program;
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.99.8";
66
+ return "2.99.10";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -55,7 +55,9 @@ class MainFileContents {
55
55
  if (stru === undefined) {
56
56
  return [];
57
57
  }
58
- if (obj instanceof Objects.Program && obj.isInclude() === false) {
58
+ if (obj instanceof Objects.Program
59
+ && obj.isInclude() === false
60
+ && obj.isModulePool() === false) {
59
61
  let count = 0;
60
62
  let first = main.getStatements()[count];
61
63
  while (first !== undefined && first.get() instanceof _statement_1.Comment) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.99.8",
3
+ "version": "2.99.10",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,7 +50,7 @@
50
50
  "@microsoft/api-extractor": "^7.34.8",
51
51
  "@types/chai": "^4.3.5",
52
52
  "@types/mocha": "^10.0.1",
53
- "@types/node": "^20.1.0",
53
+ "@types/node": "^20.1.2",
54
54
  "chai": "^4.3.7",
55
55
  "eslint": "^8.40.0",
56
56
  "mocha": "^10.2.0",