@abaplint/core 2.93.70 → 2.93.72

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.
@@ -1941,6 +1941,7 @@ declare namespace Expressions {
1941
1941
  InlineFS,
1942
1942
  Integer,
1943
1943
  InterfaceName,
1944
+ KernelId,
1944
1945
  Language,
1945
1946
  Length,
1946
1947
  Let,
@@ -3578,6 +3579,10 @@ declare interface ITypeDefinitions {
3578
3579
  getByName(name: string): TypedIdentifier | undefined;
3579
3580
  }
3580
3581
 
3582
+ declare class KernelId extends Expression {
3583
+ getRunnable(): IStatementRunnable;
3584
+ }
3585
+
3581
3586
  declare class Language extends Expression {
3582
3587
  getRunnable(): IStatementRunnable;
3583
3588
  }
@@ -3900,6 +3905,7 @@ declare class MethodParameters_2 implements IMethodParameters {
3900
3905
  getExceptions(): string[];
3901
3906
  getParameterDefault(parameter: string): ExpressionNode;
3902
3907
  private parse;
3908
+ private workaroundRAP;
3903
3909
  private add;
3904
3910
  }
3905
3911
 
@@ -98,6 +98,7 @@ __exportStar(require("./inlinedata"), exports);
98
98
  __exportStar(require("./inlinefs"), exports);
99
99
  __exportStar(require("./integer"), exports);
100
100
  __exportStar(require("./interface_name"), exports);
101
+ __exportStar(require("./kernel_id"), exports);
101
102
  __exportStar(require("./language"), exports);
102
103
  __exportStar(require("./length"), exports);
103
104
  __exportStar(require("./let"), exports);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KernelId = void 0;
4
+ const combi_1 = require("../combi");
5
+ const source_1 = require("./source");
6
+ class KernelId extends combi_1.Expression {
7
+ getRunnable() {
8
+ const field = (0, combi_1.seq)("ID", source_1.Source, "FIELD", source_1.Source);
9
+ return field;
10
+ }
11
+ }
12
+ exports.KernelId = KernelId;
13
+ //# sourceMappingURL=kernel_id.js.map
@@ -6,8 +6,7 @@ const expressions_1 = require("../expressions");
6
6
  const version_1 = require("../../../version");
7
7
  class CallKernel {
8
8
  getMatcher() {
9
- const field = (0, combi_1.seq)("ID", expressions_1.Source, "FIELD", expressions_1.Source);
10
- const ret = (0, combi_1.seq)("CALL", (0, combi_1.altPrio)(expressions_1.Constant, expressions_1.Field), (0, combi_1.starPrio)(field));
9
+ const ret = (0, combi_1.seq)("CALL", (0, combi_1.altPrio)(expressions_1.Constant, expressions_1.Field), (0, combi_1.starPrio)(expressions_1.KernelId));
11
10
  return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
12
11
  }
13
12
  }
@@ -17,7 +17,7 @@ class MethodDef {
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
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
+ 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)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR CREATE", expressions_1.TypeName, expressions_1.MethodParamName, "FOR UPDATE", expressions_1.TypeName, expressions_1.MethodParamName, "FOR DELETE", expressions_1.TypeName), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR READ", expressions_1.TypeName, result), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR LOCK", expressions_1.TypeName), (0, combi_1.seq)("DETERMINE", (0, combi_1.alt)("ON MODIFY", "ON SAVE"), "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName));
21
21
  // todo, this is only from version something
22
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));
23
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)));
@@ -556,9 +556,9 @@ class BasicTypes {
556
556
  if (foo instanceof basic_1.ObjectReferenceType) {
557
557
  const typeName = subs[0];
558
558
  const id = foo.getIdentifier();
559
- const type = id instanceof types_1.ClassDefinition ? "CLAS" : "INTF";
560
- this.scope.addReference(expr.getFirstToken(), id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: id.getName() });
561
559
  if (id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition) {
560
+ const type = id instanceof types_1.ClassDefinition ? "CLAS" : "INTF";
561
+ this.scope.addReference(expr.getFirstToken(), id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: id.getName() });
562
562
  const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(id, typeName);
563
563
  foundType = byName === null || byName === void 0 ? void 0 : byName.getType();
564
564
  if (byName === undefined || foundType === undefined) {
@@ -566,6 +566,15 @@ class BasicTypes {
566
566
  }
567
567
  this.scope.addReference(expr.getTokens()[2], byName, _reference_1.ReferenceType.TypeReference, this.filename);
568
568
  }
569
+ else {
570
+ return new Types.UnknownType("Not a object reference, " + className + ", " + id.constructor.name);
571
+ }
572
+ }
573
+ else if (foo === undefined) {
574
+ return new Types.UnknownType(className + " not found in scope");
575
+ }
576
+ else {
577
+ return new Types.UnknownType("Not a object reference, " + className);
569
578
  }
570
579
  }
571
580
  else {
@@ -75,6 +75,11 @@ class FindGlobalDefinitions {
75
75
  count = count + this.count(p.getType());
76
76
  }
77
77
  }
78
+ for (const e of def.getEvents() || []) {
79
+ for (const p of e.getParameters()) {
80
+ count = count + this.count(p.getType());
81
+ }
82
+ }
78
83
  return count;
79
84
  }
80
85
  count(type) {
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CallKernel = void 0;
4
+ const Expressions = require("../../2_statements/expressions");
5
+ const source_1 = require("../expressions/source");
6
+ class CallKernel {
7
+ runSyntax(node, scope, filename) {
8
+ for (const s of node.findAllExpressions(Expressions.Source)) {
9
+ new source_1.Source().runSyntax(s, scope, filename);
10
+ }
11
+ }
12
+ }
13
+ exports.CallKernel = CallKernel;
14
+ //# sourceMappingURL=call_kernel.js.map
@@ -12,7 +12,14 @@ class ModifyDatabase {
12
12
  }
13
13
  const dbtab = node.findFirstExpression(Expressions.DatabaseTable);
14
14
  if (dbtab !== undefined) {
15
- new database_table_1.DatabaseTable().runSyntax(dbtab, scope, filename);
15
+ try {
16
+ new database_table_1.DatabaseTable().runSyntax(dbtab, scope, filename);
17
+ }
18
+ catch (e) {
19
+ if (scope.findVariable(dbtab.concatTokens()) === undefined) {
20
+ throw e;
21
+ }
22
+ }
16
23
  }
17
24
  for (const s of node.findAllExpressions(Expressions.Source)) {
18
25
  new source_1.Source().runSyntax(s, scope, filename);
@@ -114,6 +114,7 @@ const transfer_1 = require("./statements/transfer");
114
114
  const modify_database_1 = require("./statements/modify_database");
115
115
  const truncate_dataset_1 = require("./statements/truncate_dataset");
116
116
  const call_badi_1 = require("./statements/call_badi");
117
+ const call_kernel_1 = require("./statements/call_kernel");
117
118
  const pack_1 = require("./statements/pack");
118
119
  const unpack_1 = require("./statements/unpack");
119
120
  const format_1 = require("./statements/format");
@@ -256,6 +257,7 @@ if (Object.keys(map).length === 0) {
256
257
  addToMap(new read_entities_1.ReadEntities());
257
258
  addToMap(new modify_entities_1.ModifyEntities());
258
259
  addToMap(new commit_entities_1.CommitEntities());
260
+ addToMap(new call_kernel_1.CallKernel());
259
261
  }
260
262
  // -----------------------------------
261
263
  class SyntaxLogic {
@@ -147,21 +147,6 @@ class MethodParameters {
147
147
  }
148
148
  }
149
149
  }
150
- // RAP parameters, temporary fix
151
- let rapName = node.findExpressionAfterToken("IMPORTING");
152
- if (rapName) {
153
- const token = rapName.getFirstToken();
154
- this.importing.push(new _typed_identifier_1.TypedIdentifier(token, filename, new basic_1.VoidType("RapMethodParameter"), ["importing" /* IdentifierMeta.MethodImporting */]));
155
- if (node.concatTokens().toUpperCase().includes(" FOR VALIDATE ON SAVE")) {
156
- this.exporting.push(new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(token.getStart(), "failed"), filename, new basic_1.VoidType("RapMethodParameter"), ["exporting" /* IdentifierMeta.MethodExporting */]));
157
- this.exporting.push(new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(token.getStart(), "reported"), filename, new basic_1.VoidType("RapMethodParameter"), ["exporting" /* IdentifierMeta.MethodExporting */]));
158
- }
159
- }
160
- rapName = node.findExpressionAfterToken("RESULT");
161
- if (rapName) {
162
- const token = rapName.getFirstToken();
163
- this.importing.push(new _typed_identifier_1.TypedIdentifier(token, filename, new basic_1.VoidType("RapMethodParameter"), ["exporting" /* IdentifierMeta.MethodExporting */]));
164
- }
165
150
  const exporting = node.findFirstExpression(Expressions.MethodDefExporting);
166
151
  if (exporting) {
167
152
  this.add(this.exporting, exporting, scope, ["exporting" /* IdentifierMeta.MethodExporting */]);
@@ -174,6 +159,44 @@ class MethodParameters {
174
159
  if (returning) {
175
160
  this.returning = new method_def_returning_1.MethodDefReturning().runSyntax(returning, scope, this.filename, ["returning" /* IdentifierMeta.MethodReturning */]);
176
161
  }
162
+ this.workaroundRAP(node, scope, filename);
163
+ }
164
+ workaroundRAP(node, scope, filename) {
165
+ const resultName = node.findExpressionAfterToken("RESULT");
166
+ const isRap = node.findExpressionAfterToken("IMPORTING");
167
+ if (isRap) {
168
+ for (const foo of node.findDirectExpressions(Expressions.MethodParamName)) {
169
+ if (foo === resultName) {
170
+ continue;
171
+ }
172
+ this.importing.push(new _typed_identifier_1.TypedIdentifier(foo.getFirstToken(), filename, new basic_1.VoidType("RapMethodParameter"), ["importing" /* IdentifierMeta.MethodImporting */]));
173
+ }
174
+ if (node.concatTokens().toUpperCase().includes(" FOR VALIDATE ")
175
+ || node.concatTokens().toUpperCase().includes(" FOR BEHAVIOR ")
176
+ || node.concatTokens().toUpperCase().includes(" FOR MODIFY ")) {
177
+ const token = isRap.getFirstToken();
178
+ this.exporting.push(new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(token.getStart(), "failed"), filename, new basic_1.VoidType("RapMethodParameter"), ["exporting" /* IdentifierMeta.MethodExporting */]));
179
+ this.exporting.push(new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(token.getStart(), "mapped"), filename, new basic_1.VoidType("RapMethodParameter"), ["exporting" /* IdentifierMeta.MethodExporting */]));
180
+ this.exporting.push(new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(token.getStart(), "reported"), filename, new basic_1.VoidType("RapMethodParameter"), ["exporting" /* IdentifierMeta.MethodExporting */]));
181
+ }
182
+ }
183
+ if (resultName) {
184
+ const token = resultName.getFirstToken();
185
+ this.importing.push(new _typed_identifier_1.TypedIdentifier(token, filename, new basic_1.VoidType("RapMethodParameter"), ["exporting" /* IdentifierMeta.MethodExporting */]));
186
+ }
187
+ // its some kind of magic
188
+ if (scope.getName().toUpperCase() === "CL_ABAP_BEHAVIOR_SAVER") {
189
+ const tempChanging = this.changing.map(c => new _typed_identifier_1.TypedIdentifier(c.getToken(), filename, new basic_1.VoidType("RapMethodParameter"), c.getMeta()));
190
+ while (this.changing.length > 0) {
191
+ this.changing.shift();
192
+ }
193
+ this.changing.push(...tempChanging);
194
+ const tempImporting = this.importing.map(c => new _typed_identifier_1.TypedIdentifier(c.getToken(), filename, new basic_1.VoidType("RapMethodParameter"), c.getMeta()));
195
+ while (this.importing.length > 0) {
196
+ this.importing.shift();
197
+ }
198
+ this.importing.push(...tempImporting);
199
+ }
177
200
  }
178
201
  add(target, source, scope, meta) {
179
202
  var _a;
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.93.70";
66
+ return "2.93.72";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -105,7 +105,7 @@ DATA(sdf) = VALUE type(
105
105
  for (const p of candidate.parameters) {
106
106
  if (p.eq.getCol() !== expectedEqualsColumn) {
107
107
  const message = "Align parameters to column " + expectedEqualsColumn;
108
- return issue_1.Issue.atPosition(file, p.eq, message, this.getMetadata().key);
108
+ return issue_1.Issue.atPosition(file, p.eq, message, this.getMetadata().key, this.getConfig().severity);
109
109
  }
110
110
  }
111
111
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.93.70",
3
+ "version": "2.93.72",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",