@abaplint/core 2.85.26 → 2.85.29

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.
@@ -4996,6 +4996,7 @@ declare class StatementNode extends AbstractNode<ExpressionNode | TokenNode> {
4996
4996
  */
4997
4997
  findTokenSequencePosition(first: string, second: string): Position | undefined;
4998
4998
  findExpressionAfterToken(text: string): ExpressionNode | undefined;
4999
+ findExpressionsAfterToken(text: string): ExpressionNode[];
4999
5000
  private toTokens;
5000
5001
  private toTokenNodess;
5001
5002
  }
@@ -36,10 +36,11 @@ class MethodSource {
36
36
  ooType: "CLAS"
37
37
  };
38
38
  scope.addReference(last.getFirstToken(), foundMethod, _reference_1.ReferenceType.MethodReference, filename, extra);
39
+ return foundMethod;
39
40
  }
40
41
  }
41
42
  else if (context instanceof basic_1.VoidType) {
42
- return;
43
+ return context;
43
44
  }
44
45
  else {
45
46
  throw new Error("MethodSource, not a object reference, " + node.concatTokens());
@@ -61,6 +62,7 @@ class MethodSource {
61
62
  new Dynamic().runSyntax(d, scope, filename);
62
63
  }
63
64
  */
65
+ return undefined;
64
66
  }
65
67
  }
66
68
  exports.MethodSource = MethodSource;
@@ -17,11 +17,11 @@ class Call {
17
17
  if (methodSource === undefined) {
18
18
  throw new Error("Call, child MethodSource not found");
19
19
  }
20
- new method_source_1.MethodSource().runSyntax(methodSource, scope, filename);
20
+ const methodDef = new method_source_1.MethodSource().runSyntax(methodSource, scope, filename);
21
21
  const body = node.findDirectExpression(Expressions.MethodCallBody);
22
22
  if (body) {
23
23
  // todo, resolve the method definition above and pass, if possible, in case of dynamic pass void
24
- new method_call_body_1.MethodCallBody().runSyntax(body, scope, filename, new void_type_1.VoidType("CallTODO"));
24
+ new method_call_body_1.MethodCallBody().runSyntax(body, scope, filename, methodDef || new void_type_1.VoidType("CallTODO"));
25
25
  }
26
26
  }
27
27
  }
@@ -26,9 +26,11 @@ class Find {
26
26
  this.inline(rfound, scope, filename, new basic_1.TableType(type, { withHeader: false }));
27
27
  }
28
28
  }
29
- const ofound = node.findExpressionAfterToken("OFFSET");
30
- if (ofound && ofound.get() instanceof Expressions.Target) {
31
- this.inline(ofound, scope, filename, new basic_1.IntegerType());
29
+ const ofound = node.findExpressionsAfterToken("OFFSET");
30
+ for (const o of ofound) {
31
+ if (o.get() instanceof Expressions.Target) {
32
+ this.inline(o, scope, filename, new basic_1.IntegerType());
33
+ }
32
34
  }
33
35
  const lfound = node.findExpressionAfterToken("LINE");
34
36
  if (lfound && lfound.get() instanceof Expressions.Target) {
@@ -44,7 +46,10 @@ class Find {
44
46
  }
45
47
  if (node.findDirectTokenByText("SUBMATCHES")) {
46
48
  for (const t of node.findDirectExpressions(Expressions.Target)) {
47
- if (t === rfound || t === ofound || t === lfound || t === cfound || t === lnfound) {
49
+ if (t === rfound || t === lfound || t === cfound || t === lnfound) {
50
+ continue;
51
+ }
52
+ else if (ofound.indexOf(t) >= 0) {
48
53
  continue;
49
54
  }
50
55
  const inline = t === null || t === void 0 ? void 0 : t.findDirectExpression(Expressions.InlineData);
@@ -255,6 +255,20 @@ class StatementNode extends _abstract_node_1.AbstractNode {
255
255
  }
256
256
  return undefined;
257
257
  }
258
+ findExpressionsAfterToken(text) {
259
+ const children = this.getChildren();
260
+ const ret = [];
261
+ for (let i = 0; i < children.length - 1; i++) {
262
+ const c = children[i];
263
+ const next = children[i + 1];
264
+ if (c instanceof token_node_1.TokenNode
265
+ && c.get().getStr().toUpperCase() === text.toUpperCase()
266
+ && next instanceof expression_node_1.ExpressionNode) {
267
+ ret.push(next);
268
+ }
269
+ }
270
+ return ret;
271
+ }
258
272
  ////////////////////////////////
259
273
  toTokens(b) {
260
274
  const tokens = [];
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.85.26";
71
+ return "2.85.29";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -335,6 +335,12 @@ Only one transformation is applied to a statement at a time, so multiple steps m
335
335
  if (fields.length === 1) {
336
336
  fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;
337
337
  }
338
+ else if (fieldList.concatTokens() === "*") {
339
+ fieldDefinition = `DATA ${name} TYPE ${tableName}.`;
340
+ }
341
+ else if (fieldList.concatTokens().toUpperCase() === "COUNT( * )") {
342
+ fieldDefinition = `DATA ${name} TYPE i.`;
343
+ }
338
344
  else {
339
345
  for (const f of fields) {
340
346
  const fieldName = f.concatTokens();
@@ -487,6 +493,9 @@ ${indentation}`);
487
493
  else if (source.findFirstExpression(Expressions.FieldLength)) {
488
494
  return undefined;
489
495
  }
496
+ else if (source.findFirstExpression(Expressions.TableExpression)) {
497
+ return undefined;
498
+ }
490
499
  const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();
491
500
  const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
492
501
  const firstToken = node.getFirstToken();
@@ -1144,7 +1153,9 @@ ${indentation} output = ${topTarget}.`;
1144
1153
  uniqueName(position, filename, highSyntax) {
1145
1154
  const spag = highSyntax.spaghetti.lookupPosition(position, filename);
1146
1155
  if (spag === undefined) {
1147
- return "uniqueErrorSpag";
1156
+ const name = "temprr" + this.counter;
1157
+ this.counter++;
1158
+ return name;
1148
1159
  }
1149
1160
  while (true) {
1150
1161
  const name = "temp" + this.counter;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ManyParentheses = exports.ManyParenthesesConf = void 0;
4
4
  const Expressions = require("../abap/2_statements/expressions");
5
+ const Statements = require("../abap/2_statements/statements");
5
6
  const issue_1 = require("../issue");
6
7
  const _abap_rule_1 = require("./_abap_rule");
7
8
  const _basic_rule_config_1 = require("./_basic_rule_config");
@@ -64,9 +65,25 @@ ENDIF.
64
65
  issues.push(issue);
65
66
  }
66
67
  }
68
+ for (const m of structure.findAllStatements(Statements.Move)) {
69
+ issues.push(...this.analyzeMove(file, m));
70
+ }
67
71
  return issues;
68
72
  }
69
73
  ////////////////////
74
+ analyzeMove(file, m) {
75
+ const issues = [];
76
+ const children = m.getChildren();
77
+ const last = children[children.length - 2];
78
+ const lastChildren = last.getChildren();
79
+ if (lastChildren.length === 3
80
+ && lastChildren[0].getFirstToken().getStr() === "("
81
+ && lastChildren[2].getFirstToken().getStr() === ")") {
82
+ const issue = issue_1.Issue.atToken(file, last.getFirstToken(), "Too many parentheses", this.getMetadata().key, this.conf.severity);
83
+ issues.push(issue);
84
+ }
85
+ return issues;
86
+ }
70
87
  analyze(file, cond) {
71
88
  const issues = [];
72
89
  let comparator = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.85.26",
3
+ "version": "2.85.29",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",