@abaplint/core 2.81.0 → 2.81.4

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 (27) hide show
  1. package/build/abaplint.d.ts +37 -16
  2. package/build/src/abap/2_statements/expressions/sql_arithmetics.js +2 -1
  3. package/build/src/abap/2_statements/expressions/sql_function.js +11 -5
  4. package/build/src/abap/2_statements/statements/type_begin.js +2 -1
  5. package/build/src/abap/3_structures/structures/normal.js +1 -1
  6. package/build/src/abap/5_syntax/_builtin.js +817 -80
  7. package/build/src/abap/5_syntax/_current_scope.js +26 -0
  8. package/build/src/abap/5_syntax/_object_oriented.js +13 -9
  9. package/build/src/abap/5_syntax/_reference.js +16 -16
  10. package/build/src/abap/5_syntax/_scope_type.js +1 -0
  11. package/build/src/abap/5_syntax/basic_types.js +5 -1
  12. package/build/src/abap/5_syntax/spaghetti_scope.js +13 -0
  13. package/build/src/abap/5_syntax/statements/class_implementation.js +6 -5
  14. package/build/src/abap/5_syntax/statements/method_implementation.js +5 -3
  15. package/build/src/abap/5_syntax/statements/read_table.js +4 -1
  16. package/build/src/abap/5_syntax/syntax.js +6 -1
  17. package/build/src/abap/nodes/expression_node.js +2 -2
  18. package/build/src/abap/nodes/statement_node.js +1 -1
  19. package/build/src/abap/types/class_definition.js +1 -2
  20. package/build/src/edit_helper.js +32 -9
  21. package/build/src/lsp/_lookup.js +46 -25
  22. package/build/src/registry.js +1 -1
  23. package/build/src/rules/no_chained_assignment.js +1 -5
  24. package/build/src/rules/parser_missing_space.js +2 -1
  25. package/build/src/rules/unnecessary_chaining.js +0 -4
  26. package/build/src/rules/unreachable_code.js +4 -0
  27. package/package.json +5 -5
@@ -54,6 +54,25 @@ class CurrentScope {
54
54
  }
55
55
  this.current.getData().types[upper] = type;
56
56
  }
57
+ addExtraLikeType(type) {
58
+ if (type === undefined) {
59
+ return;
60
+ }
61
+ this.addExtraLikeTypeNamed(type.getName(), type);
62
+ }
63
+ addExtraLikeTypeNamed(name, type) {
64
+ if (type === undefined) {
65
+ return;
66
+ }
67
+ if (this.current === undefined) {
68
+ return;
69
+ }
70
+ const upper = name.toUpperCase();
71
+ if (this.current.getData().extraLikeTypes[upper] !== undefined) {
72
+ throw new Error(`Type name "${name}" already defined`);
73
+ }
74
+ this.current.getData().extraLikeTypes[upper] = type;
75
+ }
57
76
  addClassDefinition(c) {
58
77
  var _a;
59
78
  (_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().cdefs.push(c);
@@ -231,6 +250,13 @@ class CurrentScope {
231
250
  }
232
251
  return (_a = this.current) === null || _a === void 0 ? void 0 : _a.findType(name);
233
252
  }
253
+ findExtraLikeType(name) {
254
+ var _a;
255
+ if (name === undefined) {
256
+ return undefined;
257
+ }
258
+ return (_a = this.current) === null || _a === void 0 ? void 0 : _a.findExtraLikeType(name);
259
+ }
234
260
  findVariable(name) {
235
261
  var _a;
236
262
  if (name === undefined) {
@@ -9,14 +9,6 @@ class ObjectOriented {
9
9
  constructor(scope) {
10
10
  this.scope = scope;
11
11
  }
12
- // returns list of interfaces implemented
13
- fromInterfaces(classDefinition, skip) {
14
- const ignore = [];
15
- for (const i of classDefinition.getImplementing()) {
16
- ignore.push(...this.fromInterfaceByName(i.name, ignore.concat(skip || [])));
17
- }
18
- return ignore;
19
- }
20
12
  fromInterfaceByName(name, ignore) {
21
13
  const idef = this.scope.findInterfaceDefinition(name);
22
14
  if (idef === undefined || ignore.includes(name.toUpperCase())) {
@@ -279,8 +271,12 @@ class ObjectOriented {
279
271
  }
280
272
  return csup;
281
273
  }
274
+ fromSuperClassesAndInterfaces(child) {
275
+ const implemented = this.fromSuperClasses(child);
276
+ this.fromInterfaces(child, implemented);
277
+ }
282
278
  // returns list of interfaces implemented
283
- fromSuperClass(child) {
279
+ fromSuperClasses(child) {
284
280
  let sup = child.getSuperClass();
285
281
  const ignore = [];
286
282
  while (sup !== undefined) {
@@ -306,6 +302,14 @@ class ObjectOriented {
306
302
  }
307
303
  return ignore;
308
304
  }
305
+ // returns list of interfaces implemented
306
+ fromInterfaces(classDefinition, skip) {
307
+ const ignore = [];
308
+ for (const i of classDefinition.getImplementing()) {
309
+ ignore.push(...this.fromInterfaceByName(i.name, ignore.concat(skip || [])));
310
+ }
311
+ return ignore;
312
+ }
309
313
  }
310
314
  exports.ObjectOriented = ObjectOriented;
311
315
  //# sourceMappingURL=_object_oriented.js.map
@@ -4,21 +4,21 @@ exports.ReferenceType = void 0;
4
4
  var ReferenceType;
5
5
  (function (ReferenceType) {
6
6
  /** for classes and interface references */
7
- ReferenceType["ObjectOrientedReference"] = "ObjectOrientedReference";
8
- ReferenceType["ObjectOrientedVoidReference"] = "ObjectOrientedVoidReference";
9
- ReferenceType["ObjectOrientedUnknownReference"] = "ObjectOrientedUnknownReference";
10
- ReferenceType["TableReference"] = "TableReference";
11
- ReferenceType["TableVoidReference"] = "TableVoidReference";
12
- ReferenceType["MethodReference"] = "MethodReference";
13
- ReferenceType["BuiltinMethodReference"] = "BuiltinMethodReference";
14
- ReferenceType["MethodImplementationReference"] = "MethodImplementationReference";
15
- ReferenceType["TypeReference"] = "TypeReference";
16
- ReferenceType["BuiltinTypeReference"] = "BuiltinTypeReference";
17
- ReferenceType["VoidType"] = "VoidType";
18
- ReferenceType["InferredType"] = "InferredType";
19
- ReferenceType["FormReference"] = "FormReference";
20
- // FormVoidReference = "FormReference",
21
- ReferenceType["DataReadReference"] = "DataReadReference";
22
- ReferenceType["DataWriteReference"] = "DataWriteReference";
7
+ ReferenceType["ObjectOrientedReference"] = "Object";
8
+ ReferenceType["ObjectOrientedVoidReference"] = "Object (Void)";
9
+ ReferenceType["ObjectOrientedUnknownReference"] = "Object (Unknown)";
10
+ ReferenceType["TableReference"] = "Table";
11
+ ReferenceType["TableVoidReference"] = "Table (Void)";
12
+ ReferenceType["MethodReference"] = "Method";
13
+ ReferenceType["BuiltinMethodReference"] = "Builtin Method";
14
+ ReferenceType["MethodImplementationReference"] = "Method Implementation";
15
+ ReferenceType["TypeReference"] = "Type";
16
+ ReferenceType["BuiltinTypeReference"] = "Builtin Type";
17
+ ReferenceType["VoidType"] = "Type (Void)";
18
+ ReferenceType["InferredType"] = "Inferred Type";
19
+ ReferenceType["FormReference"] = "Form";
20
+ // FormVoidReference = "Form (void)",
21
+ ReferenceType["DataReadReference"] = "Read From";
22
+ ReferenceType["DataWriteReference"] = "Write To";
23
23
  })(ReferenceType = exports.ReferenceType || (exports.ReferenceType = {}));
24
24
  //# sourceMappingURL=_reference.js.map
@@ -14,6 +14,7 @@ var ScopeType;
14
14
  ScopeType["Form"] = "form";
15
15
  ScopeType["FunctionModule"] = "function";
16
16
  ScopeType["Method"] = "method";
17
+ ScopeType["MethodInstance"] = "method_instance";
17
18
  ScopeType["For"] = "for";
18
19
  ScopeType["OpenSQL"] = "open_sql";
19
20
  })(ScopeType = exports.ScopeType || (exports.ScopeType = {}));
@@ -79,8 +79,12 @@ class BasicTypes {
79
79
  }
80
80
  else {
81
81
  const name = children.shift().getFirstToken().getStr();
82
- const found = this.scope.findVariable(name);
82
+ let found = this.scope.findVariable(name);
83
83
  type = found === null || found === void 0 ? void 0 : found.getType();
84
+ if (found === undefined) {
85
+ found = this.scope.findExtraLikeType(name);
86
+ type = found === null || found === void 0 ? void 0 : found.getType();
87
+ }
84
88
  if (found) {
85
89
  this.scope.addReference(chain === null || chain === void 0 ? void 0 : chain.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);
86
90
  }
@@ -12,6 +12,7 @@ class ScopeData {
12
12
  idefs: [],
13
13
  forms: [],
14
14
  types: {},
15
+ extraLikeTypes: {},
15
16
  deferred: [],
16
17
  references: [],
17
18
  };
@@ -126,6 +127,18 @@ class SpaghettiScopeNode extends ScopeData {
126
127
  }
127
128
  return undefined;
128
129
  }
130
+ findExtraLikeType(name) {
131
+ let search = this;
132
+ const upper = name.toUpperCase();
133
+ while (search !== undefined) {
134
+ const data = search.getData();
135
+ if (data.extraLikeTypes[upper]) {
136
+ return data.extraLikeTypes[upper];
137
+ }
138
+ search = search.getParent();
139
+ }
140
+ return undefined;
141
+ }
129
142
  findVariable(name) {
130
143
  let search = this;
131
144
  const upper = name.toUpperCase();
@@ -17,7 +17,6 @@ class ClassImplementation {
17
17
  if (classDefinition === undefined) {
18
18
  throw new Error("Class definition for \"" + className + "\" not found");
19
19
  }
20
- const classAttributes = classDefinition.getAttributes();
21
20
  for (const t of classDefinition.getTypeDefinitions().getAll()) {
22
21
  scope.addType(t.type);
23
22
  }
@@ -27,11 +26,13 @@ class ClassImplementation {
27
26
  }
28
27
  scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(new tokens_1.Identifier(new position_1.Position(1, 1), "me"), _builtin_1.BuiltIn.filename, new basic_1.ObjectReferenceType(classDefinition)));
29
28
  helper.addAliasedAttributes(classDefinition); // todo, this is not correct, take care of instance vs static
29
+ const classAttributes = classDefinition.getAttributes();
30
30
  scope.addList(classAttributes.getConstants());
31
- scope.addList(classAttributes.getInstance()); // todo, this is not correct, take care of instance vs static
32
- scope.addList(classAttributes.getStatic()); // todo, this is not correct, take care of instance vs static
33
- const implemented = helper.fromSuperClass(classDefinition);
34
- helper.fromInterfaces(classDefinition, implemented);
31
+ scope.addList(classAttributes.getStatic());
32
+ for (const i of classAttributes.getInstance()) {
33
+ scope.addExtraLikeType(i);
34
+ }
35
+ helper.fromSuperClassesAndInterfaces(classDefinition);
35
36
  }
36
37
  }
37
38
  exports.ClassImplementation = ClassImplementation;
@@ -11,17 +11,19 @@ class MethodImplementation {
11
11
  const className = scope.getName();
12
12
  const methodToken = node.findFirstExpression(Expressions.MethodName).getFirstToken();
13
13
  const methodName = methodToken === null || methodToken === void 0 ? void 0 : methodToken.getStr();
14
- scope.push(_scope_type_1.ScopeType.Method, methodName, node.getFirstToken().getStart(), filename);
15
14
  const classDefinition = scope.findClassDefinition(className);
16
15
  if (classDefinition === undefined) {
17
- scope.pop(node.getLastToken().getEnd());
18
16
  throw new Error("Class definition for \"" + className + "\" not found");
19
17
  }
20
18
  const { method: methodDefinition } = helper.searchMethodName(classDefinition, methodName);
21
19
  if (methodDefinition === undefined) {
22
- scope.pop(node.getLastToken().getEnd());
23
20
  throw new Error("Method definition \"" + methodName + "\" not found");
24
21
  }
22
+ if (methodDefinition.isStatic() === false) {
23
+ scope.push(_scope_type_1.ScopeType.MethodInstance, methodName, node.getFirstToken().getStart(), filename);
24
+ scope.addList(classDefinition.getAttributes().getInstance());
25
+ }
26
+ scope.push(_scope_type_1.ScopeType.Method, methodName, node.getFirstToken().getStart(), filename);
25
27
  scope.addReference(methodToken, methodDefinition, _reference_1.ReferenceType.MethodImplementationReference, filename);
26
28
  scope.addList(methodDefinition.getParameters().getAll());
27
29
  for (const i of helper.findInterfaces(classDefinition)) {
@@ -11,6 +11,7 @@ const component_compare_simple_1 = require("../expressions/component_compare_sim
11
11
  const _type_utils_1 = require("../_type_utils");
12
12
  class ReadTable {
13
13
  runSyntax(node, scope, filename) {
14
+ const concat = node.concatTokens().toUpperCase();
14
15
  const sources = node.findDirectExpressions(Expressions.Source);
15
16
  let firstSource = node.findDirectExpression(Expressions.SimpleSource2);
16
17
  if (firstSource === undefined) {
@@ -53,6 +54,9 @@ class ReadTable {
53
54
  }
54
55
  const target = node.findDirectExpression(Expressions.ReadTableTarget);
55
56
  if (target) {
57
+ if (concat.includes(" REFERENCE INTO ")) {
58
+ rowType = new basic_1.DataReference(rowType);
59
+ }
56
60
  const inline = target.findFirstExpression(Expressions.InlineData);
57
61
  if (inline) {
58
62
  new inline_data_1.InlineData().runSyntax(inline, scope, filename, rowType);
@@ -76,7 +80,6 @@ class ReadTable {
76
80
  return;
77
81
  }
78
82
  }
79
- const concat = node.concatTokens().toUpperCase();
80
83
  if (target === undefined && concat.includes(" TRANSPORTING NO FIELDS ") === false) {
81
84
  // if sourceType is void, assume its with header
82
85
  if (sourceType instanceof basic_1.TableType && sourceType.isWithHeader() === false) {
@@ -412,11 +412,16 @@ class SyntaxLogic {
412
412
  }
413
413
  else if (s instanceof Statements.EndForm
414
414
  || s instanceof Statements.EndFunction
415
- || s instanceof Statements.EndMethod
416
415
  || s instanceof Statements.EndClass
417
416
  || s instanceof Statements.EndInterface) {
418
417
  this.scope.pop(node.getLastToken().getEnd());
419
418
  }
419
+ else if (s instanceof Statements.EndMethod) {
420
+ this.scope.pop(node.getLastToken().getEnd());
421
+ if (this.scope.getType() === _scope_type_1.ScopeType.MethodInstance) {
422
+ this.scope.pop(node.getLastToken().getEnd());
423
+ }
424
+ }
420
425
  }
421
426
  }
422
427
  exports.SyntaxLogic = SyntaxLogic;
@@ -189,7 +189,7 @@ class ExpressionNode extends _abstract_node_1.AbstractNode {
189
189
  }
190
190
  return ret;
191
191
  }
192
- findAllExpressionsMulti(type) {
192
+ findAllExpressionsMulti(type, recursive = false) {
193
193
  const ret = [];
194
194
  for (const child of this.getChildren()) {
195
195
  if (child instanceof token_node_1.TokenNode) {
@@ -201,7 +201,7 @@ class ExpressionNode extends _abstract_node_1.AbstractNode {
201
201
  ret.push(child);
202
202
  }
203
203
  }
204
- if (before === ret.length) {
204
+ if (before === ret.length || recursive === true) {
205
205
  ret.push(...child.findAllExpressionsMulti(type));
206
206
  }
207
207
  }
@@ -211,7 +211,7 @@ class StatementNode extends _abstract_node_1.AbstractNode {
211
211
  }
212
212
  }
213
213
  if (before === ret.length || recursive === true) {
214
- ret.push(...child.findAllExpressionsMulti(type));
214
+ ret.push(...child.findAllExpressionsMulti(type, recursive));
215
215
  }
216
216
  }
217
217
  return ret;
@@ -31,8 +31,7 @@ class ClassDefinition extends _identifier_1.Identifier {
31
31
  this.friends = this.findFriends(def, filename, scope);
32
32
  this.parse(filename, scope);
33
33
  const helper = new _object_oriented_1.ObjectOriented(scope);
34
- const implemented = helper.fromSuperClass(this);
35
- helper.fromInterfaces(this, implemented);
34
+ helper.fromSuperClassesAndInterfaces(this);
36
35
  this.attributes = new class_attributes_1.Attributes(this.node, this.filename, scope);
37
36
  this.types = this.attributes.getTypes();
38
37
  this.methodDefs = new method_definitions_1.MethodDefinitions(this.node, this.filename, scope);
@@ -97,11 +97,12 @@ class EditHelper {
97
97
  if (scolon === undefined) {
98
98
  return EditHelper.deleteRange(file, statement.getFirstToken().getStart(), statement.getLastToken().getEnd());
99
99
  }
100
- // find statements part of chain
101
- let chainCount = 0;
102
100
  let setPrevious = true;
101
+ let setNext = true;
103
102
  /** previous statement in the chain */
104
103
  let previousStatement = undefined;
104
+ /** next statement in the chain */
105
+ let nextStatement = undefined;
105
106
  for (const s of file.getStatements()) {
106
107
  const colon = s.getColon();
107
108
  if (colon === undefined) {
@@ -109,16 +110,22 @@ class EditHelper {
109
110
  }
110
111
  else if (s === statement) {
111
112
  setPrevious = false;
113
+ setNext = true;
112
114
  continue;
113
115
  }
114
- else if (colon.getStart().equals(scolon.getStart())) {
115
- chainCount = chainCount + 1;
116
+ else if (setPrevious === true) {
117
+ if (scolon.getStart().equals(colon.getStart())) {
118
+ previousStatement = s;
119
+ }
116
120
  }
117
- if (setPrevious === true) {
118
- previousStatement = s;
121
+ else if (setNext === true) {
122
+ if (scolon.getStart().equals(colon.getStart())) {
123
+ nextStatement = s;
124
+ }
125
+ break;
119
126
  }
120
127
  }
121
- if (chainCount === 0) {
128
+ if (previousStatement === undefined && nextStatement === undefined) {
122
129
  // the statement to be deleted is the only one in the chain
123
130
  return EditHelper.deleteRange(file, statement.getFirstToken().getStart(), statement.getLastToken().getEnd());
124
131
  }
@@ -130,14 +137,30 @@ class EditHelper {
130
137
  break;
131
138
  }
132
139
  }
140
+ const colon = statement.getColon();
133
141
  if (statement.getLastToken().getStr() === "." && previousStatement) {
142
+ // last statement in chain
134
143
  const edit1 = EditHelper.replaceToken(file, previousStatement.getLastToken(), ".");
135
- const edit2 = EditHelper.deleteRange(file, startDelete, statement.getLastToken().getEnd());
144
+ const edit2 = EditHelper.deleteRange(file, previousStatement.getLastToken().getEnd(), statement.getLastToken().getEnd());
136
145
  return EditHelper.merge(edit1, edit2);
137
146
  }
147
+ else if (previousStatement === undefined && colon && nextStatement) {
148
+ // first statement in chain
149
+ return EditHelper.deleteRange(file, this.firstAfterColon(statement), this.firstAfterColon(nextStatement));
150
+ }
138
151
  else {
139
- return EditHelper.deleteRange(file, startDelete, statement.getLastToken().getEnd());
152
+ // middle statement
153
+ return EditHelper.deleteRange(file, startDelete, this.firstAfterColon(nextStatement));
154
+ }
155
+ }
156
+ static firstAfterColon(statement) {
157
+ const colon = statement.getColon().getStart();
158
+ for (const t of statement.getTokens()) {
159
+ if (t.getStart().isAfter(colon)) {
160
+ return t.getStart();
161
+ }
140
162
  }
163
+ throw new Error("firstAfterColon, emtpy statement?");
141
164
  }
142
165
  static deleteToken(file, token) {
143
166
  const filename = file.getFilename();
@@ -28,36 +28,40 @@ class LSPLookup {
28
28
  const clas = bottomScope.findClassDefinition(cursor.token.getStr());
29
29
  if (clas && clas.getStart().equals(cursor.token.getStart())) {
30
30
  const found = _lsp_utils_1.LSPUtils.identiferToLocation(clas);
31
- return { hover: "Class definition, " + cursor.token.getStr(),
31
+ return {
32
+ hover: "Class Definition, " + cursor.token.getStr(),
32
33
  definition: found,
33
34
  definitionId: clas,
34
35
  implementation: undefined,
35
- scope: bottomScope };
36
+ scope: bottomScope,
37
+ };
36
38
  }
37
39
  const intf = bottomScope.findInterfaceDefinition(cursor.token.getStr());
38
40
  if (intf && intf.getStart().equals(cursor.token.getStart())) {
39
41
  const found = _lsp_utils_1.LSPUtils.identiferToLocation(intf);
40
- return { hover: "Interface definition, " + cursor.token.getStr(),
42
+ return {
43
+ hover: "Interface Definition, " + cursor.token.getStr(),
41
44
  definition: found,
42
45
  definitionId: intf,
43
46
  implementation: undefined,
44
- scope: bottomScope };
47
+ scope: bottomScope,
48
+ };
45
49
  }
46
50
  const type = bottomScope.findType(cursor.token.getStr());
47
51
  if (type !== undefined && type.getStart().equals(cursor.token.getStart())) {
48
52
  const found = _lsp_utils_1.LSPUtils.identiferToLocation(type);
49
- const hover = "Type definition, " + cursor.token.getStr() + "\n\n" + this.dumpType(type);
53
+ const hover = "Type Definition, " + cursor.token.getStr() + "\n\n" + this.dumpType(type);
50
54
  return { hover, definition: found, definitionId: type, scope: bottomScope };
51
55
  }
52
56
  const method = this.findMethodDefinition(cursor, bottomScope);
53
57
  if (method !== undefined && method.getStart().equals(cursor.token.getStart())) {
54
58
  const found = _lsp_utils_1.LSPUtils.identiferToLocation(method);
55
- const hover = "Method definition \"" + method.getName() + "\"";
59
+ const hover = "Method Definition \"" + method.getName() + "\"";
56
60
  return { hover, definition: found, definitionId: method, scope: bottomScope };
57
61
  }
58
62
  const variable = bottomScope.findVariable(cursor.token.getStr());
59
63
  if (variable !== undefined && variable.getStart().equals(cursor.token.getStart())) {
60
- const hover = "Variable definition\n\n" + this.dumpType(variable);
64
+ const hover = "Variable Definition\n\n" + this.dumpType(variable);
61
65
  let location = undefined;
62
66
  if (variable.getMeta().includes("built-in" /* BuiltIn */) === false) {
63
67
  location = _lsp_utils_1.LSPUtils.identiferToLocation(variable);
@@ -103,23 +107,23 @@ class LSPLookup {
103
107
  value = value + "\n\nMeta: " + variable.getMeta().join(", ");
104
108
  }
105
109
  if (variable.getType().containsVoid() === true) {
106
- value = value + "\n\nContains void types";
110
+ value = value + "\n\nContains Void types";
107
111
  }
108
112
  if (variable.getType().getQualifiedName()) {
109
- value = value + "\n\nQualified type name: ```" + variable.getType().getQualifiedName() + "```";
113
+ value = value + "\n\nQualified Type Name: ```" + variable.getType().getQualifiedName() + "```";
110
114
  }
111
115
  if (variable.getType().isGeneric() === true) {
112
- value = value + "\n\nIs generic type";
116
+ value = value + "\n\nIs Generic Type";
113
117
  }
114
118
  return value;
115
119
  }
116
120
  static referenceHover(ref, scope, reg) {
117
- var _a, _b, _c;
121
+ var _a, _b, _c, _d, _e;
118
122
  let name = "";
119
123
  if (ref.resolved) {
120
124
  name = "```" + ref.resolved.getName() + "```";
121
125
  }
122
- let ret = "Resolved Reference: " + ref.referenceType + " " + name;
126
+ let ret = `${ref.referenceType} ${name}`;
123
127
  if (ref.referenceType === _reference_1.ReferenceType.MethodReference && ((_a = ref.extra) === null || _a === void 0 ? void 0 : _a.ooName)) {
124
128
  let cdef = scope.findClassDefinition(ref.extra.ooName);
125
129
  if (cdef === undefined) {
@@ -136,45 +140,62 @@ class LSPLookup {
136
140
  else if (ref.resolved instanceof _typed_identifier_1.TypedIdentifier) {
137
141
  ret += "\n\n" + this.dumpType(ref.resolved);
138
142
  }
143
+ else if (ref.referenceType === _reference_1.ReferenceType.BuiltinMethodReference) {
144
+ const builtinDef = new _builtin_1.BuiltIn().searchBuiltin((_e = (_d = ref.resolved) === null || _d === void 0 ? void 0 : _d.getName()) === null || _e === void 0 ? void 0 : _e.toUpperCase());
145
+ if (builtinDef === undefined) {
146
+ return "Error: builtin method signature not found";
147
+ }
148
+ ret += "\n\n" + this.methodParameters(builtinDef);
149
+ }
150
+ if (ref.resolved) {
151
+ ret += "\n\n(Resolved)";
152
+ }
139
153
  if (ref.extra !== undefined && Object.keys(ref.extra).length > 0) {
140
154
  ret += "\n\nExtra: " + JSON.stringify(ref.extra);
141
155
  }
142
156
  return ret;
143
157
  }
144
- static hoverMethod(method, def) {
145
- if (def === undefined) {
158
+ static hoverMethod(method, classDef) {
159
+ if (classDef === undefined) {
146
160
  return "class not found";
147
161
  }
148
- const mdef = def.getMethodDefinitions().getByName(method);
149
- if (mdef === undefined) {
162
+ const methodDef = classDef.getMethodDefinitions().getByName(method);
163
+ if (methodDef === undefined) {
150
164
  return "method not found in definition";
151
165
  }
166
+ return this.methodParameters(methodDef);
167
+ }
168
+ static methodParameters(methodDef) {
152
169
  let ret = "";
153
- if (mdef.getParameters().getImporting().length > 0) {
170
+ const parameters = methodDef.getParameters();
171
+ const importing = parameters.getImporting();
172
+ if (importing.length > 0) {
154
173
  ret += "IMPORTING\n";
155
- for (const p of mdef.getParameters().getImporting()) {
174
+ for (const p of importing) {
156
175
  ret += this.singleParameter(p);
157
176
  }
158
177
  }
159
- if (mdef.getParameters().getExporting().length > 0) {
178
+ const exporting = parameters.getExporting();
179
+ if (exporting.length > 0) {
160
180
  ret += "EXPORTING\n";
161
- for (const p of mdef.getParameters().getExporting()) {
181
+ for (const p of exporting) {
162
182
  ret += this.singleParameter(p);
163
183
  }
164
184
  }
165
- if (mdef.getParameters().getChanging().length > 0) {
185
+ const changing = parameters.getChanging();
186
+ if (changing.length > 0) {
166
187
  ret += "CHANGING\n";
167
- for (const p of mdef.getParameters().getChanging()) {
188
+ for (const p of changing) {
168
189
  ret += this.singleParameter(p);
169
190
  }
170
191
  }
171
- const r = mdef.getParameters().getReturning();
192
+ const r = parameters.getReturning();
172
193
  if (r) {
173
194
  ret += "RETURNING\n" + this.singleParameter(r);
174
195
  }
175
- if (mdef.getRaising().length > 0) {
196
+ if (methodDef.getRaising().length > 0) {
176
197
  ret += "RAISING\n";
177
- for (const p of mdef.getRaising()) {
198
+ for (const p of methodDef.getRaising()) {
178
199
  ret += "* " + p + "\n";
179
200
  }
180
201
  }
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.81.0";
71
+ return "2.81.4";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -8,10 +8,6 @@ const _abap_rule_1 = require("./_abap_rule");
8
8
  const _basic_rule_config_1 = require("./_basic_rule_config");
9
9
  const _irule_1 = require("./_irule");
10
10
  class NoChainedAssignmentConf extends _basic_rule_config_1.BasicRuleConfig {
11
- constructor() {
12
- super(...arguments);
13
- this.onlyConstants = false;
14
- }
15
11
  }
16
12
  exports.NoChainedAssignmentConf = NoChainedAssignmentConf;
17
13
  class NoChainedAssignment extends _abap_rule_1.ABAPRule {
@@ -28,7 +24,7 @@ class NoChainedAssignment extends _abap_rule_1.ABAPRule {
28
24
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
29
25
  badExample: `var1 = var2 = var3.`,
30
26
  goodExample: `var2 = var3.
31
- var1 = var3.`,
27
+ var1 = var2.`,
32
28
  };
33
29
  }
34
30
  getConfig() {
@@ -50,7 +50,8 @@ This rule makes sure the spaces are consistently required across the language.`,
50
50
  }
51
51
  missingSpace(statement) {
52
52
  const found = statement.findAllExpressionsMulti([Expressions.CondSub, Expressions.SQLCond,
53
- Expressions.ValueBody, Expressions.NewObject, Expressions.Cond, Expressions.ComponentCond, Expressions.MethodCallParam], true);
53
+ Expressions.ValueBody, Expressions.NewObject, Expressions.Cond,
54
+ Expressions.ComponentCond, Expressions.MethodCallParam], true);
54
55
  let pos = undefined;
55
56
  for (const f of found) {
56
57
  const type = f.get();
@@ -6,10 +6,6 @@ const _abap_rule_1 = require("./_abap_rule");
6
6
  const _basic_rule_config_1 = require("./_basic_rule_config");
7
7
  const _irule_1 = require("./_irule");
8
8
  class UnnecessaryChainingConf extends _basic_rule_config_1.BasicRuleConfig {
9
- constructor() {
10
- super(...arguments);
11
- this.onlyConstants = false;
12
- }
13
9
  }
14
10
  exports.UnnecessaryChainingConf = UnnecessaryChainingConf;
15
11
  class UnnecessaryChaining extends _abap_rule_1.ABAPRule {
@@ -67,6 +67,10 @@ class UnreachableCode extends _abap_rule_1.ABAPRule {
67
67
  return true;
68
68
  }
69
69
  else if (s instanceof Statements.Leave && n.findFirstExpression(Expressions.AndReturn) === undefined) {
70
+ const concat = n.concatTokens();
71
+ if (concat.includes(" TO LIST-PROCESSING")) {
72
+ return false;
73
+ }
70
74
  return true;
71
75
  }
72
76
  else if (s instanceof Statements.Return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.81.0",
3
+ "version": "2.81.4",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,14 +48,14 @@
48
48
  "@microsoft/api-extractor": "^7.18.19",
49
49
  "@types/chai": "^4.2.22",
50
50
  "@types/mocha": "^9.0.0",
51
- "@types/node": "^16.11.7",
51
+ "@types/node": "^16.11.10",
52
52
  "chai": "^4.3.4",
53
- "eslint": "^8.2.0",
53
+ "eslint": "^8.3.0",
54
54
  "mocha": "^9.1.3",
55
55
  "c8": "^7.10.0",
56
- "source-map-support": "^0.5.20",
56
+ "source-map-support": "^0.5.21",
57
57
  "ts-json-schema-generator": "^0.97.0",
58
- "typescript": "^4.4.4"
58
+ "typescript": "^4.5.2"
59
59
  },
60
60
  "dependencies": {
61
61
  "fast-xml-parser": "^3.21.1",