@abaplint/core 2.113.237 → 2.113.239

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.
@@ -1533,6 +1533,7 @@ export declare class CurrentScope {
1533
1533
  findType(name: string | undefined): TypedIdentifier | undefined;
1534
1534
  findExtraLikeType(name: string | undefined): TypedIdentifier | undefined;
1535
1535
  findVariable(name: string | undefined): TypedIdentifier | undefined;
1536
+ findReturningParameter(): TypedIdentifier | undefined;
1536
1537
  getDDIC(): DDIC;
1537
1538
  getDDICReferences(): IDDICReferences;
1538
1539
  getMSAGReferences(): IMSAGReferences;
@@ -3926,8 +3927,12 @@ export declare interface IRegistry {
3926
3927
  getObjects(): Generator<IObject, void, undefined>;
3927
3928
  /** Get objects by type, including dependencies */
3928
3929
  getObjectsByType(type: string): Generator<IObject, void, undefined>;
3929
- /** Get number of objects in the registry, default is skipping dependencies */
3930
- getObjectCount(skipDependencies?: boolean): number;
3930
+ /** Get number of objects in the registry */
3931
+ getObjectCount(): {
3932
+ total: number;
3933
+ normal: number;
3934
+ dependencies: number;
3935
+ };
3931
3936
  getFirstObject(): IObject | undefined;
3932
3937
  getObject(type: string | undefined, name: string | undefined): IObject | undefined;
3933
3938
  findObjectForFile(file: IFile): IObject | undefined;
@@ -5635,7 +5640,11 @@ export declare class Registry implements IRegistry {
5635
5640
  getObjectsByType(type: string): Generator<IObject, void, undefined>;
5636
5641
  getFiles(): Generator<IFile, void, undefined>;
5637
5642
  getFirstObject(): IObject | undefined;
5638
- getObjectCount(skipDependencies?: boolean): number;
5643
+ getObjectCount(): {
5644
+ total: number;
5645
+ normal: number;
5646
+ dependencies: number;
5647
+ };
5639
5648
  getFileByName(filename: string): IFile | undefined;
5640
5649
  getObject(type: string | undefined, name: string | undefined): IObject | undefined;
5641
5650
  getConfig(): IConfiguration;
@@ -31,8 +31,8 @@ class SQLFunction extends combi_1.Expression {
31
31
  // dunno if the version for substring is correct
32
32
  const dats_is_valid = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)((0, combi_1.regex)(/^dats_is_valid$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
33
33
  const dats_days_between = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)((0, combi_1.regex)(/^dats_days_between$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
34
- const dats_add_days = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)((0, combi_1.regex)(/^dats_is_valid$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
35
- const dats_add_months = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)((0, combi_1.regex)(/^dats_is_valid$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
34
+ const dats_add_days = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)((0, combi_1.regex)(/^dats_add_days$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
35
+ const dats_add_months = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)((0, combi_1.regex)(/^dats_add_months$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
36
36
  const ltrim = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^ltrim$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
37
37
  const rtrim = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^rtrim$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
38
38
  return (0, combi_1.altPrio)(uuid, abs, ceil, floor, cast, div, mod, coalesce, concat, replace, length, lower, upper, round, concat_with_space, ltrim, rtrim, substring, dats_is_valid, dats_days_between, dats_add_days, dats_add_months);
@@ -378,6 +378,16 @@ class CurrentScope {
378
378
  }
379
379
  return this.findTypePoolConstant(name);
380
380
  }
381
+ findReturningParameter() {
382
+ var _a;
383
+ for (const v in ((_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().vars) || {}) {
384
+ const variable = this.current.getData().vars[v];
385
+ if (variable.getMeta().includes("returning" /* IdentifierMeta.MethodReturning */)) {
386
+ return variable;
387
+ }
388
+ }
389
+ return undefined;
390
+ }
381
391
  ///////////////////////////
382
392
  getDDIC() {
383
393
  return new ddic_1.DDIC(this.reg);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Return = void 0;
4
+ const Expressions = require("../../2_statements/expressions");
5
+ const _reference_1 = require("../_reference");
6
+ const _syntax_input_1 = require("../_syntax_input");
7
+ const source_1 = require("../expressions/source");
8
+ class Return {
9
+ runSyntax(node, input) {
10
+ const source = node.findDirectExpression(Expressions.Source);
11
+ if (source) {
12
+ const ret = input.scope.findReturningParameter();
13
+ if (ret === undefined) {
14
+ const message = "Method does not have a RETURNING parameter to assign to";
15
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, source.getFirstToken(), message));
16
+ return;
17
+ }
18
+ input.scope.addReference(source.getFirstToken(), ret, _reference_1.ReferenceType.DataReadReference, input.filename);
19
+ source_1.Source.runSyntax(source, input, ret.getType());
20
+ }
21
+ }
22
+ }
23
+ exports.Return = Return;
24
+ //# sourceMappingURL=return.js.map
@@ -67,6 +67,7 @@ const concatenate_1 = require("./statements/concatenate");
67
67
  const call_function_1 = require("./statements/call_function");
68
68
  const clear_1 = require("./statements/clear");
69
69
  const refresh_1 = require("./statements/refresh");
70
+ const return_1 = require("./statements/return");
70
71
  const free_1 = require("./statements/free");
71
72
  const replace_1 = require("./statements/replace");
72
73
  const get_bit_1 = require("./statements/get_bit");
@@ -196,6 +197,7 @@ if (Object.keys(map).length === 0) {
196
197
  addToMap(new clear_1.Clear());
197
198
  addToMap(new free_1.Free());
198
199
  addToMap(new refresh_1.Refresh());
200
+ addToMap(new return_1.Return());
199
201
  addToMap(new receive_1.Receive());
200
202
  addToMap(new get_bit_1.GetBit());
201
203
  addToMap(new class_local_friends_1.ClassLocalFriends());
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.sh"
77
- return "2.113.237";
77
+ return "2.113.239";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
@@ -112,13 +112,16 @@ class Registry {
112
112
  }
113
113
  return undefined;
114
114
  }
115
- getObjectCount(skipDependencies = true) {
116
- let res = 0;
115
+ getObjectCount() {
116
+ const res = { total: 0, normal: 0, dependencies: 0 };
117
117
  for (const o of this.getObjects()) {
118
- if (skipDependencies === true && this.isDependency(o)) {
119
- continue;
118
+ res.total++;
119
+ if (this.isDependency(o)) {
120
+ res.dependencies++;
121
+ }
122
+ else {
123
+ res.normal++;
120
124
  }
121
- res = res + 1;
122
125
  }
123
126
  return res;
124
127
  }
@@ -285,7 +288,7 @@ class Registry {
285
288
  return this;
286
289
  }
287
290
  ParsingPerformance.clear();
288
- (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), "Lexing and parsing");
291
+ (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount().normal, "Lexing and parsing");
289
292
  for (const o of this.getObjects()) {
290
293
  await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick("Lexing and parsing(" + this.conf.getVersion() + ") - " + o.getType() + " " + o.getName()));
291
294
  this.parsePrivate(o);
@@ -205,13 +205,26 @@ This rule makes sure the spaces are consistently required across the language.`,
205
205
  }
206
206
  checkCond(cond) {
207
207
  const children = cond.getAllTokens();
208
+ const dynamic = cond.findAllExpressions(Expressions.Dynamic);
208
209
  for (let i = 0; i < children.length - 1; i++) {
209
210
  const current = children[i];
210
211
  const next = children[i + 1];
211
212
  if (next.getStr().startsWith("'")
212
213
  && next.getRow() === current.getRow()
213
214
  && next.getCol() === current.getEnd().getCol()) {
214
- return current.getEnd();
215
+ // skip if the token is part of a DYNAMIC expression
216
+ let isDynamic = false;
217
+ outer: for (const d of dynamic) {
218
+ for (const t of d.getAllTokens()) {
219
+ if (t === next || t === current) {
220
+ isDynamic = true;
221
+ break outer;
222
+ }
223
+ }
224
+ }
225
+ if (isDynamic === false) {
226
+ return current.getEnd();
227
+ }
215
228
  }
216
229
  }
217
230
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.237",
3
+ "version": "2.113.239",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,20 +50,20 @@
50
50
  },
51
51
  "homepage": "https://abaplint.org",
52
52
  "devDependencies": {
53
- "@microsoft/api-extractor": "^7.53.3",
53
+ "@microsoft/api-extractor": "^7.55.0",
54
54
  "@types/chai": "^4.3.20",
55
55
  "@types/mocha": "^10.0.10",
56
- "@types/node": "^24.9.1",
56
+ "@types/node": "^24.10.1",
57
57
  "chai": "^4.5.0",
58
- "eslint": "^9.38.0",
59
- "mocha": "^11.7.4",
58
+ "eslint": "^9.39.1",
59
+ "mocha": "^11.7.5",
60
60
  "c8": "^10.1.3",
61
61
  "source-map-support": "^0.5.21",
62
62
  "ts-json-schema-generator": "^2.4.0",
63
63
  "typescript": "^5.9.3"
64
64
  },
65
65
  "dependencies": {
66
- "fast-xml-parser": "^5.3.0",
66
+ "fast-xml-parser": "^5.3.2",
67
67
  "json5": "^2.2.3",
68
68
  "vscode-languageserver-types": "^3.17.5"
69
69
  }