@abaplint/core 2.120.63 → 2.120.65
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/abaplint.d.ts +2 -154
- package/build/src/abap/2_statements/statements/create_data.js +1 -1
- package/build/src/abap/2_statements/statements/loop.js +1 -1
- package/build/src/abap/5_syntax/_type_utils.js +1 -0
- package/build/src/abap/5_syntax/basic_types.js +40 -1
- package/build/src/abap/5_syntax/expressions/_check_text_symbol.js +56 -0
- package/build/src/abap/5_syntax/expressions/method_call_param.js +4 -0
- package/build/src/abap/5_syntax/expressions/method_parameters.js +4 -0
- package/build/src/abap/5_syntax/expressions/select.js +7 -0
- package/build/src/abap/5_syntax/statements/create_data.js +3 -0
- package/build/src/abap/5_syntax/statements/loop.js +10 -3
- package/build/src/abap/5_syntax/statements/move.js +28 -0
- package/build/src/abap/artifacts.js +33 -36
- package/build/src/ddic.js +1 -1
- package/build/src/objects/_abstract_object.js +3 -0
- package/build/src/objects/_unknown_object.js +0 -3
- package/build/src/objects/abap_query_functional_area.js +0 -4
- package/build/src/objects/abap_query_query.js +0 -4
- package/build/src/objects/activation_variant.js +0 -4
- package/build/src/objects/api_release_state.js +0 -4
- package/build/src/objects/application_descriptors_fiori.js +0 -4
- package/build/src/objects/application_job_catalog_entry.js +0 -4
- package/build/src/objects/application_job_template.js +0 -4
- package/build/src/objects/application_log_object.js +0 -4
- package/build/src/objects/assignment_service_to_authorization_group.js +0 -4
- package/build/src/objects/atc_check_category.js +0 -4
- package/build/src/objects/atc_check_object.js +0 -4
- package/build/src/objects/atc_check_variant.js +0 -4
- package/build/src/objects/authorization_check_field.js +0 -4
- package/build/src/objects/authorization_group.js +0 -4
- package/build/src/objects/authorization_object.js +0 -4
- package/build/src/objects/authorization_object_class.js +0 -4
- package/build/src/objects/authorization_object_extension.js +0 -4
- package/build/src/objects/badi_definition.js +0 -4
- package/build/src/objects/behavior_definition.js +0 -4
- package/build/src/objects/brf_plus_system_application.js +0 -4
- package/build/src/objects/bsp_application.js +0 -4
- package/build/src/objects/business_add_in_implementation.js +0 -4
- package/build/src/objects/business_catalog.js +0 -4
- package/build/src/objects/business_catalog_app_assignment.js +0 -4
- package/build/src/objects/business_configuration_maintenance_object.js +0 -4
- package/build/src/objects/business_configuration_set.js +0 -4
- package/build/src/objects/business_function_assignment.js +0 -4
- package/build/src/objects/business_function_set_assignment.js +0 -4
- package/build/src/objects/business_object_model.js +0 -4
- package/build/src/objects/business_object_type.js +0 -4
- package/build/src/objects/cds_entity_buffer.js +0 -4
- package/build/src/objects/cds_metadata_extension.js +5 -4
- package/build/src/objects/cds_type.js +0 -4
- package/build/src/objects/change_document.js +0 -4
- package/build/src/objects/chapter_of_book_structure.js +0 -4
- package/build/src/objects/checkpoint_group.js +0 -4
- package/build/src/objects/classification.js +0 -4
- package/build/src/objects/communication_scenario.js +0 -4
- package/build/src/objects/composite_enhancement_implementation.js +0 -4
- package/build/src/objects/composite_enhancement_spot.js +0 -4
- package/build/src/objects/concepts_of_package.js +0 -4
- package/build/src/objects/custom_data_browser_object.js +0 -4
- package/build/src/objects/customer_enhancement_project.js +0 -4
- package/build/src/objects/customizing_attributes.js +0 -4
- package/build/src/objects/customizing_img_activity.js +0 -4
- package/build/src/objects/customizing_transaction.js +0 -4
- package/build/src/objects/data_control.js +0 -4
- package/build/src/objects/datastore_object.js +0 -4
- package/build/src/objects/dialog_module.js +0 -4
- package/build/src/objects/documentation.js +0 -4
- package/build/src/objects/domain.js +2 -0
- package/build/src/objects/ecatt_test_configuration.js +0 -4
- package/build/src/objects/ecatt_test_data_container.js +0 -4
- package/build/src/objects/ecatt_test_script.js +0 -4
- package/build/src/objects/email_template.js +0 -4
- package/build/src/objects/enhancement_spot.js +0 -4
- package/build/src/objects/entity_type.js +0 -4
- package/build/src/objects/event_binding.js +0 -4
- package/build/src/objects/event_consumer.js +0 -4
- package/build/src/objects/field_catalog.js +0 -4
- package/build/src/objects/form_object_form.js +0 -4
- package/build/src/objects/form_object_interface.js +0 -4
- package/build/src/objects/format_type.js +0 -4
- package/build/src/objects/gateway_model.js +0 -4
- package/build/src/objects/gateway_model_metadata.js +0 -4
- package/build/src/objects/gateway_odata_group_and_assignment.js +0 -4
- package/build/src/objects/gateway_project.js +0 -4
- package/build/src/objects/gateway_service.js +0 -4
- package/build/src/objects/gateway_service_groups_metadata.js +0 -4
- package/build/src/objects/gateway_vocabulary_annotation.js +0 -4
- package/build/src/objects/general_hierarchy_storage_extrension_name.js +0 -4
- package/build/src/objects/general_storage_structure.js +0 -4
- package/build/src/objects/general_text.js +0 -4
- package/build/src/objects/http_service.js +0 -4
- package/build/src/objects/iac_binary_data.js +0 -4
- package/build/src/objects/iac_language_resource.js +0 -4
- package/build/src/objects/iac_service.js +0 -4
- package/build/src/objects/iac_template.js +0 -4
- package/build/src/objects/iam_app.js +0 -4
- package/build/src/objects/icf_service.js +0 -4
- package/build/src/objects/idoc.js +0 -4
- package/build/src/objects/idoc_extension.js +0 -4
- package/build/src/objects/inbound_service.js +0 -4
- package/build/src/objects/info_area.js +0 -4
- package/build/src/objects/info_object.js +0 -4
- package/build/src/objects/knowledge_transfer_document.js +0 -4
- package/build/src/objects/maintenance_and_transport_object.js +0 -4
- package/build/src/objects/messaging_channel.js +0 -4
- package/build/src/objects/mime_object.js +1 -4
- package/build/src/objects/namespace.js +0 -4
- package/build/src/objects/neptune_api.js +0 -4
- package/build/src/objects/neptune_app.js +0 -4
- package/build/src/objects/neptune_custom_color.js +0 -4
- package/build/src/objects/neptune_custom_js_helper.js +0 -4
- package/build/src/objects/neptune_documentation.js +0 -4
- package/build/src/objects/neptune_enhancement.js +0 -4
- package/build/src/objects/neptune_launchpad.js +0 -4
- package/build/src/objects/neptune_launchpad_layout.js +0 -4
- package/build/src/objects/neptune_login_page.js +0 -4
- package/build/src/objects/neptune_media_library.js +0 -4
- package/build/src/objects/neptune_media_pack.js +0 -4
- package/build/src/objects/neptune_metadata.js +0 -4
- package/build/src/objects/neptune_mobile_client.js +0 -4
- package/build/src/objects/neptune_odata.js +0 -4
- package/build/src/objects/neptune_policy.js +0 -4
- package/build/src/objects/neptune_rfc_mapping.js +0 -4
- package/build/src/objects/neptune_rich_text_template.js +0 -4
- package/build/src/objects/neptune_splash_screen.js +0 -4
- package/build/src/objects/neptune_sticky_banner.js +0 -4
- package/build/src/objects/neptune_tile.js +0 -4
- package/build/src/objects/neptune_tile_group.js +0 -4
- package/build/src/objects/neptune_tile_layout.js +0 -4
- package/build/src/objects/neptune_url_alias.js +0 -4
- package/build/src/objects/oauth2_profile.js +0 -4
- package/build/src/objects/object_characteristic.js +0 -4
- package/build/src/objects/outbound_service.js +0 -4
- package/build/src/objects/package.js +0 -4
- package/build/src/objects/package_interface.js +0 -4
- package/build/src/objects/page_format.js +0 -4
- package/build/src/objects/parameter.js +0 -4
- package/build/src/objects/personalization_object.js +0 -4
- package/build/src/objects/push_channel.js +0 -4
- package/build/src/objects/query_user_group.js +0 -4
- package/build/src/objects/restriction_field.js +0 -4
- package/build/src/objects/restriction_type.js +0 -4
- package/build/src/objects/rfc_service.js +0 -4
- package/build/src/objects/sapscript.js +0 -4
- package/build/src/objects/sapscript_style.js +0 -4
- package/build/src/objects/screen_variant.js +0 -4
- package/build/src/objects/search_help.js +0 -4
- package/build/src/objects/service_binding.js +0 -4
- package/build/src/objects/service_definition.js +0 -4
- package/build/src/objects/shared_memory.js +0 -4
- package/build/src/objects/smart_form.js +0 -4
- package/build/src/objects/smart_style.js +0 -4
- package/build/src/objects/standard_task.js +0 -4
- package/build/src/objects/switch_assignment_hierarchy.js +0 -4
- package/build/src/objects/switch_assignments.js +0 -4
- package/build/src/objects/table.js +9 -3
- package/build/src/objects/technical_job_definition.js +0 -4
- package/build/src/objects/transaction_variant.js +0 -4
- package/build/src/objects/transformation.js +0 -4
- package/build/src/objects/view_cluster.js +0 -4
- package/build/src/objects/virtual_end_point.js +0 -4
- package/build/src/objects/web_dynpro_application.js +0 -4
- package/build/src/objects/web_dynpro_application_configuration.js +0 -4
- package/build/src/objects/web_dynpro_component.js +0 -4
- package/build/src/objects/web_dynpro_component_configuration.js +0 -4
- package/build/src/objects/web_reporting_template.js +0 -4
- package/build/src/registry.js +1 -1
- package/build/src/rules/else_after_all_returns.js +162 -0
- package/build/src/rules/implement_methods.js +36 -13
- package/build/src/rules/index.js +2 -0
- package/build/src/rules/preferred_parameter_ignored.js +141 -0
- package/package.json +1 -1
|
@@ -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
|