@abaplint/core 2.120.36 → 2.120.38
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 +1 -0
- package/build/src/abap/2_statements/expressions/type_param.js +6 -1
- package/build/src/abap/5_syntax/_type_utils.js +23 -0
- package/build/src/abap/5_syntax/expressions/form_param.js +1 -1
- package/build/src/abap/5_syntax/statements/perform.js +5 -1
- package/build/src/abap/types/form_definition.js +2 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/chain_mainly_declarations.js +1 -0
- package/build/src/stuff.js +1 -0
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -3559,6 +3559,7 @@ export declare const enum IdentifierMeta {
|
|
|
3559
3559
|
FunctionModuleTables = "function_module_tables",
|
|
3560
3560
|
EventParameter = "event_parameter",
|
|
3561
3561
|
FormParameter = "form_parameter",
|
|
3562
|
+
FormParameterStructure = "form_parameter_structure",
|
|
3562
3563
|
ReadOnly = "read_only",
|
|
3563
3564
|
Tables = "tables",
|
|
3564
3565
|
Abstract = "abstract",
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TypeParam = void 0;
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
const _1 = require(".");
|
|
6
|
+
const version_1 = require("../../../version");
|
|
7
|
+
const _derived_types_1 = require("./_derived_types");
|
|
6
8
|
class TypeParam extends combi_1.Expression {
|
|
7
9
|
getRunnable() {
|
|
8
10
|
const table = (0, combi_1.seq)((0, combi_1.altPrio)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY"), "TABLE");
|
|
@@ -10,7 +12,10 @@ class TypeParam extends combi_1.Expression {
|
|
|
10
12
|
const typeLine = "LINE OF";
|
|
11
13
|
const ret = (0, combi_1.seq)((0, combi_1.alt)(foo, typeLine), _1.TypeNameOrInfer, (0, combi_1.opt)(_1.Default));
|
|
12
14
|
const like = (0, combi_1.seq)("LIKE", (0, combi_1.opt)("LINE OF"), _1.FieldChain, (0, combi_1.optPrio)(_1.Default));
|
|
13
|
-
|
|
15
|
+
const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
|
|
16
|
+
const rapTable = (0, combi_1.ver)(version_1.Release.v770, (0, combi_1.seq)("TYPE", "TABLE FOR", (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION IMPORT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("READ LINK", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v787, (0, combi_1.seq)("EVENT", entity), { also: combi_1.AlsoIn.OpenABAP })), (0, combi_1.optPrio)("VALUE IS INITIAL")), { also: combi_1.AlsoIn.OpenABAP });
|
|
17
|
+
// Method parameters also allow the RAP table and response type forms.
|
|
18
|
+
return (0, combi_1.altPrio)(rapTable, _1.TypeStructure, (0, combi_1.seq)("TYPE", (0, combi_1.alt)(table, ret)), like);
|
|
14
19
|
}
|
|
15
20
|
}
|
|
16
21
|
exports.TypeParam = TypeParam;
|
|
@@ -575,6 +575,29 @@ class TypeUtils {
|
|
|
575
575
|
}
|
|
576
576
|
return this.isAssignable(source, target);
|
|
577
577
|
}
|
|
578
|
+
// Typing with the classic STRUCTURE addition, ie. "FORM foo USING bar STRUCTURE zkey",
|
|
579
|
+
// is not a compatibility check: ABAP only checks the fragment view up to the end of the
|
|
580
|
+
// formal structure, so the actual parameter is allowed to be longer. For TABLES parameters
|
|
581
|
+
// the table key is not part of the check at all.
|
|
582
|
+
isAssignableStructureTyping(source, target, node) {
|
|
583
|
+
if (source instanceof basic_1.StructureType && target instanceof basic_1.StructureType) {
|
|
584
|
+
const sourceComponents = source.getComponents();
|
|
585
|
+
const targetComponents = target.getComponents();
|
|
586
|
+
if (sourceComponents.length < targetComponents.length) {
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
for (let i = 0; i < targetComponents.length; i++) {
|
|
590
|
+
if (this.isAssignableStrict(sourceComponents[i].type, targetComponents[i].type) === false) {
|
|
591
|
+
return false;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return true;
|
|
595
|
+
}
|
|
596
|
+
else if (source instanceof basic_1.TableType && target instanceof basic_1.TableType) {
|
|
597
|
+
return this.isAssignableStructureTyping(source.getRowType(), target.getRowType());
|
|
598
|
+
}
|
|
599
|
+
return this.isAssignableStrict(source, target, node);
|
|
600
|
+
}
|
|
578
601
|
isAssignable(source, target) {
|
|
579
602
|
if (source === undefined || target === undefined) {
|
|
580
603
|
return true;
|
|
@@ -31,7 +31,7 @@ class FormParam {
|
|
|
31
31
|
else {
|
|
32
32
|
type = new basic_1.UnknownType("todo, FORM STRUCTURES typing");
|
|
33
33
|
}
|
|
34
|
-
return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, type, ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
34
|
+
return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, type, ["form_parameter" /* IdentifierMeta.FormParameter */, "form_parameter_structure" /* IdentifierMeta.FormParameterStructure */]);
|
|
35
35
|
}
|
|
36
36
|
if (node.getChildren().length === 1 && nameToken) {
|
|
37
37
|
// untyped FORM parameter
|
|
@@ -113,7 +113,11 @@ class Perform {
|
|
|
113
113
|
continue;
|
|
114
114
|
}
|
|
115
115
|
const parameter = formal[i];
|
|
116
|
-
|
|
116
|
+
const structureTyping = parameter.getMeta().includes("form_parameter_structure" /* IdentifierMeta.FormParameterStructure */);
|
|
117
|
+
const assignable = structureTyping
|
|
118
|
+
? typeUtils.isAssignableStructureTyping(type, parameter.getType(), source)
|
|
119
|
+
: typeUtils.isAssignableStrict(type, parameter.getType(), source);
|
|
120
|
+
if (assignable === false) {
|
|
117
121
|
const message = `PERFORM parameter type not compatible, ${parameter.getName()}`;
|
|
118
122
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, source.getFirstToken(), message));
|
|
119
123
|
return false;
|
|
@@ -90,7 +90,8 @@ class FormDefinition extends _identifier_1.Identifier {
|
|
|
90
90
|
else if (!(type instanceof basic_1.UnknownType) && !(type instanceof basic_1.VoidType)) {
|
|
91
91
|
type = new basic_1.UnknownType("FORM TABLES type must be table type");
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
// keep the meta from FormParam, so STRUCTURE typing can be recognized later
|
|
94
|
+
ret.push(new _typed_identifier_1.TypedIdentifier(p.getToken(), input.filename, type, p.getMeta()));
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
return ret;
|
package/build/src/registry.js
CHANGED
|
@@ -137,6 +137,7 @@ https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenchained_stat
|
|
|
137
137
|
|| statement instanceof Statements.Ranges
|
|
138
138
|
|| statement instanceof Statements.TypePools
|
|
139
139
|
|| statement instanceof Statements.FieldSymbol
|
|
140
|
+
|| statement instanceof Statements.Nodes
|
|
140
141
|
|| statement instanceof Statements.Data
|
|
141
142
|
|| statement instanceof Statements.DataBegin
|
|
142
143
|
|| statement instanceof Statements.DataEnd)) {
|
package/build/src/stuff.js
CHANGED
|
@@ -37,6 +37,7 @@ exports.DECLARATION_STUFF = exports.SELECTION_EVENTS = void 0;
|
|
|
37
37
|
const Statements = __importStar(require("./abap/2_statements/statements"));
|
|
38
38
|
exports.SELECTION_EVENTS = [
|
|
39
39
|
Statements.StartOfSelection,
|
|
40
|
+
Statements.Get,
|
|
40
41
|
Statements.AtSelectionScreen,
|
|
41
42
|
Statements.AtLineSelection,
|
|
42
43
|
Statements.AtPF,
|