@abaplint/core 2.105.0 → 2.105.2
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/registry.js
CHANGED
|
@@ -367,6 +367,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
367
367
|
if (found) {
|
|
368
368
|
return found;
|
|
369
369
|
}
|
|
370
|
+
found = this.assignComponent(low, high, lowFile, highSyntax);
|
|
371
|
+
if (found) {
|
|
372
|
+
return found;
|
|
373
|
+
}
|
|
370
374
|
found = this.downportRefSimple(high, lowFile, highSyntax);
|
|
371
375
|
if (found) {
|
|
372
376
|
return found;
|
|
@@ -1476,6 +1480,28 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
|
1476
1480
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
|
|
1477
1481
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN table expr", this.getMetadata().key, this.conf.severity, fix);
|
|
1478
1482
|
}
|
|
1483
|
+
assignComponent(low, high, lowFile, highSyntax) {
|
|
1484
|
+
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
1485
|
+
return undefined;
|
|
1486
|
+
}
|
|
1487
|
+
if (!(high.get() instanceof Statements.Assign)) {
|
|
1488
|
+
return undefined;
|
|
1489
|
+
}
|
|
1490
|
+
const assignSource = high.findDirectExpression(Expressions.AssignSource);
|
|
1491
|
+
if (assignSource === undefined || assignSource.getFirstToken().getStr().toUpperCase() !== "COMPONENT") {
|
|
1492
|
+
return undefined;
|
|
1493
|
+
}
|
|
1494
|
+
const componentSource = assignSource.findExpressionAfterToken("COMPONENT");
|
|
1495
|
+
if (componentSource === undefined || componentSource.get() instanceof Expressions.SimpleSource3) {
|
|
1496
|
+
return undefined;
|
|
1497
|
+
}
|
|
1498
|
+
const uniqueName = this.uniqueName(assignSource.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1499
|
+
const code = `DATA(${uniqueName}) = ${componentSource.concatTokens()}.\n`;
|
|
1500
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
1501
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, componentSource.getFirstToken().getStart(), componentSource.getLastToken().getEnd(), uniqueName);
|
|
1502
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
1503
|
+
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN COMPONENT source", this.getMetadata().key, this.conf.severity, fix);
|
|
1504
|
+
}
|
|
1479
1505
|
moveWithSimpleValue(low, high, lowFile) {
|
|
1480
1506
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
1481
1507
|
return undefined;
|
|
@@ -86,77 +86,77 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
|
|
|
86
86
|
return ret;
|
|
87
87
|
}
|
|
88
88
|
checkData(topNode, regex, file) {
|
|
89
|
-
var _a, _b, _c;
|
|
90
89
|
const ret = [];
|
|
91
90
|
for (const data of topNode.findAllStatements(Statements.Data).concat(topNode.findAllStatements(Statements.DataBegin)).concat(topNode.findAllStatements(Statements.ClassDataBegin)).concat(topNode.findAllStatements(Statements.ClassData))) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
91
|
+
const nameExpression = data.findFirstExpression(Expressions.DefinitionName)
|
|
92
|
+
|| data.findFirstExpression(Expressions.NamespaceSimpleName);
|
|
93
|
+
const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
|
|
94
|
+
if (name !== "" && nameExpression && name.match(regex)) {
|
|
95
|
+
const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
98
96
|
ret.push(issue);
|
|
99
97
|
}
|
|
100
98
|
}
|
|
101
99
|
for (const data of topNode.findAllExpressions(Expressions.InlineData)) {
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
const nameExpression = data.findFirstExpression(Expressions.TargetField);
|
|
101
|
+
const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
|
|
102
|
+
if (name !== "" && nameExpression && name.match(regex)) {
|
|
103
|
+
const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
105
104
|
ret.push(issue);
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
return ret;
|
|
109
108
|
}
|
|
110
109
|
checkStatics(topNode, regex, file) {
|
|
111
|
-
var _a;
|
|
112
110
|
const ret = [];
|
|
113
111
|
for (const data of topNode.findAllStatements(Statements.Static).concat(topNode.findAllStatements(Statements.StaticBegin))) {
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
const nameExpression = data.findFirstExpression(Expressions.DefinitionName);
|
|
113
|
+
const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
|
|
114
|
+
if (name !== "" && nameExpression && name.match(regex)) {
|
|
115
|
+
const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
117
116
|
ret.push(issue);
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
return ret;
|
|
121
120
|
}
|
|
122
121
|
checkFieldSymbols(topNode, regex, file) {
|
|
123
|
-
var _a, _b;
|
|
124
122
|
const ret = [];
|
|
125
123
|
for (const data of topNode.findAllStatements(Statements.FieldSymbol)) {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
const nameExpression = data.findFirstExpression(Expressions.FieldSymbol);
|
|
125
|
+
const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
|
|
126
|
+
if (name !== "" && nameExpression && name.match(regex)) {
|
|
127
|
+
const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
129
128
|
ret.push(issue);
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
for (const data of topNode.findAllExpressions(Expressions.InlineFS)) {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
const nameExpression = data.findFirstExpression(Expressions.FieldSymbol);
|
|
133
|
+
const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
|
|
134
|
+
if (name !== "" && nameExpression && name.match(regex)) {
|
|
135
|
+
const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
136
136
|
ret.push(issue);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
return ret;
|
|
140
140
|
}
|
|
141
141
|
checkConstants(topNode, regex, file) {
|
|
142
|
-
var _a;
|
|
143
142
|
const ret = [];
|
|
144
143
|
for (const data of topNode.findAllStatements(Statements.Constant).concat(topNode.findAllStatements(Statements.ConstantBegin))) {
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
const nameExpression = data.findFirstExpression(Expressions.DefinitionName);
|
|
145
|
+
const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
|
|
146
|
+
if (name !== "" && nameExpression && name.match(regex)) {
|
|
147
|
+
const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
148
148
|
ret.push(issue);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
return ret;
|
|
152
152
|
}
|
|
153
153
|
checkTypes(topNode, regex, file) {
|
|
154
|
-
var _a;
|
|
155
154
|
const ret = [];
|
|
156
155
|
for (const data of topNode.findAllStatements(Statements.Type).concat(topNode.findAllStatements(Statements.TypeEnum)).concat(topNode.findAllStatements(Statements.TypeEnumBegin)).concat(topNode.findAllStatements(Statements.TypeMesh)).concat(topNode.findAllStatements(Statements.TypeMeshBegin)).concat(topNode.findAllStatements(Statements.TypeBegin))) {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
const nameExpression = data.findFirstExpression(Expressions.NamespaceSimpleName);
|
|
157
|
+
const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
|
|
158
|
+
if (name !== "" && nameExpression && name.match(regex)) {
|
|
159
|
+
const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
160
160
|
ret.push(issue);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
@@ -168,7 +168,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
|
|
|
168
168
|
for (const def of method.findAllExpressions(Expressions.MethodParamName)) {
|
|
169
169
|
const name = def.concatTokens();
|
|
170
170
|
if (name !== "" && name.match(regex)) {
|
|
171
|
-
const issue = issue_1.Issue.atToken(file,
|
|
171
|
+
const issue = issue_1.Issue.atToken(file, def.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
172
172
|
ret.push(issue);
|
|
173
173
|
}
|
|
174
174
|
}
|