@abaplint/core 2.88.3 → 2.88.6

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.
@@ -4,6 +4,7 @@ exports.BasicTypes = void 0;
4
4
  /* eslint-disable default-case */
5
5
  const _typed_identifier_1 = require("../types/_typed_identifier");
6
6
  const Expressions = require("../2_statements/expressions");
7
+ const Statements = require("../2_statements/statements");
7
8
  const Types = require("../types/basic");
8
9
  const _scope_type_1 = require("./_scope_type");
9
10
  const _object_oriented_1 = require("./_object_oriented");
@@ -199,7 +200,20 @@ class BasicTypes {
199
200
  if (nameExpr.countTokens() > 1) { // workaround for names with dashes
200
201
  name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());
201
202
  }
202
- const found = this.parseType(node, this.scope.isTypePool() ? name.getStr() : undefined);
203
+ let qualifiedName = undefined;
204
+ if (node.get() instanceof Statements.Type) {
205
+ if (this.scope.isTypePool() === true) {
206
+ qualifiedName = name.getStr();
207
+ }
208
+ else {
209
+ qualifiedName = name.getStr();
210
+ if (this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition
211
+ || this.scope.getType() === _scope_type_1.ScopeType.Interface) {
212
+ qualifiedName = this.scope.getName() + "=>" + qualifiedName;
213
+ }
214
+ }
215
+ }
216
+ const found = this.parseType(node, qualifiedName);
203
217
  if (found) {
204
218
  return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);
205
219
  }
@@ -301,9 +315,9 @@ class BasicTypes {
301
315
  // fallback to old style syntax, OCCURS etc
302
316
  return this.parseType(node, name);
303
317
  }
304
- parseType(node, name) {
318
+ parseType(node, qualifiedName) {
305
319
  var _a, _b, _c, _d, _e, _f;
306
- const typename = node.findFirstExpression(Expressions.TypeName);
320
+ const typeName = node.findFirstExpression(Expressions.TypeName);
307
321
  let text = (_a = node.findFirstExpression(Expressions.Type)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
308
322
  if (text === undefined) {
309
323
  text = (_b = node.findFirstExpression(Expressions.TypeParam)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
@@ -369,7 +383,7 @@ class BasicTypes {
369
383
  }
370
384
  found = this.resolveLikeName(sub);
371
385
  if (found && text.includes(" OCCURS ")) {
372
- found = new Types.TableType(found, { withHeader: text.includes("WITH HEADER LINE") }, name);
386
+ found = new Types.TableType(found, { withHeader: text.includes("WITH HEADER LINE") }, qualifiedName);
373
387
  }
374
388
  }
375
389
  else if (text.startsWith("TYPE LINE OF ")) {
@@ -392,13 +406,13 @@ class BasicTypes {
392
406
  }
393
407
  }
394
408
  else if (text.startsWith("TYPE REF TO ")) {
395
- found = this.resolveTypeRef(typename);
409
+ found = this.resolveTypeRef(typeName);
396
410
  }
397
411
  else if (text.startsWith("TYPE")) {
398
- found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node), name);
412
+ found = this.resolveTypeName(typeName, this.findLength(node), this.findDecimals(node), qualifiedName);
399
413
  const concat = node.concatTokens().toUpperCase();
400
414
  if (found && concat.includes(" OCCURS ")) {
401
- found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, name);
415
+ found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, qualifiedName);
402
416
  }
403
417
  else if (found && concat.includes("WITH HEADER LINE")) {
404
418
  if (found instanceof Types.VoidType) {
@@ -411,7 +425,7 @@ class BasicTypes {
411
425
  found = new Types.TableType(found.getRowType(), { withHeader: true });
412
426
  }
413
427
  }
414
- if (found === undefined && typename === undefined) {
428
+ if (found === undefined && typeName === undefined) {
415
429
  let length = 1;
416
430
  const len = node.findDirectExpression(Expressions.ConstantFieldLength);
417
431
  if (len) {
@@ -420,9 +434,9 @@ class BasicTypes {
420
434
  length = parseInt(int.concatTokens(), 10);
421
435
  }
422
436
  }
423
- found = new Types.CharacterType(length, name); // fallback
437
+ found = new Types.CharacterType(length, qualifiedName); // fallback
424
438
  if (concat.includes(" OCCURS ")) {
425
- found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, name);
439
+ found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, qualifiedName);
426
440
  }
427
441
  }
428
442
  }
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.88.3";
71
+ return "2.88.6";
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.88.3",
3
+ "version": "2.88.6",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",