@abaplint/core 2.120.30 → 2.120.31
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.
|
@@ -38,11 +38,20 @@ class FormParam {
|
|
|
38
38
|
return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, basic_1.AnyType.get(), ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
39
39
|
}
|
|
40
40
|
let bfound = new basic_types_1.BasicTypes(input).parseType(node);
|
|
41
|
-
const
|
|
41
|
+
const typeName = (_c = node.findFirstExpression(expressions_1.TypeName)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();
|
|
42
42
|
const hasExplicitLength = node.findFirstExpression(expressions_1.Length) !== undefined
|
|
43
43
|
|| node.findFirstExpression(expressions_1.ConstantFieldLength) !== undefined;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
// the length cannot be specified for FORM parameters, so these types are generic
|
|
45
|
+
if (hasExplicitLength === false) {
|
|
46
|
+
if (typeName === "C" && bfound instanceof basic_1.CharacterType) {
|
|
47
|
+
bfound = basic_1.CGenericType.get();
|
|
48
|
+
}
|
|
49
|
+
else if (typeName === "X" && bfound instanceof basic_1.HexType) {
|
|
50
|
+
bfound = basic_1.XGenericType.get();
|
|
51
|
+
}
|
|
52
|
+
else if (typeName === "P" && bfound instanceof basic_1.PackedType) {
|
|
53
|
+
bfound = basic_1.PGenericType.get();
|
|
54
|
+
}
|
|
46
55
|
}
|
|
47
56
|
if (nameToken && bfound) {
|
|
48
57
|
return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, bfound, ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
@@ -62,6 +62,11 @@ class Parameter {
|
|
|
62
62
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
+
const radioGroup = node.findFirstExpression(Expressions.RadioGroupName);
|
|
66
|
+
if (radioGroup && radioGroup.concatTokens().length > 4) {
|
|
67
|
+
const message = "Radio button group name too long, " + radioGroup.concatTokens();
|
|
68
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, radioGroup.getFirstToken(), message));
|
|
69
|
+
}
|
|
65
70
|
if (this.hasUserCommand(node) && this.hasLength(node)) {
|
|
66
71
|
const message = "USER-COMMAND and LENGTH not possible together";
|
|
67
72
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
@@ -42,6 +42,7 @@ const target_1 = require("../expressions/target");
|
|
|
42
42
|
const _syntax_input_1 = require("../_syntax_input");
|
|
43
43
|
const assert_error_1 = require("../assert_error");
|
|
44
44
|
const dynamic_1 = require("../expressions/dynamic");
|
|
45
|
+
const _type_utils_1 = require("../_type_utils");
|
|
45
46
|
class Perform {
|
|
46
47
|
runSyntax(node, input) {
|
|
47
48
|
if (!(node.get() instanceof Statements.Perform)) {
|
|
@@ -49,19 +50,22 @@ class Perform {
|
|
|
49
50
|
}
|
|
50
51
|
////////////////////////////
|
|
51
52
|
// check parameters are defined
|
|
53
|
+
const changing = [];
|
|
52
54
|
for (const c of node.findDirectExpressions(Expressions.PerformChanging)) {
|
|
53
55
|
for (const s of c.findDirectExpressions(Expressions.Target)) {
|
|
54
|
-
target_1.Target.runSyntax(s, input);
|
|
56
|
+
changing.push({ node: s, type: target_1.Target.runSyntax(s, input) });
|
|
55
57
|
}
|
|
56
58
|
}
|
|
59
|
+
const tables = [];
|
|
57
60
|
for (const t of node.findDirectExpressions(Expressions.PerformTables)) {
|
|
58
61
|
for (const s of t.findDirectExpressions(Expressions.Source)) {
|
|
59
|
-
source_1.Source.runSyntax(s, input);
|
|
62
|
+
tables.push({ node: s, type: source_1.Source.runSyntax(s, input) });
|
|
60
63
|
}
|
|
61
64
|
}
|
|
65
|
+
const using = [];
|
|
62
66
|
for (const u of node.findDirectExpressions(Expressions.PerformUsing)) {
|
|
63
67
|
for (const s of u.findDirectExpressions(Expressions.SimpleSource3)) {
|
|
64
|
-
source_1.Source.runSyntax(s, input);
|
|
68
|
+
using.push({ node: s, type: source_1.Source.runSyntax(s, input) });
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
////////////////////////////
|
|
@@ -86,7 +90,36 @@ class Perform {
|
|
|
86
90
|
return;
|
|
87
91
|
}
|
|
88
92
|
input.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.FormReference, input.filename);
|
|
89
|
-
|
|
93
|
+
////////////////////////////
|
|
94
|
+
// check parameters match
|
|
95
|
+
// USING and CHANGING are interchangeable, the actual parameters form a single positional list
|
|
96
|
+
if (this.checkParameters(node, tables, found.getTablesParameters(), "TABLES", input) === false) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const formal = found.getUsingParameters().concat(found.getChangingParameters());
|
|
100
|
+
this.checkParameters(node, using.concat(changing), formal, "USING/CHANGING", input);
|
|
101
|
+
}
|
|
102
|
+
// returns false if an issue was reported
|
|
103
|
+
checkParameters(node, actual, formal, kind, input) {
|
|
104
|
+
if (actual.length !== formal.length) {
|
|
105
|
+
const message = `PERFORM, expected ${formal.length} ${kind} parameters, found ${actual.length}`;
|
|
106
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
110
|
+
for (let i = 0; i < actual.length; i++) {
|
|
111
|
+
const { node: source, type } = actual[i];
|
|
112
|
+
if (type === undefined) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const parameter = formal[i];
|
|
116
|
+
if (typeUtils.isAssignableStrict(type, parameter.getType(), source) === false) {
|
|
117
|
+
const message = `PERFORM parameter type not compatible, ${parameter.getName()}`;
|
|
118
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, source.getFirstToken(), message));
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
90
123
|
}
|
|
91
124
|
}
|
|
92
125
|
exports.Perform = Perform;
|
package/build/src/registry.js
CHANGED