@abaplint/core 2.85.13 → 2.85.17
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 +3 -1
- package/build/src/abap/2_statements/statements/raise.js +1 -1
- package/build/src/abap/5_syntax/_builtin.js +8 -8
- package/build/src/abap/5_syntax/_scope_type.js +1 -0
- package/build/src/abap/5_syntax/_type_utils.js +7 -4
- package/build/src/abap/5_syntax/basic_types.js +2 -1
- package/build/src/abap/5_syntax/expressions/cond_body.js +5 -1
- package/build/src/abap/5_syntax/expressions/conv_body.js +5 -1
- package/build/src/abap/5_syntax/expressions/for.js +4 -4
- package/build/src/abap/5_syntax/expressions/inline_field_definition.js +8 -3
- package/build/src/abap/5_syntax/expressions/let.js +4 -1
- package/build/src/abap/5_syntax/expressions/method_call_param.js +0 -1
- package/build/src/abap/5_syntax/expressions/method_parameters.js +13 -15
- package/build/src/abap/5_syntax/expressions/value_body.js +8 -4
- package/build/src/objects/domain.js +2 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/constant_classes.js +3 -3
- package/build/src/rules/downport.js +8 -5
- package/build/src/rules/superclass_final.js +6 -2
- package/build/src/rules/use_new.js +3 -1
- package/package.json +2 -2
package/build/abaplint.d.ts
CHANGED
|
@@ -1480,7 +1480,8 @@ declare class Domain extends AbstractObject {
|
|
|
1480
1480
|
|
|
1481
1481
|
declare interface DomainValue {
|
|
1482
1482
|
language: string;
|
|
1483
|
-
|
|
1483
|
+
low: string;
|
|
1484
|
+
high: string;
|
|
1484
1485
|
description: string;
|
|
1485
1486
|
}
|
|
1486
1487
|
|
|
@@ -4546,6 +4547,7 @@ export declare enum ScopeType {
|
|
|
4546
4547
|
Method = "method",
|
|
4547
4548
|
MethodInstance = "method_instance",
|
|
4548
4549
|
For = "for",
|
|
4550
|
+
Let = "let",
|
|
4549
4551
|
OpenSQL = "open_sql"
|
|
4550
4552
|
}
|
|
4551
4553
|
|
|
@@ -11,7 +11,7 @@ class Raise {
|
|
|
11
11
|
const exporting = (0, combi_1.seq)("EXPORTING", expressions_1.ParameterListS);
|
|
12
12
|
const from = (0, combi_1.seq)("TYPE", expressions_1.ClassName, (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.alt)(mess, messid)), (0, combi_1.ver)(version_1.Version.v752, "USING MESSAGE"))), (0, combi_1.optPrio)(exporting));
|
|
13
13
|
const clas = (0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION", (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source), expressions_1.SimpleSource2));
|
|
14
|
-
const ret = (0, combi_1.seq)("RAISE", (0, combi_1.altPrio)(clas, expressions_1.
|
|
14
|
+
const ret = (0, combi_1.seq)("RAISE", (0, combi_1.altPrio)(clas, expressions_1.ExceptionName));
|
|
15
15
|
return ret;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -42,7 +42,7 @@ class BuiltInMethod extends _identifier_1.Identifier {
|
|
|
42
42
|
}
|
|
43
43
|
const keys = Object.keys(this.method.mandatory);
|
|
44
44
|
if (keys.length === 1) {
|
|
45
|
-
return keys[0];
|
|
45
|
+
return keys[0].toUpperCase();
|
|
46
46
|
}
|
|
47
47
|
return undefined;
|
|
48
48
|
}
|
|
@@ -651,7 +651,7 @@ BuiltIn.methods = [
|
|
|
651
651
|
{
|
|
652
652
|
name: "LINE_EXISTS",
|
|
653
653
|
mandatory: {
|
|
654
|
-
"val": new basic_1.
|
|
654
|
+
"val": new basic_1.AnyType(),
|
|
655
655
|
},
|
|
656
656
|
return: new basic_1.CharacterType(1),
|
|
657
657
|
version: version_1.Version.v740sp02,
|
|
@@ -887,14 +887,14 @@ BuiltIn.methods = [
|
|
|
887
887
|
{
|
|
888
888
|
name: "STRLEN",
|
|
889
889
|
mandatory: {
|
|
890
|
-
"val": new basic_1.
|
|
890
|
+
"val": new basic_1.CLikeType(),
|
|
891
891
|
},
|
|
892
892
|
return: new basic_1.IntegerType(),
|
|
893
893
|
},
|
|
894
894
|
{
|
|
895
895
|
name: "SUBSTRING",
|
|
896
896
|
mandatory: {
|
|
897
|
-
"val": new basic_1.
|
|
897
|
+
"val": new basic_1.CLikeType(),
|
|
898
898
|
},
|
|
899
899
|
optional: {
|
|
900
900
|
"off": new basic_1.IntegerType(),
|
|
@@ -906,7 +906,7 @@ BuiltIn.methods = [
|
|
|
906
906
|
{
|
|
907
907
|
name: "SUBSTRING_AFTER",
|
|
908
908
|
mandatory: {
|
|
909
|
-
"val": new basic_1.
|
|
909
|
+
"val": new basic_1.CLikeType(),
|
|
910
910
|
},
|
|
911
911
|
optional: {
|
|
912
912
|
"sub": new basic_1.StringType(),
|
|
@@ -922,7 +922,7 @@ BuiltIn.methods = [
|
|
|
922
922
|
{
|
|
923
923
|
name: "SUBSTRING_BEFORE",
|
|
924
924
|
mandatory: {
|
|
925
|
-
"val": new basic_1.
|
|
925
|
+
"val": new basic_1.CLikeType(),
|
|
926
926
|
},
|
|
927
927
|
optional: {
|
|
928
928
|
"sub": new basic_1.StringType(),
|
|
@@ -938,7 +938,7 @@ BuiltIn.methods = [
|
|
|
938
938
|
{
|
|
939
939
|
name: "SUBSTRING_FROM",
|
|
940
940
|
mandatory: {
|
|
941
|
-
"val": new basic_1.
|
|
941
|
+
"val": new basic_1.CLikeType(),
|
|
942
942
|
},
|
|
943
943
|
optional: {
|
|
944
944
|
"sub": new basic_1.StringType(),
|
|
@@ -954,7 +954,7 @@ BuiltIn.methods = [
|
|
|
954
954
|
{
|
|
955
955
|
name: "SUBSTRING_TO",
|
|
956
956
|
mandatory: {
|
|
957
|
-
"val": new basic_1.
|
|
957
|
+
"val": new basic_1.CLikeType(),
|
|
958
958
|
},
|
|
959
959
|
optional: {
|
|
960
960
|
"sub": new basic_1.StringType(),
|
|
@@ -17,6 +17,7 @@ var ScopeType;
|
|
|
17
17
|
ScopeType["Method"] = "method";
|
|
18
18
|
ScopeType["MethodInstance"] = "method_instance";
|
|
19
19
|
ScopeType["For"] = "for";
|
|
20
|
+
ScopeType["Let"] = "let";
|
|
20
21
|
ScopeType["OpenSQL"] = "open_sql";
|
|
21
22
|
})(ScopeType = exports.ScopeType || (exports.ScopeType = {}));
|
|
22
23
|
//# sourceMappingURL=_scope_type.js.map
|
|
@@ -78,7 +78,8 @@ class TypeUtils {
|
|
|
78
78
|
}
|
|
79
79
|
return false;
|
|
80
80
|
}
|
|
81
|
-
else if (target instanceof basic_1.ObjectReferenceType
|
|
81
|
+
else if (target instanceof basic_1.ObjectReferenceType
|
|
82
|
+
|| target instanceof basic_1.GenericObjectReferenceType) {
|
|
82
83
|
if (source instanceof basic_1.ObjectReferenceType
|
|
83
84
|
|| source instanceof basic_1.GenericObjectReferenceType
|
|
84
85
|
|| source instanceof basic_1.VoidType
|
|
@@ -120,10 +121,12 @@ class TypeUtils {
|
|
|
120
121
|
}
|
|
121
122
|
else if (target instanceof basic_1.IntegerType
|
|
122
123
|
|| target instanceof basic_1.StringType) {
|
|
123
|
-
if (source instanceof basic_1.
|
|
124
|
+
if (source instanceof basic_1.TableType && source.isWithHeader() === false) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
else if (source instanceof basic_1.DataReference
|
|
124
128
|
|| source instanceof basic_1.ObjectReferenceType
|
|
125
|
-
|| source instanceof basic_1.GenericObjectReferenceType
|
|
126
|
-
|| source instanceof basic_1.TableType) {
|
|
129
|
+
|| source instanceof basic_1.GenericObjectReferenceType) {
|
|
127
130
|
return false;
|
|
128
131
|
}
|
|
129
132
|
return true;
|
|
@@ -515,7 +515,8 @@ class BasicTypes {
|
|
|
515
515
|
}
|
|
516
516
|
subs.shift();
|
|
517
517
|
while (subs.length > 0) {
|
|
518
|
-
if (foundType instanceof Types.UnknownType
|
|
518
|
+
if (foundType instanceof Types.UnknownType
|
|
519
|
+
|| foundType instanceof Types.VoidType) {
|
|
519
520
|
return foundType;
|
|
520
521
|
}
|
|
521
522
|
else if (!(foundType instanceof Types.StructureType)) {
|
|
@@ -10,9 +10,10 @@ class CondBody {
|
|
|
10
10
|
if (node === undefined) {
|
|
11
11
|
return targetType;
|
|
12
12
|
}
|
|
13
|
+
let scoped = false;
|
|
13
14
|
const l = node.findDirectExpression(Expressions.Let);
|
|
14
15
|
if (l) {
|
|
15
|
-
new let_1.Let().runSyntax(l, scope, filename);
|
|
16
|
+
scoped = new let_1.Let().runSyntax(l, scope, filename);
|
|
16
17
|
}
|
|
17
18
|
for (const s of node.findDirectExpressions(Expressions.Cond)) {
|
|
18
19
|
new cond_1.Cond().runSyntax(s, scope, filename);
|
|
@@ -26,6 +27,9 @@ class CondBody {
|
|
|
26
27
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
27
28
|
}
|
|
28
29
|
}
|
|
30
|
+
if (scoped === true) {
|
|
31
|
+
scope.pop(node.getLastToken().getEnd());
|
|
32
|
+
}
|
|
29
33
|
return targetType ? targetType : type;
|
|
30
34
|
}
|
|
31
35
|
}
|
|
@@ -9,13 +9,17 @@ class ConvBody {
|
|
|
9
9
|
if (node === undefined) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
+
let scoped = false;
|
|
12
13
|
const l = node.findDirectExpression(Expressions.Let);
|
|
13
14
|
if (l) {
|
|
14
|
-
new let_1.Let().runSyntax(l, scope, filename);
|
|
15
|
+
scoped = new let_1.Let().runSyntax(l, scope, filename);
|
|
15
16
|
}
|
|
16
17
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
17
18
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
18
19
|
}
|
|
20
|
+
if (scoped === true) {
|
|
21
|
+
scope.pop(node.getLastToken().getEnd());
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
25
|
exports.ConvBody = ConvBody;
|
|
@@ -7,12 +7,14 @@ const source_1 = require("./source");
|
|
|
7
7
|
const inline_loop_definition_1 = require("./inline_loop_definition");
|
|
8
8
|
const _scope_type_1 = require("../_scope_type");
|
|
9
9
|
const component_cond_1 = require("./component_cond");
|
|
10
|
+
const cond_1 = require("./cond");
|
|
10
11
|
class For {
|
|
11
12
|
runSyntax(node, scope, filename) {
|
|
12
13
|
const inlineLoop = node.findDirectExpressions(Expressions.InlineLoopDefinition);
|
|
13
14
|
const inlineField = node.findAllExpressions(Expressions.InlineFieldDefinition);
|
|
14
15
|
const addScope = inlineLoop.length > 0 || inlineField.length > 0;
|
|
15
16
|
if (addScope) {
|
|
17
|
+
// this scope is popped in parent expressions
|
|
16
18
|
scope.push(_scope_type_1.ScopeType.For, "FOR", node.getFirstToken().getStart(), filename);
|
|
17
19
|
}
|
|
18
20
|
for (const s of inlineLoop) {
|
|
@@ -27,11 +29,9 @@ class For {
|
|
|
27
29
|
for (const s of node.findDirectExpressions(Expressions.ComponentCond)) {
|
|
28
30
|
new component_cond_1.ComponentCond().runSyntax(s, scope, filename);
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
scope.pop(node.getLastToken().getEnd());
|
|
32
|
+
for (const s of node.findDirectExpressions(Expressions.Cond)) {
|
|
33
|
+
new cond_1.Cond().runSyntax(s, scope, filename);
|
|
33
34
|
}
|
|
34
|
-
*/
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
exports.For = For;
|
|
@@ -9,8 +9,9 @@ const unknown_type_1 = require("../../types/basic/unknown_type");
|
|
|
9
9
|
const _reference_1 = require("../_reference");
|
|
10
10
|
class InlineFieldDefinition {
|
|
11
11
|
runSyntax(node, scope, filename) {
|
|
12
|
+
var _a;
|
|
12
13
|
let type = undefined;
|
|
13
|
-
const field = node.findDirectExpression(Expressions.Field);
|
|
14
|
+
const field = (_a = node.findDirectExpression(Expressions.Field)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
14
15
|
if (field === undefined) {
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
@@ -25,8 +26,12 @@ class InlineFieldDefinition {
|
|
|
25
26
|
if (type === undefined) {
|
|
26
27
|
type = new unknown_type_1.UnknownType("InlineFieldDefinition, fallback");
|
|
27
28
|
}
|
|
28
|
-
const
|
|
29
|
-
scope.
|
|
29
|
+
const name = field.getStr();
|
|
30
|
+
if (scope.findVariable(name) !== undefined) {
|
|
31
|
+
throw new Error(`Variable ${name} already defined`);
|
|
32
|
+
}
|
|
33
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(field, filename, type, ["inline" /* InlineDefinition */]);
|
|
34
|
+
scope.addReference(field, identifier, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
30
35
|
scope.addIdentifier(identifier);
|
|
31
36
|
}
|
|
32
37
|
}
|
|
@@ -3,14 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Let = void 0;
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const inline_field_definition_1 = require("./inline_field_definition");
|
|
6
|
+
const _scope_type_1 = require("../_scope_type");
|
|
6
7
|
class Let {
|
|
7
8
|
runSyntax(node, scope, filename) {
|
|
8
9
|
if (node === undefined) {
|
|
9
|
-
return;
|
|
10
|
+
return false;
|
|
10
11
|
}
|
|
12
|
+
scope.push(_scope_type_1.ScopeType.Let, "LET", node.getFirstToken().getStart(), filename);
|
|
11
13
|
for (const f of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {
|
|
12
14
|
new inline_field_definition_1.InlineFieldDefinition().runSyntax(f, scope, filename);
|
|
13
15
|
}
|
|
16
|
+
return true;
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
exports.Let = Let;
|
|
@@ -25,7 +25,6 @@ class MethodCallParam {
|
|
|
25
25
|
throw new Error("Parameter \"" + required[0].getName() + "\" must be supplied");
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
return;
|
|
29
28
|
}
|
|
30
29
|
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.Source) {
|
|
31
30
|
if (!(method instanceof basic_1.VoidType) && method.getParameters().getImporting().length === 0) {
|
|
@@ -7,6 +7,7 @@ const nodes_1 = require("../../nodes");
|
|
|
7
7
|
const inline_data_1 = require("./inline_data");
|
|
8
8
|
const target_1 = require("./target");
|
|
9
9
|
const source_1 = require("./source");
|
|
10
|
+
const _type_utils_1 = require("../_type_utils");
|
|
10
11
|
class MethodParameters {
|
|
11
12
|
constructor() {
|
|
12
13
|
this.requiredParameters = undefined;
|
|
@@ -63,7 +64,10 @@ class MethodParameters {
|
|
|
63
64
|
new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);
|
|
64
65
|
}
|
|
65
66
|
else if (target) {
|
|
66
|
-
new target_1.Target().runSyntax(target, scope, filename);
|
|
67
|
+
const targetType = new target_1.Target().runSyntax(target, scope, filename);
|
|
68
|
+
if (targetType && _type_utils_1.TypeUtils.isAssignable(type, targetType) === false) {
|
|
69
|
+
throw new Error("Method returning value not type compatible");
|
|
70
|
+
}
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
checkImporting(node, scope, method, filename) {
|
|
@@ -86,8 +90,8 @@ class MethodParameters {
|
|
|
86
90
|
else if (item.targetType === undefined) {
|
|
87
91
|
throw new Error("Could not determine target type");
|
|
88
92
|
}
|
|
89
|
-
else if (item.targetType) {
|
|
90
|
-
|
|
93
|
+
else if (item.targetType && _type_utils_1.TypeUtils.isAssignable(parameterType, item.targetType) === false) {
|
|
94
|
+
throw new Error("Method parameter type not compatible, " + item.name);
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
}
|
|
@@ -105,34 +109,28 @@ class MethodParameters {
|
|
|
105
109
|
}
|
|
106
110
|
parameterType = parameter.getType();
|
|
107
111
|
}
|
|
108
|
-
if (item.targetType) {
|
|
109
|
-
|
|
110
|
-
if (0) {
|
|
111
|
-
console.log(parameterType); // todo
|
|
112
|
-
}
|
|
112
|
+
if (item.targetType && _type_utils_1.TypeUtils.isAssignable(parameterType, item.targetType) === false) {
|
|
113
|
+
throw new Error("Method parameter type not compatible, " + item.name);
|
|
113
114
|
}
|
|
114
115
|
(_a = this.requiredParameters) === null || _a === void 0 ? void 0 : _a.delete(item.name);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
checkExporting(node, scope, method, filename, errors = true) {
|
|
119
|
+
const items = this.parameterListS(node, scope, filename, method);
|
|
118
120
|
if (method instanceof basic_1.VoidType) {
|
|
119
|
-
this.parameterListS(node, scope, filename, method);
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
123
|
const allImporting = method.getParameters().getImporting();
|
|
123
124
|
if (this.requiredParameters === undefined) {
|
|
124
125
|
this.requiredParameters = new Set(method.getParameters().getRequiredParameters().map(i => i.getName().toUpperCase()));
|
|
125
126
|
}
|
|
126
|
-
for (const item of
|
|
127
|
-
let parameterType = undefined;
|
|
127
|
+
for (const item of items) {
|
|
128
128
|
const parameter = allImporting.find(p => p.getName().toUpperCase() === item.name);
|
|
129
129
|
if (parameter === undefined) {
|
|
130
130
|
throw new Error("Method importing parameter \"" + item.name + "\" does not exist");
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (0) {
|
|
135
|
-
console.log(parameterType); // todo
|
|
132
|
+
else if (_type_utils_1.TypeUtils.isAssignable(parameter.getType(), item.sourceType) === false) {
|
|
133
|
+
throw new Error("Method parameter type not compatible, " + item.name);
|
|
136
134
|
}
|
|
137
135
|
this.requiredParameters.delete(item.name);
|
|
138
136
|
}
|
|
@@ -12,14 +12,15 @@ class ValueBody {
|
|
|
12
12
|
if (node === undefined) {
|
|
13
13
|
return targetType;
|
|
14
14
|
}
|
|
15
|
-
const letNode = node.findDirectExpression(Expressions.Let);
|
|
16
|
-
if (letNode) {
|
|
17
|
-
new let_1.Let().runSyntax(letNode, scope, filename);
|
|
18
|
-
}
|
|
19
15
|
const forNode = node.findDirectExpression(Expressions.For);
|
|
20
16
|
if (forNode) {
|
|
21
17
|
new for_1.For().runSyntax(forNode, scope, filename);
|
|
22
18
|
}
|
|
19
|
+
let scoped = false;
|
|
20
|
+
const letNode = node.findDirectExpression(Expressions.Let);
|
|
21
|
+
if (letNode) {
|
|
22
|
+
scoped = new let_1.Let().runSyntax(letNode, scope, filename);
|
|
23
|
+
}
|
|
23
24
|
for (const s of node.findDirectExpressions(Expressions.FieldAssignment)) {
|
|
24
25
|
new field_assignment_1.FieldAssignment().runSyntax(s, scope, filename, targetType);
|
|
25
26
|
}
|
|
@@ -27,6 +28,9 @@ class ValueBody {
|
|
|
27
28
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
28
29
|
type = new source_1.Source().runSyntax(s, scope, filename);
|
|
29
30
|
}
|
|
31
|
+
if (scoped === true) {
|
|
32
|
+
scope.pop(node.getLastToken().getEnd());
|
|
33
|
+
}
|
|
30
34
|
if (scope.getType() === _scope_type_1.ScopeType.For) {
|
|
31
35
|
scope.pop(node.getLastToken().getEnd());
|
|
32
36
|
}
|
|
@@ -52,7 +52,8 @@ class Domain extends _abstract_object_1.AbstractObject {
|
|
|
52
52
|
for (const ddo7v of dd07v_tab) {
|
|
53
53
|
const value = {
|
|
54
54
|
description: ddo7v === null || ddo7v === void 0 ? void 0 : ddo7v.DDTEXT,
|
|
55
|
-
|
|
55
|
+
low: ddo7v === null || ddo7v === void 0 ? void 0 : ddo7v.DOMVALUE_L,
|
|
56
|
+
high: ddo7v === null || ddo7v === void 0 ? void 0 : ddo7v.DOMVALUE_H,
|
|
56
57
|
language: ddo7v === null || ddo7v === void 0 ? void 0 : ddo7v.DDLANGUAGE,
|
|
57
58
|
};
|
|
58
59
|
values.push(value);
|
package/build/src/registry.js
CHANGED
|
@@ -61,7 +61,7 @@ class ConstantClasses {
|
|
|
61
61
|
return [];
|
|
62
62
|
}
|
|
63
63
|
const domainValueInfo = obj.getFixedValues();
|
|
64
|
-
const domainValues = domainValueInfo.map(x => x.
|
|
64
|
+
const domainValues = domainValueInfo.map(x => x.low);
|
|
65
65
|
const issues = [];
|
|
66
66
|
if (obj.getFixedValues().length === 0) {
|
|
67
67
|
// possibly this is not even a domain with fixed values
|
|
@@ -94,8 +94,8 @@ class ConstantClasses {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
for (const d of domainValueInfo) {
|
|
97
|
-
if (!def.constants.find(c => c.value === d.
|
|
98
|
-
issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Missing constant for ${d.
|
|
97
|
+
if (!def.constants.find(c => c.value === d.low)) {
|
|
98
|
+
issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Missing constant for ${d.low} (domain ${configEntry.domain})`, this.getMetadata().key, this.conf.severity));
|
|
99
99
|
// quickfix will add constant
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -913,7 +913,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
913
913
|
const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
914
914
|
const type = this.findType(i, lowFile, highSyntax);
|
|
915
915
|
const indent = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
916
|
-
const bodyCode = this.buildCondBody(body, uniqueName, indent);
|
|
916
|
+
const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);
|
|
917
917
|
const abap = `DATA ${uniqueName} TYPE ${type}.\n` + bodyCode;
|
|
918
918
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);
|
|
919
919
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);
|
|
@@ -922,13 +922,13 @@ ${indentation} output = ${topTarget}.`;
|
|
|
922
922
|
}
|
|
923
923
|
return undefined;
|
|
924
924
|
}
|
|
925
|
-
buildCondBody(body, uniqueName, indent) {
|
|
926
|
-
let code =
|
|
925
|
+
buildCondBody(body, uniqueName, indent, lowFile, highSyntax) {
|
|
926
|
+
let code = "";
|
|
927
927
|
for (const c of body.getChildren()) {
|
|
928
928
|
if (c instanceof nodes_1.TokenNode) {
|
|
929
929
|
switch (c.getFirstToken().getStr().toUpperCase()) {
|
|
930
930
|
case "WHEN":
|
|
931
|
-
code += "IF ";
|
|
931
|
+
code += indent + "IF ";
|
|
932
932
|
break;
|
|
933
933
|
case "THEN":
|
|
934
934
|
code += ".\n";
|
|
@@ -943,11 +943,14 @@ ${indentation} output = ${topTarget}.`;
|
|
|
943
943
|
else if (c.get() instanceof Expressions.Cond) {
|
|
944
944
|
code += c.concatTokens();
|
|
945
945
|
}
|
|
946
|
+
else if (c.get() instanceof Expressions.Let) {
|
|
947
|
+
code += this.outlineLet(c, indent, highSyntax, lowFile);
|
|
948
|
+
}
|
|
946
949
|
else if (c.get() instanceof Expressions.Source) {
|
|
947
950
|
code += indent + " " + uniqueName + " = " + c.concatTokens() + ".\n";
|
|
948
951
|
}
|
|
949
952
|
else {
|
|
950
|
-
throw "buildCondBody, unexpected expression";
|
|
953
|
+
throw "buildCondBody, unexpected expression, " + c.get().constructor.name;
|
|
951
954
|
}
|
|
952
955
|
}
|
|
953
956
|
code += indent + "ENDIF.\n";
|
|
@@ -44,8 +44,12 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
|
|
|
44
44
|
}
|
|
45
45
|
let found = undefined;
|
|
46
46
|
if (localLookup) {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
for (const f of obj.getABAPFiles()) {
|
|
48
|
+
found = f.getInfo().getClassDefinitionByName(sup);
|
|
49
|
+
if (found !== undefined) {
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
49
53
|
}
|
|
50
54
|
if (found === undefined) {
|
|
51
55
|
const clas = this.reg.getObject("CLAS", sup);
|
|
@@ -25,7 +25,9 @@ class UseNew extends _abap_rule_1.ABAPRule {
|
|
|
25
25
|
shortDescription: `Checks for deprecated CREATE OBJECT statements.`,
|
|
26
26
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-new-to-create-object
|
|
27
27
|
|
|
28
|
-
If the target variable is referenced in the CREATE OBJECT statement, no errors are issued
|
|
28
|
+
If the target variable is referenced in the CREATE OBJECT statement, no errors are issued
|
|
29
|
+
|
|
30
|
+
Applicable from v740sp02 and up`,
|
|
29
31
|
badExample: `CREATE OBJECT ref.`,
|
|
30
32
|
goodExample: `ref = NEW #( ).`,
|
|
31
33
|
tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.85.
|
|
3
|
+
"version": "2.85.17",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@microsoft/api-extractor": "^7.19.4",
|
|
49
49
|
"@types/chai": "^4.3.0",
|
|
50
50
|
"@types/mocha": "^9.1.0",
|
|
51
|
-
"@types/node": "^17.0.
|
|
51
|
+
"@types/node": "^17.0.17",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
53
|
"eslint": "^8.8.0",
|
|
54
54
|
"mocha": "^9.2.0",
|