@abaplint/core 2.118.0 → 2.118.1
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/expressions/function_parameters.js +54 -0
- package/build/src/abap/5_syntax/statements/call_function.js +6 -13
- package/build/src/abap/5_syntax/statements/move.js +9 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/cds_association_name.js +6 -6
- package/build/src/rules/cds_field_order.js +12 -12
- package/build/src/rules/cds_naming.js +7 -7
- package/package.json +2 -2
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionParameters = void 0;
|
|
4
|
+
const Expressions = require("../../2_statements/expressions");
|
|
5
|
+
const source_1 = require("./source");
|
|
6
|
+
const target_1 = require("./target");
|
|
7
|
+
const field_chain_1 = require("./field_chain");
|
|
8
|
+
const _reference_1 = require("../_reference");
|
|
9
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
10
|
+
class FunctionParameters {
|
|
11
|
+
static runSyntax(node, input) {
|
|
12
|
+
// EXPORTING: process sources in each FunctionExportingParameter
|
|
13
|
+
for (const param of node.findAllExpressions(Expressions.FunctionExportingParameter)) {
|
|
14
|
+
const s = param.findDirectExpression(Expressions.Source);
|
|
15
|
+
if (s) {
|
|
16
|
+
source_1.Source.runSyntax(s, input);
|
|
17
|
+
}
|
|
18
|
+
const s3 = param.findDirectExpression(Expressions.SimpleSource3);
|
|
19
|
+
if (s3) {
|
|
20
|
+
source_1.Source.runSyntax(s3, input);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// IMPORTING / CHANGING / TABLES: process targets in each ParameterT
|
|
24
|
+
const changingList = node.findExpressionAfterToken("CHANGING");
|
|
25
|
+
for (const paramList of node.findDirectExpressions(Expressions.ParameterListT)) {
|
|
26
|
+
for (const param of paramList.findDirectExpressions(Expressions.ParameterT)) {
|
|
27
|
+
const t = param.findDirectExpression(Expressions.Target);
|
|
28
|
+
if (t) {
|
|
29
|
+
target_1.Target.runSyntax(t, input);
|
|
30
|
+
}
|
|
31
|
+
if (paramList === changingList && t !== undefined) {
|
|
32
|
+
// hmm, does this do the scoping correctly? handle constants etc? todo
|
|
33
|
+
const found = input.scope.findVariable(t.concatTokens());
|
|
34
|
+
if (found && found.getMeta().includes("read_only" /* IdentifierMeta.ReadOnly */)) {
|
|
35
|
+
const message = `"${t.concatTokens()}" cannot be modified, it is readonly`;
|
|
36
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, t.getFirstToken(), message));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// EXCEPTIONS: process field chains and optional MESSAGE targets
|
|
42
|
+
for (const exc of node.findAllExpressions(Expressions.ParameterException)) {
|
|
43
|
+
for (const s of exc.findDirectExpressions(Expressions.SimpleFieldChain)) {
|
|
44
|
+
field_chain_1.FieldChain.runSyntax(s, input, _reference_1.ReferenceType.DataReadReference);
|
|
45
|
+
}
|
|
46
|
+
const t = exc.findDirectExpression(Expressions.Target);
|
|
47
|
+
if (t) {
|
|
48
|
+
target_1.Target.runSyntax(t, input);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.FunctionParameters = FunctionParameters;
|
|
54
|
+
//# sourceMappingURL=function_parameters.js.map
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CallFunction = void 0;
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const source_1 = require("../expressions/source");
|
|
6
|
-
const target_1 = require("../expressions/target");
|
|
7
6
|
const field_chain_1 = require("../expressions/field_chain");
|
|
8
7
|
const _reference_1 = require("../_reference");
|
|
9
8
|
const version_1 = require("../../../version");
|
|
10
9
|
const _syntax_input_1 = require("../_syntax_input");
|
|
10
|
+
const function_parameters_1 = require("../expressions/function_parameters");
|
|
11
11
|
class CallFunction {
|
|
12
12
|
runSyntax(node, input) {
|
|
13
13
|
// todo, lots of work here, similar to receive.ts
|
|
@@ -25,22 +25,15 @@ class CallFunction {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
30
|
-
source_1.Source.runSyntax(s, input);
|
|
31
|
-
}
|
|
32
|
-
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
28
|
+
for (const s of node.findDirectExpressions(Expressions.SimpleSource2)) {
|
|
33
29
|
source_1.Source.runSyntax(s, input);
|
|
34
30
|
}
|
|
35
|
-
for (const
|
|
36
|
-
target_1.Target.runSyntax(t, input);
|
|
37
|
-
}
|
|
38
|
-
for (const s of node.findDirectExpressions(Expressions.SimpleSource2)) {
|
|
31
|
+
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
39
32
|
source_1.Source.runSyntax(s, input);
|
|
40
33
|
}
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
const fp = node.findDirectExpression(Expressions.FunctionParameters);
|
|
35
|
+
if (fp) {
|
|
36
|
+
function_parameters_1.FunctionParameters.runSyntax(fp, input);
|
|
44
37
|
}
|
|
45
38
|
}
|
|
46
39
|
}
|
|
@@ -23,6 +23,15 @@ class Move {
|
|
|
23
23
|
target_1.Target.runSyntax(t, input);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
if (inline === undefined && firstTarget !== undefined) {
|
|
27
|
+
// hmm, does this do the scoping correctly? handle constants etc? todo
|
|
28
|
+
const found = input.scope.findVariable(firstTarget.concatTokens());
|
|
29
|
+
if (found && found.getMeta().includes("read_only" /* IdentifierMeta.ReadOnly */)) {
|
|
30
|
+
const message = `"${firstTarget.concatTokens()}" cannot be modified, it is readonly`;
|
|
31
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, firstTarget.getFirstToken(), message));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
26
35
|
const source = node.findDirectExpression(Expressions.Source);
|
|
27
36
|
let sourceType = source ? source_1.Source.runSyntax(source, input, targetType) : undefined;
|
|
28
37
|
if (sourceType === undefined) {
|
package/build/src/registry.js
CHANGED
|
@@ -18,15 +18,15 @@ class CDSAssociationName {
|
|
|
18
18
|
key: "cds_association_name",
|
|
19
19
|
title: "CDS Association Name",
|
|
20
20
|
shortDescription: `CDS association names should start with an underscore`,
|
|
21
|
-
extendedInformation: `By convention, CDS association names must start with an underscore character.
|
|
22
|
-
|
|
21
|
+
extendedInformation: `By convention, CDS association names must start with an underscore character.
|
|
22
|
+
|
|
23
23
|
https://help.sap.com/docs/abap-cloud/abap-data-models/cds-associations`,
|
|
24
24
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Naming],
|
|
25
|
-
badExample: `define view entity test as select from source
|
|
26
|
-
association [1..1] to target as Assoc on Assoc.id = source.id
|
|
25
|
+
badExample: `define view entity test as select from source
|
|
26
|
+
association [1..1] to target as Assoc on Assoc.id = source.id
|
|
27
27
|
{ key id }`,
|
|
28
|
-
goodExample: `define view entity test as select from source
|
|
29
|
-
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
28
|
+
goodExample: `define view entity test as select from source
|
|
29
|
+
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
30
30
|
{ key id }`,
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -19,19 +19,19 @@ class CDSFieldOrder {
|
|
|
19
19
|
title: "CDS Field Order",
|
|
20
20
|
shortDescription: `Checks that CDS key fields are listed first and associations last in the field list`,
|
|
21
21
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
22
|
-
badExample: `define view entity test as select from source
|
|
23
|
-
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
24
|
-
{
|
|
25
|
-
field1,
|
|
26
|
-
key id,
|
|
27
|
-
_Assoc
|
|
22
|
+
badExample: `define view entity test as select from source
|
|
23
|
+
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
24
|
+
{
|
|
25
|
+
field1,
|
|
26
|
+
key id,
|
|
27
|
+
_Assoc
|
|
28
28
|
}`,
|
|
29
|
-
goodExample: `define view entity test as select from source
|
|
30
|
-
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
31
|
-
{
|
|
32
|
-
key id,
|
|
33
|
-
field1,
|
|
34
|
-
_Assoc
|
|
29
|
+
goodExample: `define view entity test as select from source
|
|
30
|
+
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
31
|
+
{
|
|
32
|
+
key id,
|
|
33
|
+
field1,
|
|
34
|
+
_Assoc
|
|
35
35
|
}`,
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -44,13 +44,13 @@ class CDSNaming {
|
|
|
44
44
|
key: "cds_naming",
|
|
45
45
|
title: "CDS Naming",
|
|
46
46
|
shortDescription: `Checks CDS naming conventions based on the VDM prefix rules`,
|
|
47
|
-
extendedInformation: `Validates that CDS entity names follow the expected prefix conventions:
|
|
48
|
-
I_ for interface views, C_ for consumption views, R_ for restricted reuse views,
|
|
49
|
-
P_ for private views, A_ for remote API views, X_ for view extends,
|
|
50
|
-
E_ for extension include views, F_ for derivation functions, D_ for abstract entities.
|
|
51
|
-
|
|
52
|
-
Names must also start with Z after the prefix (custom namespace).
|
|
53
|
-
|
|
47
|
+
extendedInformation: `Validates that CDS entity names follow the expected prefix conventions:
|
|
48
|
+
I_ for interface views, C_ for consumption views, R_ for restricted reuse views,
|
|
49
|
+
P_ for private views, A_ for remote API views, X_ for view extends,
|
|
50
|
+
E_ for extension include views, F_ for derivation functions, D_ for abstract entities.
|
|
51
|
+
|
|
52
|
+
Names must also start with Z after the prefix (custom namespace).
|
|
53
|
+
|
|
54
54
|
https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee6ff9b281d8448f96b4fe6c89f2bdc8/8a8cee943ef944fe8936f4cc60ba9bc1.html`,
|
|
55
55
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Naming],
|
|
56
56
|
badExample: `define view entity ZMY_VIEW as select from source { key id }`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.118.
|
|
3
|
+
"version": "2.118.1",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"fast-xml-parser": "^5.5.
|
|
66
|
+
"fast-xml-parser": "^5.5.8",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"vscode-languageserver-types": "^3.17.5"
|
|
69
69
|
}
|