@abaplint/core 2.120.64 → 2.120.66

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 (170) hide show
  1. package/build/abaplint.d.ts +2 -154
  2. package/build/src/abap/2_statements/expressions/source.js +4 -2
  3. package/build/src/abap/2_statements/statements/create_data.js +1 -1
  4. package/build/src/abap/2_statements/statements/loop.js +1 -1
  5. package/build/src/abap/5_syntax/expressions/_check_text_symbol.js +56 -0
  6. package/build/src/abap/5_syntax/expressions/method_call_param.js +4 -0
  7. package/build/src/abap/5_syntax/expressions/method_parameters.js +9 -2
  8. package/build/src/abap/5_syntax/expressions/select.js +7 -0
  9. package/build/src/abap/5_syntax/statements/convert.js +1 -1
  10. package/build/src/abap/5_syntax/statements/create_data.js +3 -0
  11. package/build/src/abap/5_syntax/statements/loop.js +10 -3
  12. package/build/src/abap/5_syntax/statements/move.js +28 -0
  13. package/build/src/abap/artifacts.js +33 -36
  14. package/build/src/abap/types/basic/data_reference_type.js +5 -0
  15. package/build/src/objects/_abstract_object.js +3 -0
  16. package/build/src/objects/_unknown_object.js +0 -3
  17. package/build/src/objects/abap_query_functional_area.js +0 -4
  18. package/build/src/objects/abap_query_query.js +0 -4
  19. package/build/src/objects/activation_variant.js +0 -4
  20. package/build/src/objects/api_release_state.js +0 -4
  21. package/build/src/objects/application_descriptors_fiori.js +0 -4
  22. package/build/src/objects/application_job_catalog_entry.js +0 -4
  23. package/build/src/objects/application_job_template.js +0 -4
  24. package/build/src/objects/application_log_object.js +0 -4
  25. package/build/src/objects/assignment_service_to_authorization_group.js +0 -4
  26. package/build/src/objects/atc_check_category.js +0 -4
  27. package/build/src/objects/atc_check_object.js +0 -4
  28. package/build/src/objects/atc_check_variant.js +0 -4
  29. package/build/src/objects/authorization_check_field.js +0 -4
  30. package/build/src/objects/authorization_group.js +0 -4
  31. package/build/src/objects/authorization_object.js +0 -4
  32. package/build/src/objects/authorization_object_class.js +0 -4
  33. package/build/src/objects/authorization_object_extension.js +0 -4
  34. package/build/src/objects/badi_definition.js +0 -4
  35. package/build/src/objects/behavior_definition.js +0 -4
  36. package/build/src/objects/brf_plus_system_application.js +0 -4
  37. package/build/src/objects/bsp_application.js +0 -4
  38. package/build/src/objects/business_add_in_implementation.js +0 -4
  39. package/build/src/objects/business_catalog.js +0 -4
  40. package/build/src/objects/business_catalog_app_assignment.js +0 -4
  41. package/build/src/objects/business_configuration_maintenance_object.js +0 -4
  42. package/build/src/objects/business_configuration_set.js +0 -4
  43. package/build/src/objects/business_function_assignment.js +0 -4
  44. package/build/src/objects/business_function_set_assignment.js +0 -4
  45. package/build/src/objects/business_object_model.js +0 -4
  46. package/build/src/objects/business_object_type.js +0 -4
  47. package/build/src/objects/cds_entity_buffer.js +0 -4
  48. package/build/src/objects/cds_metadata_extension.js +5 -4
  49. package/build/src/objects/cds_type.js +0 -4
  50. package/build/src/objects/change_document.js +0 -4
  51. package/build/src/objects/chapter_of_book_structure.js +0 -4
  52. package/build/src/objects/checkpoint_group.js +0 -4
  53. package/build/src/objects/classification.js +0 -4
  54. package/build/src/objects/communication_scenario.js +0 -4
  55. package/build/src/objects/composite_enhancement_implementation.js +0 -4
  56. package/build/src/objects/composite_enhancement_spot.js +0 -4
  57. package/build/src/objects/concepts_of_package.js +0 -4
  58. package/build/src/objects/custom_data_browser_object.js +0 -4
  59. package/build/src/objects/customer_enhancement_project.js +0 -4
  60. package/build/src/objects/customizing_attributes.js +0 -4
  61. package/build/src/objects/customizing_img_activity.js +0 -4
  62. package/build/src/objects/customizing_transaction.js +0 -4
  63. package/build/src/objects/data_control.js +0 -4
  64. package/build/src/objects/datastore_object.js +0 -4
  65. package/build/src/objects/dialog_module.js +0 -4
  66. package/build/src/objects/documentation.js +0 -4
  67. package/build/src/objects/domain.js +2 -0
  68. package/build/src/objects/ecatt_test_configuration.js +0 -4
  69. package/build/src/objects/ecatt_test_data_container.js +0 -4
  70. package/build/src/objects/ecatt_test_script.js +0 -4
  71. package/build/src/objects/email_template.js +0 -4
  72. package/build/src/objects/enhancement_spot.js +0 -4
  73. package/build/src/objects/entity_type.js +0 -4
  74. package/build/src/objects/event_binding.js +0 -4
  75. package/build/src/objects/event_consumer.js +0 -4
  76. package/build/src/objects/field_catalog.js +0 -4
  77. package/build/src/objects/form_object_form.js +0 -4
  78. package/build/src/objects/form_object_interface.js +0 -4
  79. package/build/src/objects/format_type.js +0 -4
  80. package/build/src/objects/gateway_model.js +0 -4
  81. package/build/src/objects/gateway_model_metadata.js +0 -4
  82. package/build/src/objects/gateway_odata_group_and_assignment.js +0 -4
  83. package/build/src/objects/gateway_project.js +0 -4
  84. package/build/src/objects/gateway_service.js +0 -4
  85. package/build/src/objects/gateway_service_groups_metadata.js +0 -4
  86. package/build/src/objects/gateway_vocabulary_annotation.js +0 -4
  87. package/build/src/objects/general_hierarchy_storage_extrension_name.js +0 -4
  88. package/build/src/objects/general_storage_structure.js +0 -4
  89. package/build/src/objects/general_text.js +0 -4
  90. package/build/src/objects/http_service.js +0 -4
  91. package/build/src/objects/iac_binary_data.js +0 -4
  92. package/build/src/objects/iac_language_resource.js +0 -4
  93. package/build/src/objects/iac_service.js +0 -4
  94. package/build/src/objects/iac_template.js +0 -4
  95. package/build/src/objects/iam_app.js +0 -4
  96. package/build/src/objects/icf_service.js +0 -4
  97. package/build/src/objects/idoc.js +0 -4
  98. package/build/src/objects/idoc_extension.js +0 -4
  99. package/build/src/objects/inbound_service.js +0 -4
  100. package/build/src/objects/info_area.js +0 -4
  101. package/build/src/objects/info_object.js +0 -4
  102. package/build/src/objects/knowledge_transfer_document.js +0 -4
  103. package/build/src/objects/maintenance_and_transport_object.js +0 -4
  104. package/build/src/objects/messaging_channel.js +0 -4
  105. package/build/src/objects/mime_object.js +1 -4
  106. package/build/src/objects/namespace.js +0 -4
  107. package/build/src/objects/neptune_api.js +0 -4
  108. package/build/src/objects/neptune_app.js +0 -4
  109. package/build/src/objects/neptune_custom_color.js +0 -4
  110. package/build/src/objects/neptune_custom_js_helper.js +0 -4
  111. package/build/src/objects/neptune_documentation.js +0 -4
  112. package/build/src/objects/neptune_enhancement.js +0 -4
  113. package/build/src/objects/neptune_launchpad.js +0 -4
  114. package/build/src/objects/neptune_launchpad_layout.js +0 -4
  115. package/build/src/objects/neptune_login_page.js +0 -4
  116. package/build/src/objects/neptune_media_library.js +0 -4
  117. package/build/src/objects/neptune_media_pack.js +0 -4
  118. package/build/src/objects/neptune_metadata.js +0 -4
  119. package/build/src/objects/neptune_mobile_client.js +0 -4
  120. package/build/src/objects/neptune_odata.js +0 -4
  121. package/build/src/objects/neptune_policy.js +0 -4
  122. package/build/src/objects/neptune_rfc_mapping.js +0 -4
  123. package/build/src/objects/neptune_rich_text_template.js +0 -4
  124. package/build/src/objects/neptune_splash_screen.js +0 -4
  125. package/build/src/objects/neptune_sticky_banner.js +0 -4
  126. package/build/src/objects/neptune_tile.js +0 -4
  127. package/build/src/objects/neptune_tile_group.js +0 -4
  128. package/build/src/objects/neptune_tile_layout.js +0 -4
  129. package/build/src/objects/neptune_url_alias.js +0 -4
  130. package/build/src/objects/oauth2_profile.js +0 -4
  131. package/build/src/objects/object_characteristic.js +0 -4
  132. package/build/src/objects/outbound_service.js +0 -4
  133. package/build/src/objects/package.js +0 -4
  134. package/build/src/objects/package_interface.js +0 -4
  135. package/build/src/objects/page_format.js +0 -4
  136. package/build/src/objects/parameter.js +0 -4
  137. package/build/src/objects/personalization_object.js +0 -4
  138. package/build/src/objects/push_channel.js +0 -4
  139. package/build/src/objects/query_user_group.js +0 -4
  140. package/build/src/objects/restriction_field.js +0 -4
  141. package/build/src/objects/restriction_type.js +0 -4
  142. package/build/src/objects/rfc_service.js +0 -4
  143. package/build/src/objects/sapscript.js +0 -4
  144. package/build/src/objects/sapscript_style.js +0 -4
  145. package/build/src/objects/screen_variant.js +0 -4
  146. package/build/src/objects/search_help.js +0 -4
  147. package/build/src/objects/service_binding.js +0 -4
  148. package/build/src/objects/service_definition.js +0 -4
  149. package/build/src/objects/shared_memory.js +0 -4
  150. package/build/src/objects/smart_form.js +0 -4
  151. package/build/src/objects/smart_style.js +0 -4
  152. package/build/src/objects/standard_task.js +0 -4
  153. package/build/src/objects/switch_assignment_hierarchy.js +0 -4
  154. package/build/src/objects/switch_assignments.js +0 -4
  155. package/build/src/objects/technical_job_definition.js +0 -4
  156. package/build/src/objects/transaction_variant.js +0 -4
  157. package/build/src/objects/transformation.js +0 -4
  158. package/build/src/objects/view_cluster.js +0 -4
  159. package/build/src/objects/virtual_end_point.js +0 -4
  160. package/build/src/objects/web_dynpro_application.js +0 -4
  161. package/build/src/objects/web_dynpro_application_configuration.js +0 -4
  162. package/build/src/objects/web_dynpro_component.js +0 -4
  163. package/build/src/objects/web_dynpro_component_configuration.js +0 -4
  164. package/build/src/objects/web_reporting_template.js +0 -4
  165. package/build/src/registry.js +1 -1
  166. package/build/src/rules/else_after_all_returns.js +2 -2
  167. package/build/src/rules/implement_methods.js +36 -13
  168. package/build/src/rules/index.js +1 -0
  169. package/build/src/rules/preferred_parameter_ignored.js +141 -0
  170. package/package.json +1 -1
@@ -12,10 +12,6 @@ class SAPScriptStyle extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.SAPScriptStyle = SAPScriptStyle;
21
17
  //# sourceMappingURL=sapscript_style.js.map
@@ -12,10 +12,6 @@ class ScreenVariant extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.ScreenVariant = ScreenVariant;
21
17
  //# sourceMappingURL=screen_variant.js.map
@@ -12,10 +12,6 @@ class SearchHelp extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.SearchHelp = SearchHelp;
21
17
  //# sourceMappingURL=search_help.js.map
@@ -12,10 +12,6 @@ class ServiceBinding extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.ServiceBinding = ServiceBinding;
21
17
  //# sourceMappingURL=service_binding.js.map
@@ -12,10 +12,6 @@ class ServiceDefinition extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.ServiceDefinition = ServiceDefinition;
21
17
  //# sourceMappingURL=service_definition.js.map
@@ -12,10 +12,6 @@ class SharedMemory extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.SharedMemory = SharedMemory;
21
17
  //# sourceMappingURL=shared_memory.js.map
@@ -12,10 +12,6 @@ class SmartForm extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.SmartForm = SmartForm;
21
17
  //# sourceMappingURL=smart_form.js.map
@@ -12,10 +12,6 @@ class SmartStyle extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.SmartStyle = SmartStyle;
21
17
  //# sourceMappingURL=smart_style.js.map
@@ -12,10 +12,6 @@ class StandardTask extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.StandardTask = StandardTask;
21
17
  //# sourceMappingURL=standard_task.js.map
@@ -12,10 +12,6 @@ class SwitchAssignmentHierarchy extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.SwitchAssignmentHierarchy = SwitchAssignmentHierarchy;
21
17
  //# sourceMappingURL=switch_assignment_hierarchy.js.map
@@ -12,10 +12,6 @@ class SwitchAssignments extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.SwitchAssignments = SwitchAssignments;
21
17
  //# sourceMappingURL=switch_assignments.js.map
@@ -12,10 +12,6 @@ class TechnicalJobDefinition extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.TechnicalJobDefinition = TechnicalJobDefinition;
21
17
  //# sourceMappingURL=technical_job_definition.js.map
@@ -12,10 +12,6 @@ class TransactionVariant extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.TransactionVariant = TransactionVariant;
21
17
  //# sourceMappingURL=transaction_variant.js.map
@@ -12,10 +12,6 @@ class Transformation extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.Transformation = Transformation;
21
17
  //# sourceMappingURL=transformation.js.map
@@ -12,10 +12,6 @@ class ViewCluster extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.ViewCluster = ViewCluster;
21
17
  //# sourceMappingURL=view_cluster.js.map
@@ -12,10 +12,6 @@ class VirtualEndPoint extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.VirtualEndPoint = VirtualEndPoint;
21
17
  //# sourceMappingURL=virtual_end_point.js.map
@@ -12,10 +12,6 @@ class WebDynproApplication extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.WebDynproApplication = WebDynproApplication;
21
17
  //# sourceMappingURL=web_dynpro_application.js.map
@@ -12,10 +12,6 @@ class WebDynproApplicationConfiguration extends _abstract_object_1.AbstractObjec
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.WebDynproApplicationConfiguration = WebDynproApplicationConfiguration;
21
17
  //# sourceMappingURL=web_dynpro_application_configuration.js.map
@@ -12,10 +12,6 @@ class WebDynproComponent extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.WebDynproComponent = WebDynproComponent;
21
17
  //# sourceMappingURL=web_dynpro_component.js.map
@@ -12,10 +12,6 @@ class WebDynproComponentConfiguration extends _abstract_object_1.AbstractObject
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.WebDynproComponentConfiguration = WebDynproComponentConfiguration;
21
17
  //# sourceMappingURL=web_dynpro_component_configuration.js.map
@@ -12,10 +12,6 @@ class WebReportingTemplate extends _abstract_object_1.AbstractObject {
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
15
- getDescription() {
16
- // todo
17
- return undefined;
18
- }
19
15
  }
20
16
  exports.WebReportingTemplate = WebReportingTemplate;
21
17
  //# sourceMappingURL=web_reporting_template.js.map
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.64";
78
+ return "2.120.66";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
@@ -88,8 +88,8 @@ class ElseAfterAllReturns extends _abap_rule_1.ABAPRule {
88
88
  continue;
89
89
  }
90
90
  const fix = edit_helper_1.EditHelper.merge(edit_helper_1.EditHelper.replaceRange(file, elseStatement.getFirstToken().getStart(), elseStatement.getLastToken().getEnd(), "ENDIF."), edit_helper_1.EditHelper.deleteStatement(file, endifStatement));
91
- // eslint-disable-next-line max-len
92
- issues.push(issue_1.Issue.atStatement(file, elseStatement, "Redundant ELSE: all prior branches exit unconditionally", this.getMetadata().key, this.conf.severity, fix));
91
+ const message = "Redundant ELSE: all prior branches exit unconditionally";
92
+ issues.push(issue_1.Issue.atStatement(file, elseStatement, message, this.getMetadata().key, this.conf.severity, fix));
93
93
  }
94
94
  }
95
95
  return issues;
@@ -42,6 +42,8 @@ const Statements = __importStar(require("../abap/2_statements/statements"));
42
42
  const Expressions = __importStar(require("../abap/2_statements/expressions"));
43
43
  const _irule_1 = require("./_irule");
44
44
  const edit_helper_1 = require("../edit_helper");
45
+ const syntax_1 = require("../abap/5_syntax/syntax");
46
+ const _reference_1 = require("../abap/5_syntax/_reference");
45
47
  // todo: abstract methods from superclass parents(might be multiple), if class is not abstract
46
48
  class ImplementMethodsConf extends _basic_rule_config_1.BasicRuleConfig {
47
49
  }
@@ -152,7 +154,7 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
152
154
  return undefined;
153
155
  }
154
156
  findInterface(identifier, name) {
155
- const idef = this.findInterfaceByName(name);
157
+ const idef = this.findInterfaceByName(name, identifier);
156
158
  if (idef === undefined) {
157
159
  const message = "Implemented interface \"" + name + "\" not found";
158
160
  const issue = issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity);
@@ -160,24 +162,45 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
160
162
  }
161
163
  return idef;
162
164
  }
163
- findInterfaceByName(name) {
165
+ findInterfaceByName(name, usedAt) {
164
166
  var _a;
165
- let idef = undefined;
166
167
  const intf = this.reg.getObject("INTF", name);
167
- if (intf === undefined) {
168
- // lookup in localfiles
168
+ const global = (_a = intf === null || intf === void 0 ? void 0 : intf.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().listInterfaceDefinitions()[0];
169
+ let local = undefined;
170
+ for (const file of this.obj.getABAPFiles()) {
171
+ local = file.getInfo().getInterfaceDefinitionByName(name);
172
+ if (local) {
173
+ break;
174
+ }
175
+ }
176
+ if (local === undefined || global === undefined) {
177
+ return global || local;
178
+ }
179
+ // both a local and a global interface exist with the same name, use what the syntax check resolved
180
+ const resolved = this.findResolvedInterface(name, usedAt);
181
+ if (resolved !== undefined) {
169
182
  for (const file of this.obj.getABAPFiles()) {
170
- const found = file.getInfo().getInterfaceDefinitionByName(name);
171
- if (found) {
172
- idef = found;
173
- break;
183
+ for (const idef of file.getInfo().listInterfaceDefinitions()) {
184
+ if (idef.identifier.equals(resolved)) {
185
+ return idef;
186
+ }
174
187
  }
175
188
  }
176
189
  }
177
- else {
178
- idef = (_a = intf.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().listInterfaceDefinitions()[0];
190
+ return global;
191
+ }
192
+ findResolvedInterface(name, usedAt) {
193
+ var _a, _b, _c;
194
+ const scope = new syntax_1.SyntaxLogic(this.reg, this.obj).run().spaghetti.lookupPosition(usedAt.getStart(), usedAt.getFilename());
195
+ const upper = name.toUpperCase();
196
+ for (const ref of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
197
+ if (ref.referenceType === _reference_1.ReferenceType.ObjectOrientedReference
198
+ && ((_a = ref.extra) === null || _a === void 0 ? void 0 : _a.ooType) === "INTF"
199
+ && ((_c = (_b = ref.extra) === null || _b === void 0 ? void 0 : _b.ooName) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === upper) {
200
+ return ref.resolved;
201
+ }
179
202
  }
180
- return idef;
203
+ return undefined;
181
204
  }
182
205
  /** including implemented super interfaces */
183
206
  findInterfaceMethods(idef) {
@@ -296,7 +319,7 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
296
319
  }
297
320
  if (found === undefined) {
298
321
  for (const i of def.interfaces) {
299
- const idef = this.findInterfaceByName(i.name);
322
+ const idef = this.findInterfaceByName(i.name, def.identifier);
300
323
  if (idef === undefined) {
301
324
  continue;
302
325
  }
@@ -156,6 +156,7 @@ __exportStar(require("./prefer_string_template"), exports);
156
156
  __exportStar(require("./prefer_returning_to_exporting"), exports);
157
157
  __exportStar(require("./prefer_xsdbool"), exports);
158
158
  __exportStar(require("./preferred_compare_operator"), exports);
159
+ __exportStar(require("./preferred_parameter_ignored"), exports);
159
160
  __exportStar(require("./prefix_is_current_class"), exports);
160
161
  __exportStar(require("./reduce_procedural_code"), exports);
161
162
  __exportStar(require("./reduce_string_templates"), exports);
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PreferredParameterIgnored = exports.PreferredParameterIgnoredConf = void 0;
37
+ const Expressions = __importStar(require("../abap/2_statements/expressions"));
38
+ const issue_1 = require("../issue");
39
+ const _basic_rule_config_1 = require("./_basic_rule_config");
40
+ const _abap_rule_1 = require("./_abap_rule");
41
+ const _irule_1 = require("./_irule");
42
+ const edit_helper_1 = require("../edit_helper");
43
+ class PreferredParameterIgnoredConf extends _basic_rule_config_1.BasicRuleConfig {
44
+ }
45
+ exports.PreferredParameterIgnoredConf = PreferredParameterIgnoredConf;
46
+ class PreferredParameterIgnored extends _abap_rule_1.ABAPRule {
47
+ constructor() {
48
+ super(...arguments);
49
+ this.conf = new PreferredParameterIgnoredConf();
50
+ }
51
+ getMetadata() {
52
+ return {
53
+ key: "preferred_parameter_ignored",
54
+ title: "PREFERRED PARAMETER is ignored",
55
+ shortDescription: `PREFERRED PARAMETER on an IMPORTING clause that still has a mandatory
56
+ parameter. The addition names the parameter a positional call fills, which only
57
+ means something when every parameter may be left out - so with a mandatory one
58
+ present it does nothing.`,
59
+ extendedInformation: `\`PREFERRED PARAMETER\` names the importing parameter that a call filling exactly
60
+ one parameter positionally fills. That question only arises when a parameter
61
+ may be LEFT OUT, so the addition is ignored while any importing parameter is
62
+ neither \`OPTIONAL\` nor carries a \`DEFAULT\`.
63
+
64
+ The compiler warns "Declare the parameter as OPTIONAL. The addition PREFERRED
65
+ PARAMETER is ignored if non-optional parameters are used", yet it still lets a
66
+ call leave the preferred parameter out. So the quick fix declares the mandatory
67
+ importing parameters OPTIONAL, as the compiler asks: every call that compiles
68
+ today keeps compiling. Removing the addition instead would turn the calls that
69
+ leave the preferred parameter out into syntax errors.`,
70
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
71
+ badExample: `METHODS meth
72
+ IMPORTING
73
+ val TYPE string
74
+ other TYPE i OPTIONAL
75
+ PREFERRED PARAMETER val.`,
76
+ goodExample: `METHODS meth
77
+ IMPORTING
78
+ val TYPE string OPTIONAL
79
+ other TYPE i OPTIONAL
80
+ PREFERRED PARAMETER val.`,
81
+ };
82
+ }
83
+ getConfig() {
84
+ return this.conf;
85
+ }
86
+ setConfig(conf) {
87
+ this.conf = conf;
88
+ }
89
+ runParsed(file) {
90
+ var _a;
91
+ var _b;
92
+ const issues = [];
93
+ for (const statement of file.getStatements()) {
94
+ const importing = statement.findFirstExpression(Expressions.MethodDefImporting);
95
+ if (importing === undefined) {
96
+ continue;
97
+ }
98
+ const preferred = this.preferredTokens(importing);
99
+ if (preferred === undefined) {
100
+ continue;
101
+ }
102
+ const mandatory = this.mandatoryParameters(importing);
103
+ if (mandatory.length === 0) {
104
+ continue;
105
+ }
106
+ const fix = edit_helper_1.EditHelper.mergeList(mandatory.map(p => edit_helper_1.EditHelper.insertAt(file, p.getLastToken().getEnd(), " OPTIONAL")));
107
+ const name = (_b = (_a = mandatory[0].findFirstExpression(Expressions.MethodParamName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) !== null && _b !== void 0 ? _b : mandatory[0].concatTokens();
108
+ const message = `PREFERRED PARAMETER is ignored while ${name} is not optional`;
109
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));
110
+ }
111
+ return issues;
112
+ }
113
+ ////////////////
114
+ /** The span of `PREFERRED PARAMETER <name>`, or undefined when the clause
115
+ * does not carry the addition. */
116
+ preferredTokens(importing) {
117
+ const tokens = importing.getTokens();
118
+ for (let i = 0; i + 2 < tokens.length; i++) {
119
+ if (tokens[i].getStr().toUpperCase() === "PREFERRED"
120
+ && tokens[i + 1].getStr().toUpperCase() === "PARAMETER") {
121
+ return { start: tokens[i].getStart(), end: tokens[i + 2].getEnd() };
122
+ }
123
+ }
124
+ return undefined;
125
+ }
126
+ /** The importing parameters that are neither OPTIONAL nor have a DEFAULT,
127
+ * empty when every one of them may be left out. */
128
+ mandatoryParameters(importing) {
129
+ const ret = [];
130
+ for (const param of importing.findDirectExpressions(Expressions.MethodParamOptional)) {
131
+ const concat = param.concatTokens().toUpperCase();
132
+ if (concat.endsWith(" OPTIONAL") || concat.includes(" DEFAULT ")) {
133
+ continue;
134
+ }
135
+ ret.push(param);
136
+ }
137
+ return ret;
138
+ }
139
+ }
140
+ exports.PreferredParameterIgnored = PreferredParameterIgnored;
141
+ //# sourceMappingURL=preferred_parameter_ignored.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.120.64",
3
+ "version": "2.120.66",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",