@abaplint/core 2.88.2 → 2.88.5

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.
@@ -199,7 +199,18 @@ class BasicTypes {
199
199
  if (nameExpr.countTokens() > 1) { // workaround for names with dashes
200
200
  name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());
201
201
  }
202
- const found = this.parseType(node, this.scope.isTypePool() ? name.getStr() : undefined);
202
+ let qualifiedName = undefined;
203
+ if (this.scope.isTypePool() === true) {
204
+ qualifiedName = name.getStr();
205
+ }
206
+ else {
207
+ qualifiedName = name.getStr();
208
+ if (this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition
209
+ || this.scope.getType() === _scope_type_1.ScopeType.Interface) {
210
+ qualifiedName = this.scope.getName() + "=>" + qualifiedName;
211
+ }
212
+ }
213
+ const found = this.parseType(node, qualifiedName);
203
214
  if (found) {
204
215
  return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);
205
216
  }
@@ -301,9 +312,9 @@ class BasicTypes {
301
312
  // fallback to old style syntax, OCCURS etc
302
313
  return this.parseType(node, name);
303
314
  }
304
- parseType(node, name) {
315
+ parseType(node, qualifiedName) {
305
316
  var _a, _b, _c, _d, _e, _f;
306
- const typename = node.findFirstExpression(Expressions.TypeName);
317
+ const typeName = node.findFirstExpression(Expressions.TypeName);
307
318
  let text = (_a = node.findFirstExpression(Expressions.Type)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
308
319
  if (text === undefined) {
309
320
  text = (_b = node.findFirstExpression(Expressions.TypeParam)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
@@ -369,7 +380,7 @@ class BasicTypes {
369
380
  }
370
381
  found = this.resolveLikeName(sub);
371
382
  if (found && text.includes(" OCCURS ")) {
372
- found = new Types.TableType(found, { withHeader: text.includes("WITH HEADER LINE") }, name);
383
+ found = new Types.TableType(found, { withHeader: text.includes("WITH HEADER LINE") }, qualifiedName);
373
384
  }
374
385
  }
375
386
  else if (text.startsWith("TYPE LINE OF ")) {
@@ -392,13 +403,13 @@ class BasicTypes {
392
403
  }
393
404
  }
394
405
  else if (text.startsWith("TYPE REF TO ")) {
395
- found = this.resolveTypeRef(typename);
406
+ found = this.resolveTypeRef(typeName);
396
407
  }
397
408
  else if (text.startsWith("TYPE")) {
398
- found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node), name);
409
+ found = this.resolveTypeName(typeName, this.findLength(node), this.findDecimals(node), qualifiedName);
399
410
  const concat = node.concatTokens().toUpperCase();
400
411
  if (found && concat.includes(" OCCURS ")) {
401
- found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, name);
412
+ found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, qualifiedName);
402
413
  }
403
414
  else if (found && concat.includes("WITH HEADER LINE")) {
404
415
  if (found instanceof Types.VoidType) {
@@ -411,7 +422,7 @@ class BasicTypes {
411
422
  found = new Types.TableType(found.getRowType(), { withHeader: true });
412
423
  }
413
424
  }
414
- if (found === undefined && typename === undefined) {
425
+ if (found === undefined && typeName === undefined) {
415
426
  let length = 1;
416
427
  const len = node.findDirectExpression(Expressions.ConstantFieldLength);
417
428
  if (len) {
@@ -420,9 +431,9 @@ class BasicTypes {
420
431
  length = parseInt(int.concatTokens(), 10);
421
432
  }
422
433
  }
423
- found = new Types.CharacterType(length, name); // fallback
434
+ found = new Types.CharacterType(length, qualifiedName); // fallback
424
435
  if (concat.includes(" OCCURS ")) {
425
- found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, name);
436
+ found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, qualifiedName);
426
437
  }
427
438
  }
428
439
  }
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.88.2";
71
+ return "2.88.5";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -499,13 +499,17 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
499
499
  }
500
500
  const condition = this.tableCondition(tableExpression);
501
501
  const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
502
+ const tabixBackup = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
502
503
  const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
503
504
  const firstToken = node.getFirstToken();
504
505
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
506
+ ${indentation}DATA ${tabixBackup} LIKE sy-tabix.
507
+ ${indentation}${tabixBackup} = sy-tabix.
505
508
  ${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.
506
509
  ${indentation}IF sy-subrc <> 0.
507
510
  ${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
508
511
  ${indentation}ENDIF.
512
+ ${indentation}sy-tabix = ${tabixBackup}.
509
513
  ${indentation}`);
510
514
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);
511
515
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
@@ -754,12 +758,16 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
754
758
  uniqueName = `<${uniqueName}>`;
755
759
  const tName = target.concatTokens().split("[")[0];
756
760
  const condition = this.tableCondition(tableExpression);
761
+ const tabixBackup = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
757
762
  const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
758
763
  const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
764
+ ${indentation}DATA ${tabixBackup} LIKE sy-tabix.
765
+ ${indentation}${tabixBackup} = sy-tabix.
759
766
  ${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
760
767
  ${indentation}IF sy-subrc <> 0.
761
768
  ${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
762
769
  ${indentation}ENDIF.
770
+ ${indentation}sy-tabix = ${tabixBackup}.
763
771
  ${indentation}${uniqueName}`;
764
772
  const start = target.getFirstToken().getStart();
765
773
  const end = (_a = tableExpression.findDirectTokenByText("]")) === null || _a === void 0 ? void 0 : _a.getEnd();
@@ -924,6 +932,7 @@ ${indentation} output = ${topTarget}.`;
924
932
  || forLoop.findDirectTokenByText("WHILE")) {
925
933
  const fieldDef = forLoop.findDirectExpression(Expressions.InlineFieldDefinition);
926
934
  const field = (_d = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.findFirstExpression(Expressions.Field)) === null || _d === void 0 ? void 0 : _d.concatTokens();
935
+ const indexBackup = this.uniqueName(forLoop.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
927
936
  body += indentation + "DATA " + field + " TYPE i.\n";
928
937
  const second = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.getChildren()[2];
929
938
  if ((second === null || second === void 0 ? void 0 : second.get()) instanceof Expressions.Source) {
@@ -931,15 +940,26 @@ ${indentation} output = ${topTarget}.`;
931
940
  }
932
941
  const not = forLoop.findDirectTokenByText("UNTIL") ? " NOT" : "";
933
942
  const cond = forLoop.findFirstExpression(Expressions.Cond);
943
+ body += indentation + `DATA ${indexBackup} LIKE sy-index.\n`;
944
+ body += indentation + `${indexBackup} = sy-index.\n`;
934
945
  body += indentation + `WHILE${not} ${cond === null || cond === void 0 ? void 0 : cond.concatTokens()}.\n`;
935
- end += ` ${field} = ${field} + 1.\n`;
946
+ body += indentation + ` sy-index = ${indexBackup}.\n`;
947
+ const then = forLoop.findExpressionAfterToken("THEN");
948
+ if (then) {
949
+ end += ` ${field} = ${then.concatTokens()}.\n`;
950
+ }
951
+ else {
952
+ end += ` ${field} = ${field} + 1.\n`;
953
+ }
936
954
  end += indentation + "ENDWHILE";
937
955
  }
938
956
  else if (loopTargetField) {
957
+ // todo, also backup sy-index / sy-tabix here?
939
958
  body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField})${cond}.\n`;
940
959
  end = "ENDLOOP";
941
960
  }
942
961
  else if (loopTargetField === undefined) {
962
+ // todo, also backup sy-index / sy-tabix here?
943
963
  const loopTargetFieldSymbol = (_e = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _e === void 0 ? void 0 : _e.concatTokens();
944
964
  body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol})${cond}.\n`;
945
965
  end = "ENDLOOP";
@@ -6,6 +6,7 @@ const issue_1 = require("../issue");
6
6
  const _abap_rule_1 = require("./_abap_rule");
7
7
  const _basic_rule_config_1 = require("./_basic_rule_config");
8
8
  const ddic_1 = require("../ddic");
9
+ const _irule_1 = require("./_irule");
9
10
  class MessageExistsConf extends _basic_rule_config_1.BasicRuleConfig {
10
11
  }
11
12
  exports.MessageExistsConf = MessageExistsConf;
@@ -19,6 +20,7 @@ class MessageExistsRule extends _abap_rule_1.ABAPRule {
19
20
  key: "message_exists",
20
21
  title: "Check MESSAGE exists",
21
22
  shortDescription: `In message statements, check that the message class + id exist`,
23
+ tags: [_irule_1.RuleTag.Syntax],
22
24
  };
23
25
  }
24
26
  getConfig() {
@@ -16,9 +16,8 @@ class SICFConsistency {
16
16
  return {
17
17
  key: "sicf_consistency",
18
18
  title: "SICF consistency",
19
- shortDescription: `Checks the validity of ICF services:
20
-
21
- * Class defined in handler must exist
19
+ shortDescription: `Checks the validity of ICF services`,
20
+ extendedInformation: `* Class defined in handler must exist
22
21
  * Class must not have any syntax errors
23
22
  * Class must implement interface IF_HTTP_EXTENSION`,
24
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.88.2",
3
+ "version": "2.88.5",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",