@abaplint/core 2.120.33 → 2.120.34
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/_object_oriented.js +5 -0
- package/build/src/abap/5_syntax/_type_utils.js +7 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/cds_field_order.js +2 -1
- package/build/src/rules/cds_naming.js +1 -9
- package/build/src/rules/no_dynamic_stuff.js +7 -12
- package/build/src/stuff.js +4 -0
- package/package.json +1 -1
|
@@ -204,6 +204,11 @@ class ObjectOriented {
|
|
|
204
204
|
if (found) {
|
|
205
205
|
return found;
|
|
206
206
|
}
|
|
207
|
+
if (name.includes("~")) {
|
|
208
|
+
// event of an implemented interface, ie. "if_name~event_name"
|
|
209
|
+
const [interfaceName, eventName] = name.split("~");
|
|
210
|
+
return this.searchEvent(this.scope.findInterfaceDefinition(interfaceName), eventName);
|
|
211
|
+
}
|
|
207
212
|
for (const a of def.getAliases() || []) {
|
|
208
213
|
if (a.getName().toUpperCase() === name.toUpperCase()) {
|
|
209
214
|
const comp = a.getComponent();
|
|
@@ -454,6 +454,11 @@ class TypeUtils {
|
|
|
454
454
|
}
|
|
455
455
|
return false;
|
|
456
456
|
}
|
|
457
|
+
else if (target instanceof basic_1.TableType
|
|
458
|
+
|| target instanceof basic_1.DataReference
|
|
459
|
+
|| target instanceof basic_1.ObjectReferenceType) {
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
457
462
|
return true;
|
|
458
463
|
}
|
|
459
464
|
else if (source instanceof basic_1.StructureType) {
|
|
@@ -478,7 +483,8 @@ class TypeUtils {
|
|
|
478
483
|
}
|
|
479
484
|
else if (target instanceof basic_1.VoidType
|
|
480
485
|
|| target instanceof basic_1.AnyType
|
|
481
|
-
|| target instanceof basic_1.DataType
|
|
486
|
+
|| target instanceof basic_1.DataType
|
|
487
|
+
|| target instanceof basic_1.UnknownType) {
|
|
482
488
|
return true;
|
|
483
489
|
}
|
|
484
490
|
return false;
|
package/build/src/registry.js
CHANGED
|
@@ -88,7 +88,8 @@ class CDSFieldOrder {
|
|
|
88
88
|
}
|
|
89
89
|
getAssociationNames(tree) {
|
|
90
90
|
const names = new Set();
|
|
91
|
-
|
|
91
|
+
const found = [...tree.findAllExpressions(expressions_1.CDSAssociation), ...tree.findAllExpressions(expressions_1.CDSComposition)];
|
|
92
|
+
for (const assoc of found) {
|
|
92
93
|
const relation = assoc.findDirectExpression(expressions_1.CDSRelation);
|
|
93
94
|
if (relation === undefined) {
|
|
94
95
|
continue;
|
|
@@ -6,7 +6,6 @@ const _irule_1 = require("./_irule");
|
|
|
6
6
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
7
7
|
const objects_1 = require("../objects");
|
|
8
8
|
const expressions_1 = require("../cds/expressions");
|
|
9
|
-
const cds_name_1 = require("../cds/expressions/cds_name");
|
|
10
9
|
class CDSNamingConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
11
10
|
constructor() {
|
|
12
11
|
super(...arguments);
|
|
@@ -78,7 +77,7 @@ https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee6ff9b281d8448f96b4fe6c89f2bdc8
|
|
|
78
77
|
if (file === undefined) {
|
|
79
78
|
return [];
|
|
80
79
|
}
|
|
81
|
-
const name =
|
|
80
|
+
const name = o.getDefinitionName();
|
|
82
81
|
if (name === undefined) {
|
|
83
82
|
return [];
|
|
84
83
|
}
|
|
@@ -95,13 +94,6 @@ https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee6ff9b281d8448f96b4fe6c89f2bdc8
|
|
|
95
94
|
}
|
|
96
95
|
return [];
|
|
97
96
|
}
|
|
98
|
-
getCDSName(tree) {
|
|
99
|
-
const nameNodes = tree.findDirectExpressions(cds_name_1.CDSName);
|
|
100
|
-
if (nameNodes.length > 0) {
|
|
101
|
-
return nameNodes[0].getFirstToken().getStr();
|
|
102
|
-
}
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
97
|
getAllowedPrefixes(tree) {
|
|
106
98
|
const root = tree.get();
|
|
107
99
|
if (root instanceof expressions_1.CDSExtendView) {
|
|
@@ -85,17 +85,19 @@ class NoDynamicStuff extends _abap_rule_1.ABAPRule {
|
|
|
85
85
|
extendedInformation: `Dynamic constructs cannot be checked statically, they are not found by
|
|
86
86
|
where-used lists and refactorings, and they can introduce injection vulnerabilities.
|
|
87
87
|
|
|
88
|
-
Dynamic tokens containing a literal, eg. CALL METHOD ('
|
|
89
|
-
|
|
88
|
+
Dynamic tokens are also reported when containing a literal, eg. CALL METHOD go_calendar->('RESET_DAY_INFO'),
|
|
89
|
+
the syntax check does not resolve these either, so they behave like any other dynamic token.
|
|
90
90
|
|
|
91
91
|
Dynamic SQL is reported by rule dangerous_statement.`,
|
|
92
92
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
|
|
93
93
|
badExample: `CALL METHOD (lv_class)=>(lv_method).
|
|
94
|
+
CALL METHOD go_calendar->('RESET_DAY_INFO').
|
|
94
95
|
CALL FUNCTION lv_function_module.
|
|
95
96
|
CREATE OBJECT ref TYPE (lv_class).
|
|
96
97
|
ASSIGN (lv_name) TO <fs>.
|
|
97
98
|
SORT tab BY (lv_field).`,
|
|
98
99
|
goodExample: `cl_class=>method( ).
|
|
100
|
+
go_calendar->reset_day_info( ).
|
|
99
101
|
CALL FUNCTION 'ZFOO'.
|
|
100
102
|
CREATE OBJECT ref TYPE cl_class.
|
|
101
103
|
ASSIGN foo TO <fs>.
|
|
@@ -207,10 +209,8 @@ SORT tab BY field.`,
|
|
|
207
209
|
for (const source of node.findAllExpressions(Expressions.MethodSource)) {
|
|
208
210
|
// Dynamic is always a direct child of MethodSource, dynamics further down
|
|
209
211
|
// are parameters of the method call and not part of the method name
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
212
|
+
if (source.findDirectExpression(Expressions.Dynamic) !== undefined) {
|
|
213
|
+
return true;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
return false;
|
|
@@ -221,12 +221,7 @@ SORT tab BY field.`,
|
|
|
221
221
|
return component !== undefined && this.isLiteral(component) === false;
|
|
222
222
|
}
|
|
223
223
|
hasDynamic(node) {
|
|
224
|
-
|
|
225
|
-
if (this.isLiteral(dynamic) === false) {
|
|
226
|
-
return true;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return false;
|
|
224
|
+
return node.findFirstExpression(Expressions.Dynamic) !== undefined;
|
|
230
225
|
}
|
|
231
226
|
notLiteral(node) {
|
|
232
227
|
return node !== undefined && this.isLiteral(node) === false;
|
package/build/src/stuff.js
CHANGED
|
@@ -56,6 +56,10 @@ exports.DECLARATION_STUFF = [
|
|
|
56
56
|
Statements.DataBegin,
|
|
57
57
|
Statements.Constant,
|
|
58
58
|
Statements.ConstantBegin,
|
|
59
|
+
Statements.Static,
|
|
60
|
+
Statements.StaticBegin,
|
|
61
|
+
Statements.FieldSymbol,
|
|
62
|
+
Statements.Ranges,
|
|
59
63
|
Statements.Tables,
|
|
60
64
|
Statements.Include, // this is not super correct, but anyhow
|
|
61
65
|
Statements.Parameter,
|