@abaplint/core 2.119.34 → 2.119.36

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.
@@ -10,17 +10,17 @@ const _select_core_1 = require("./_select_core");
10
10
  class SQLCompare extends combi_1.Expression {
11
11
  getRunnable() {
12
12
  const subSelect = (0, combi_1.ver)(version_1.Version.v750, sql_set_op_group_1.SQLSetOpGroup, version_1.Version.OpenABAP);
13
+ const simpleSubSelect = (0, combi_1.seq)("(", "SELECT", (0, _select_core_1.buildSelectCore)(undefined, false), ")");
14
+ const simpleScalarSubSelect = (0, combi_1.ver)(version_1.Version.v740sp08, simpleSubSelect, version_1.Version.OpenABAP);
13
15
  const between = (0, combi_1.seq)("BETWEEN", _1.SQLSource, "AND", _1.SQLSource);
14
16
  const like = (0, combi_1.seq)("LIKE", _1.SQLSource, (0, combi_1.optPrio)((0, combi_1.seq)("ESCAPE", _1.SQLSource)));
15
17
  const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("NULL", (0, combi_1.ver)(version_1.Version.v753, "INITIAL")));
16
- const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), subSelect);
18
+ const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), (0, combi_1.altPrio)(subSelect, simpleScalarSubSelect));
17
19
  const source = new _1.SQLSource();
18
20
  const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)), version_1.Version.OpenABAP);
19
21
  const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
20
22
  const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleSource3, paren)), version_1.Version.OpenABAP);
21
23
  const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLCase, _1.SQLAggregation, _1.SQLFunction, _1.ConstantString, (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLPath, _1.SQLFieldName), (0, combi_1.optPrio)(arith)), at), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, _1.SQLCase, _1.SQLAggregation, _1.SQLFunction, (0, combi_1.seq)(source, (0, combi_1.optPrio)(arith)))), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), nul));
22
- // simple subquery for pre-v750 versions: EXISTS ( SELECT ... )
23
- const simpleSubSelect = (0, combi_1.seq)("(", "SELECT", (0, _select_core_1.buildSelectCore)(undefined, false), ")");
24
24
  const exists = (0, combi_1.seq)("EXISTS", (0, combi_1.altPrio)(subSelect, simpleSubSelect));
25
25
  return (0, combi_1.altPrio)(exists, _1.Dynamic, rett);
26
26
  }
@@ -169,9 +169,10 @@ class FunctionGroup extends _abap_object_1.ABAPObject {
169
169
  }
170
170
  }
171
171
  findTextFile() {
172
- const search = this.getName() + ".fugr.sapl" + this.getName() + ".xml";
172
+ const name = this.getName().replace(/\//g, "#");
173
+ const regex = new RegExp(name + "\\.fugr\\.(#\\w+#)?sapl" + name.replace(/^#\w+#/, "") + "\\.xml", "i");
173
174
  for (const f of this.getFiles()) {
174
- if (f.getFilename().includes(search.toLowerCase())) {
175
+ if (regex.test(f.getFilename())) {
175
176
  return f;
176
177
  }
177
178
  }
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.js"
77
- return "2.119.34";
77
+ return "2.119.36";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
@@ -41,6 +41,7 @@ const _irule_1 = require("./_irule");
41
41
  const version_1 = require("../version");
42
42
  const _abap_object_1 = require("../objects/_abap_object");
43
43
  const syntax_1 = require("../abap/5_syntax/syntax");
44
+ const _typed_identifier_1 = require("../abap/types/_typed_identifier");
44
45
  const _scope_type_1 = require("../abap/5_syntax/_scope_type");
45
46
  const _reference_1 = require("../abap/5_syntax/_reference");
46
47
  const edit_helper_1 = require("../edit_helper");
@@ -141,10 +142,16 @@ DATA(percentage) = CONV decfloat34( comment_number / abs_statement_number ) * 10
141
142
  }
142
143
  const file = obj.getABAPFileByName(identifier.getFilename());
143
144
  const writeStatement = edit_helper_1.EditHelper.findStatement(next, file);
145
+ if (writeStatement === undefined) {
146
+ continue;
147
+ }
144
148
  const statementType = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.get();
145
149
  if (statementType === undefined) {
146
150
  continue;
147
151
  }
152
+ else if (this.statementHasGenericRead(node, writeStatement)) {
153
+ continue;
154
+ }
148
155
  // for now only allow some specific target statements, todo refactor
149
156
  if (!(statementType instanceof Statements.Move
150
157
  || statementType instanceof Statements.Catch
@@ -232,6 +239,21 @@ DATA(percentage) = CONV decfloat34( comment_number / abs_statement_number ) * 10
232
239
  }
233
240
  return undefined;
234
241
  }
242
+ statementHasGenericRead(node, statement) {
243
+ for (const ref of node.getData().references) {
244
+ if (ref.referenceType !== _reference_1.ReferenceType.DataReadReference
245
+ || ref.resolved === undefined
246
+ || statement.includesToken(ref.position.getToken()) === false
247
+ || !(ref.resolved instanceof _typed_identifier_1.TypedIdentifier)) {
248
+ continue;
249
+ }
250
+ else if (ref.resolved.getType().isGeneric() === true
251
+ || ref.resolved.getType().containsVoid() === true) {
252
+ return true;
253
+ }
254
+ }
255
+ return false;
256
+ }
235
257
  isLocalDefinition(node, identifier) {
236
258
  const { start, end } = node.calcCoverage();
237
259
  if (identifier.getStart().isAfter(start) && identifier.getStart().isBefore(end)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.119.34",
3
+ "version": "2.119.36",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",