@abaplint/core 2.113.12 → 2.113.13
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.
package/build/src/registry.js
CHANGED
|
@@ -63,7 +63,7 @@ class UnusedMethods {
|
|
|
63
63
|
extendedInformation: `Checks private and protected methods.
|
|
64
64
|
|
|
65
65
|
Unused methods are not reported if the object contains parser or syntax errors.
|
|
66
|
-
Quick fixes only appears for private methods.
|
|
66
|
+
Quick fixes only appears for private methods or projected methods where the class doesnt have any subclasses.
|
|
67
67
|
|
|
68
68
|
Skips:
|
|
69
69
|
* methods FOR TESTING
|
|
@@ -156,7 +156,8 @@ Skips:
|
|
|
156
156
|
continue;
|
|
157
157
|
}
|
|
158
158
|
let fix = undefined;
|
|
159
|
-
if (i.visibility === visibility_1.Visibility.Private
|
|
159
|
+
if (i.visibility === visibility_1.Visibility.Private
|
|
160
|
+
|| (i.visibility === visibility_1.Visibility.Protected && this.hasSubClass(obj) === false)) {
|
|
160
161
|
const implementation = this.findMethodImplementation(i, file);
|
|
161
162
|
if (implementation !== undefined) {
|
|
162
163
|
const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statement);
|
|
@@ -169,6 +170,22 @@ Skips:
|
|
|
169
170
|
}
|
|
170
171
|
return issues;
|
|
171
172
|
}
|
|
173
|
+
hasSubClass(obj) {
|
|
174
|
+
var _a, _b, _c;
|
|
175
|
+
if (!(obj instanceof objects_1.Class)) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
if (((_a = obj.getDefinition()) === null || _a === void 0 ? void 0 : _a.isFinal()) === true) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
for (const r of this.reg.getObjects()) {
|
|
182
|
+
if (r instanceof objects_1.Class
|
|
183
|
+
&& ((_c = (_b = r.getDefinition()) === null || _b === void 0 ? void 0 : _b.getSuperClass()) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === obj.getName().toUpperCase()) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
172
189
|
findMethodImplementation(method, file) {
|
|
173
190
|
var _a, _b;
|
|
174
191
|
for (const classImplementation of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStructures(Structures.ClassImplementation)) || []) {
|