@abaplint/core 2.120.11 → 2.120.12
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/abap/5_syntax/_type_utils.js +10 -0
- package/build/src/abap/5_syntax/expressions/value_body.js +5 -1
- package/build/src/abap/5_syntax/statements/write.js +5 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/no_mandt_in_database_operations.js +5 -1
- package/package.json +1 -1
|
@@ -79,6 +79,16 @@ class TypeUtils {
|
|
|
79
79
|
}
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
|
+
isCharLikeField(type) {
|
|
83
|
+
return type instanceof basic_1.CharacterType
|
|
84
|
+
|| type instanceof basic_1.NumericType
|
|
85
|
+
|| type instanceof basic_1.DateType
|
|
86
|
+
|| type instanceof basic_1.TimeType
|
|
87
|
+
|| type instanceof basic_1.CLikeType
|
|
88
|
+
|| type instanceof basic_1.AnyType
|
|
89
|
+
|| type instanceof basic_1.UnknownType
|
|
90
|
+
|| type instanceof basic_1.VoidType;
|
|
91
|
+
}
|
|
82
92
|
isCharLike(type) {
|
|
83
93
|
if (type === undefined) {
|
|
84
94
|
return false;
|
|
@@ -106,7 +106,11 @@ class ValueBody {
|
|
|
106
106
|
field_assignment_1.FieldAssignment.runSyntax(s, input, rowType);
|
|
107
107
|
}
|
|
108
108
|
for (const s of foo.findDirectExpressions(Expressions.Source)) {
|
|
109
|
-
source_1.Source.runSyntax(s, input, rowType);
|
|
109
|
+
const sourceType = source_1.Source.runSyntax(s, input, rowType);
|
|
110
|
+
if (rowType instanceof basic_1.StringType && sourceType instanceof basic_1.CharacterType) {
|
|
111
|
+
const message = "VALUE, source type CharacterType not compatible with StringType";
|
|
112
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
|
|
113
|
+
}
|
|
110
114
|
}
|
|
111
115
|
}
|
|
112
116
|
if (letScoped === true) {
|
|
@@ -68,7 +68,11 @@ class Write {
|
|
|
68
68
|
}
|
|
69
69
|
const target = node.findDirectExpression(Expressions.Target);
|
|
70
70
|
if (target) {
|
|
71
|
-
target_1.Target.runSyntax(target, input);
|
|
71
|
+
const targetType = target_1.Target.runSyntax(target, input);
|
|
72
|
+
if (new _type_utils_1.TypeUtils(input.scope).isCharLikeField(targetType) === false) {
|
|
73
|
+
const message = `"${target.getFirstToken().getStr()}" must be a character-like field (data type C, N, D, or T)`;
|
|
74
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, target.getFirstToken(), message));
|
|
75
|
+
}
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -104,7 +104,11 @@ class NoMandtInDatabaseOperations extends _abap_rule_1.ABAPRule {
|
|
|
104
104
|
}
|
|
105
105
|
findMandtInCondition(statement) {
|
|
106
106
|
for (const condition of statement.findAllExpressions(Expressions.SQLCond)) {
|
|
107
|
-
|
|
107
|
+
const fields = condition.findAllExpressionsMulti([
|
|
108
|
+
Expressions.SQLFieldName,
|
|
109
|
+
Expressions.SQLAliasField,
|
|
110
|
+
]);
|
|
111
|
+
for (const field of fields) {
|
|
108
112
|
const name = field.concatTokens().toUpperCase();
|
|
109
113
|
if (name === "MANDT" || name.endsWith("~MANDT")) {
|
|
110
114
|
return field;
|