@abaplint/core 2.93.61 → 2.93.62
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 +7 -2
- package/build/src/abap/2_statements/statements/method_def.js +2 -1
- package/build/src/abap/5_syntax/basic_types.js +16 -0
- package/build/src/abap/types/method_parameters.js +5 -0
- package/build/src/cds/cds_parser.js +3 -0
- package/build/src/cds/expressions/cds_define_custom.js +15 -0
- package/build/src/cds/expressions/cds_relation.js +2 -1
- package/build/src/cds/expressions/index.js +1 -0
- package/build/src/registry.js +1 -1
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -646,6 +646,10 @@ declare class CDSDefineAbstract extends Expression {
|
|
|
646
646
|
getRunnable(): IStatementRunnable;
|
|
647
647
|
}
|
|
648
648
|
|
|
649
|
+
declare class CDSDefineCustom extends Expression {
|
|
650
|
+
getRunnable(): IStatementRunnable;
|
|
651
|
+
}
|
|
652
|
+
|
|
649
653
|
declare class CDSDefineProjection extends Expression {
|
|
650
654
|
getRunnable(): IStatementRunnable;
|
|
651
655
|
}
|
|
@@ -2076,6 +2080,7 @@ declare namespace ExpressionsCDS {
|
|
|
2076
2080
|
CDSComposition,
|
|
2077
2081
|
CDSCondition,
|
|
2078
2082
|
CDSDefineAbstract,
|
|
2083
|
+
CDSDefineCustom,
|
|
2079
2084
|
CDSDefineProjection,
|
|
2080
2085
|
CDSDefineView,
|
|
2081
2086
|
CDSElement,
|
|
@@ -3868,12 +3873,12 @@ declare class MethodParameters extends Expression {
|
|
|
3868
3873
|
}
|
|
3869
3874
|
|
|
3870
3875
|
declare class MethodParameters_2 implements IMethodParameters {
|
|
3876
|
+
private preferred;
|
|
3877
|
+
private returning;
|
|
3871
3878
|
private readonly importing;
|
|
3872
3879
|
private readonly optional;
|
|
3873
3880
|
private readonly exporting;
|
|
3874
3881
|
private readonly changing;
|
|
3875
|
-
private preferred;
|
|
3876
|
-
private returning;
|
|
3877
3882
|
private readonly exceptions;
|
|
3878
3883
|
private readonly defaults;
|
|
3879
3884
|
private readonly filename;
|
|
@@ -16,7 +16,8 @@ class MethodDef {
|
|
|
16
16
|
const result = (0, combi_1.seq)("RESULT", expressions_1.MethodParamName);
|
|
17
17
|
const link = (0, combi_1.seq)("LINK", expressions_1.MethodParamName);
|
|
18
18
|
const full = (0, combi_1.seq)("FULL", expressions_1.MethodParamName);
|
|
19
|
-
const
|
|
19
|
+
const modify = (0, combi_1.alt)((0, combi_1.seq)("FOR ACTION", expressions_1.TypeName, result), (0, combi_1.seq)("FOR CREATE", (0, combi_1.alt)(expressions_1.TypeName, expressions_1.EntityAssociation)), (0, combi_1.seq)("FOR DELETE", expressions_1.TypeName), (0, combi_1.seq)("FOR UPDATE", expressions_1.TypeName));
|
|
20
|
+
const behavior = (0, combi_1.altPrio)((0, combi_1.seq)("VALIDATE ON SAVE IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("MODIFY IMPORTING", expressions_1.MethodParamName, modify), (0, combi_1.seq)("READ IMPORTING", expressions_1.MethodParamName, "FOR READ", (0, combi_1.alt)(expressions_1.TypeName, expressions_1.EntityAssociation), (0, combi_1.optPrio)(full), result, (0, combi_1.optPrio)(link)), (0, combi_1.seq)("FEATURES IMPORTING", expressions_1.MethodParamName, "REQUEST", expressions_1.NamespaceSimpleName, "FOR", expressions_1.NamespaceSimpleName, result), (0, combi_1.seq)("DETERMINE", (0, combi_1.alt)("ON MODIFY", "ON SAVE"), "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName));
|
|
20
21
|
// todo, this is only from version something
|
|
21
22
|
const amdp = (0, combi_1.seq)("AMDP OPTIONS CDS SESSION CLIENT CURRENT", (0, combi_1.optPrio)(expressions_1.MethodDefImporting), (0, combi_1.optPrio)(expressions_1.MethodDefExporting), (0, combi_1.optPrio)(expressions_1.MethodDefRaising));
|
|
22
23
|
const ret = (0, combi_1.seq)((0, combi_1.altPrio)("CLASS-METHODS", "METHODS"), expressions_1.MethodName, (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), expressions_1.EventHandler), parameters, testing, (0, combi_1.seq)("FOR", (0, combi_1.alt)(tableFunction, ddl, behavior)), amdp, "NOT AT END OF MODE", (0, combi_1.optPrio)(expressions_1.Redefinition)));
|
|
@@ -545,6 +545,22 @@ class BasicTypes {
|
|
|
545
545
|
this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
+
else if (chainText.includes("->")) {
|
|
549
|
+
const [varName, typeName] = chainText.split("->");
|
|
550
|
+
const varVar = this.scope.findVariable(varName);
|
|
551
|
+
const foo = varVar === null || varVar === void 0 ? void 0 : varVar.getType();
|
|
552
|
+
if (foo instanceof basic_1.ObjectReferenceType) {
|
|
553
|
+
const id = foo.getIdentifier();
|
|
554
|
+
if (id instanceof types_1.ClassDefinition) {
|
|
555
|
+
const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(id, typeName);
|
|
556
|
+
foundType = byName === null || byName === void 0 ? void 0 : byName.getType();
|
|
557
|
+
if (byName === undefined || foundType === undefined) {
|
|
558
|
+
return new Types.UnknownType(typeName + " not found in class or interface");
|
|
559
|
+
}
|
|
560
|
+
this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
548
564
|
else {
|
|
549
565
|
const found = this.scope.findType(subs[0]);
|
|
550
566
|
foundType = found === null || found === void 0 ? void 0 : found.getType();
|
|
@@ -146,6 +146,11 @@ class MethodParameters {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
+
// RAP parameters, temporary fix
|
|
150
|
+
const rapName = node.findExpressionAfterToken("IMPORTING");
|
|
151
|
+
if (rapName) {
|
|
152
|
+
this.importing.push(new _typed_identifier_1.TypedIdentifier(rapName.getFirstToken(), filename, new basic_1.VoidType("RapMethodParameter"), ["importing" /* IdentifierMeta.MethodImporting */]));
|
|
153
|
+
}
|
|
149
154
|
const exporting = node.findFirstExpression(Expressions.MethodDefExporting);
|
|
150
155
|
if (exporting) {
|
|
151
156
|
this.add(this.exporting, exporting, scope, ["exporting" /* IdentifierMeta.MethodExporting */]);
|
|
@@ -26,6 +26,9 @@ class CDSParser {
|
|
|
26
26
|
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
27
27
|
res = combi_1.Combi.run(new Expressions.CDSAnnotate(), tokens, version_1.defaultVersion);
|
|
28
28
|
}
|
|
29
|
+
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
30
|
+
res = combi_1.Combi.run(new Expressions.CDSDefineCustom(), tokens, version_1.defaultVersion);
|
|
31
|
+
}
|
|
29
32
|
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
30
33
|
return undefined;
|
|
31
34
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSDefineCustom = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_name_1 = require("./cds_name");
|
|
7
|
+
const cds_type_1 = require("./cds_type");
|
|
8
|
+
class CDSDefineCustom extends combi_1.Expression {
|
|
9
|
+
getRunnable() {
|
|
10
|
+
const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", cds_type_1.CDSType, ";");
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE ROOT CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.str)("{"), (0, combi_1.plus)(field), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CDSDefineCustom = CDSDefineCustom;
|
|
15
|
+
//# sourceMappingURL=cds_define_custom.js.map
|
|
@@ -5,7 +5,8 @@ const _1 = require(".");
|
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
6
|
class CDSRelation extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
|
|
8
|
+
const pre = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w_]+$/), "/");
|
|
9
|
+
return (0, combi_1.seq)((0, combi_1.opt)(pre), (0, combi_1.regex)(/^[\w_]+$/), (0, combi_1.opt)(_1.CDSAs));
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
exports.CDSRelation = CDSRelation;
|
|
@@ -30,6 +30,7 @@ __exportStar(require("./cds_cast"), exports);
|
|
|
30
30
|
__exportStar(require("./cds_composition"), exports);
|
|
31
31
|
__exportStar(require("./cds_condition"), exports);
|
|
32
32
|
__exportStar(require("./cds_define_abstract"), exports);
|
|
33
|
+
__exportStar(require("./cds_define_custom"), exports);
|
|
33
34
|
__exportStar(require("./cds_define_projection"), exports);
|
|
34
35
|
__exportStar(require("./cds_define_view"), exports);
|
|
35
36
|
__exportStar(require("./cds_element"), exports);
|
package/build/src/registry.js
CHANGED