@abaplint/core 2.113.5 → 2.113.7

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.
@@ -4,6 +4,7 @@ exports.ObjectOriented = void 0;
4
4
  const Statements = require("../2_statements/statements");
5
5
  const Expressions = require("../2_statements/expressions");
6
6
  const visibility_1 = require("../4_file_information/visibility");
7
+ const types_1 = require("../types");
7
8
  // todo, think some of the public methods can be made private
8
9
  // todo: changet this class to static? for performance
9
10
  class ObjectOriented {
@@ -77,6 +78,18 @@ class ObjectOriented {
77
78
  }
78
79
  return undefined;
79
80
  }
81
+ methodReferenceExtras(foundDef, ooName) {
82
+ if (foundDef === undefined) {
83
+ return {
84
+ ooName: ooName,
85
+ ooType: undefined,
86
+ };
87
+ }
88
+ return {
89
+ ooName: foundDef === null || foundDef === void 0 ? void 0 : foundDef.getName(),
90
+ ooType: foundDef instanceof types_1.ClassDefinition ? "CLAS" : "INTF",
91
+ };
92
+ }
80
93
  findClassName(node) {
81
94
  if (!(node.get() instanceof Statements.ClassImplementation
82
95
  || node.get() instanceof Statements.ClassDefinition)) {
@@ -13,7 +13,6 @@ const method_call_param_1 = require("./method_call_param");
13
13
  const _reference_1 = require("../_reference");
14
14
  const component_name_1 = require("./component_name");
15
15
  const attribute_name_1 = require("./attribute_name");
16
- const class_definition_1 = require("../../types/class_definition");
17
16
  const _syntax_input_1 = require("../_syntax_input");
18
17
  class MethodCallChain {
19
18
  runSyntax(node, input, targetType) {
@@ -56,10 +55,8 @@ class MethodCallChain {
56
55
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
57
56
  return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
58
57
  }
59
- const extra = {
60
- ooName: foundDef === null || foundDef === void 0 ? void 0 : foundDef.getName(),
61
- ooType: foundDef instanceof class_definition_1.ClassDefinition ? "CLAS" : "INTF"
62
- };
58
+ const voidedName = context instanceof basic_1.VoidType ? context.getVoided() : undefined;
59
+ const extra = helper.methodReferenceExtras(foundDef, className || voidedName);
63
60
  input.scope.addReference(methodToken, method, _reference_1.ReferenceType.MethodReference, input.filename, extra);
64
61
  }
65
62
  if (methodName === null || methodName === void 0 ? void 0 : methodName.includes("~")) {
@@ -13,7 +13,6 @@ const source_field_1 = require("./source_field");
13
13
  const tokens_1 = require("../../1_lexer/tokens");
14
14
  const attribute_name_1 = require("./attribute_name");
15
15
  const component_name_1 = require("./component_name");
16
- const types_1 = require("../../types");
17
16
  const version_1 = require("../../../version");
18
17
  const _syntax_input_1 = require("../_syntax_input");
19
18
  const assert_error_1 = require("../assert_error");
@@ -93,10 +92,7 @@ class MethodSource {
93
92
  return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
94
93
  }
95
94
  else if (method) {
96
- const extra = {
97
- ooName: foundDef === null || foundDef === void 0 ? void 0 : foundDef.getName(),
98
- ooType: foundDef instanceof types_1.ClassDefinition ? "CLAS" : "INTF"
99
- };
95
+ const extra = helper.methodReferenceExtras(foundDef, className);
100
96
  input.scope.addReference(methodToken, method, _reference_1.ReferenceType.MethodReference, input.filename, extra);
101
97
  context = method;
102
98
  }
@@ -11,8 +11,10 @@ const _typed_identifier_1 = require("../abap/types/_typed_identifier");
11
11
  const _reference_1 = require("../abap/5_syntax/_reference");
12
12
  const _builtin_1 = require("../abap/5_syntax/_builtin");
13
13
  const _scope_type_1 = require("../abap/5_syntax/_scope_type");
14
+ const objects_1 = require("../objects");
14
15
  const types_1 = require("../abap/types");
15
16
  const _statement_1 = require("../abap/2_statements/statements/_statement");
17
+ const include_graph_1 = require("../utils/include_graph");
16
18
  class LSPLookup {
17
19
  static lookup(cursor, reg, obj) {
18
20
  var _a, _b;
@@ -25,7 +27,17 @@ class LSPLookup {
25
27
  if (fm) {
26
28
  return { hover: "Function Module " + fm };
27
29
  }
28
- const bottomScope = new syntax_1.SyntaxLogic(reg, obj).run().spaghetti.lookupPosition(cursor.identifier.getStart(), cursor.identifier.getFilename());
30
+ let main = obj;
31
+ if (obj instanceof objects_1.Program && obj.isInclude()) {
32
+ // todo: this is slow
33
+ const ig = new include_graph_1.IncludeGraph(reg);
34
+ const mains = ig.listMainForInclude(cursor.identifier.getFilename());
35
+ if (mains.length === 1) {
36
+ // yea, well, or it has to be a popup
37
+ main = reg.findObjectForFile(reg.getFileByName(mains[0])) || obj;
38
+ }
39
+ }
40
+ const bottomScope = new syntax_1.SyntaxLogic(reg, main).run().spaghetti.lookupPosition(cursor.identifier.getStart(), cursor.identifier.getFilename());
29
41
  if (bottomScope === undefined) {
30
42
  return undefined;
31
43
  }
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.5";
70
+ return "2.113.7";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.5",
3
+ "version": "2.113.7",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -55,7 +55,7 @@
55
55
  "@types/mocha": "^10.0.7",
56
56
  "@types/node": "^22.5.4",
57
57
  "chai": "^4.5.0",
58
- "eslint": "^9.9.1",
58
+ "eslint": "^9.10.0",
59
59
  "mocha": "^10.7.3",
60
60
  "c8": "^10.1.2",
61
61
  "source-map-support": "^0.5.21",