@abaplint/core 2.105.18 → 2.105.20

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.
@@ -438,6 +438,7 @@ declare namespace BasicTypes {
438
438
  CLikeType,
439
439
  CSequenceType,
440
440
  DataReference,
441
+ DataType,
441
442
  DateType,
442
443
  DecFloatType,
443
444
  DecFloat16Type,
@@ -1556,6 +1557,14 @@ declare class DataReference extends AbstractType {
1556
1557
  toCDS(): string;
1557
1558
  }
1558
1559
 
1560
+ declare class DataType extends AbstractType {
1561
+ toText(): string;
1562
+ toABAP(): string;
1563
+ isGeneric(): boolean;
1564
+ containsVoid(): boolean;
1565
+ toCDS(): string;
1566
+ }
1567
+
1559
1568
  declare class DateType extends AbstractType {
1560
1569
  toText(): string;
1561
1570
  isGeneric(): boolean;
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
6
  class RaiseWith extends combi_1.Expression {
7
7
  getRunnable() {
8
- const wit = (0, combi_1.seq)("WITH", _1.SimpleSource3, (0, combi_1.opt)(_1.SimpleSource3), (0, combi_1.opt)(_1.SimpleSource3), (0, combi_1.opt)(_1.SimpleSource3));
8
+ const wit = (0, combi_1.seq)("WITH", _1.SimpleSource1, (0, combi_1.opt)(_1.SimpleSource1), (0, combi_1.opt)(_1.SimpleSource1), (0, combi_1.opt)(_1.SimpleSource1));
9
9
  return wit;
10
10
  }
11
11
  }
@@ -74,6 +74,7 @@ class TypeUtils {
74
74
  || type instanceof basic_1.CSequenceType
75
75
  || type instanceof cgeneric_type_1.CGenericType
76
76
  || type instanceof basic_1.DateType
77
+ || type instanceof basic_1.DataType
77
78
  || type instanceof basic_1.CLikeType
78
79
  || type instanceof basic_1.PackedType
79
80
  || type instanceof basic_1.TimeType) {
@@ -304,7 +305,9 @@ class TypeUtils {
304
305
  else if (target instanceof basic_1.CLikeType) {
305
306
  return this.isCharLikeStrict(source);
306
307
  }
307
- else if (target instanceof basic_1.VoidType || target instanceof basic_1.AnyType) {
308
+ else if (target instanceof basic_1.VoidType
309
+ || target instanceof basic_1.AnyType
310
+ || target instanceof basic_1.DataType) {
308
311
  return true;
309
312
  }
310
313
  return false;
@@ -366,6 +369,7 @@ class TypeUtils {
366
369
  }
367
370
  if (source instanceof basic_1.VoidType
368
371
  || source instanceof basic_1.AnyType
372
+ || source instanceof basic_1.DataType
369
373
  || source instanceof basic_1.UnknownType) {
370
374
  return true;
371
375
  }
@@ -410,6 +414,7 @@ class TypeUtils {
410
414
  if (source instanceof basic_1.ObjectReferenceType
411
415
  || source instanceof basic_1.GenericObjectReferenceType
412
416
  || source instanceof basic_1.VoidType
417
+ || source instanceof basic_1.DataType
413
418
  || source instanceof basic_1.AnyType
414
419
  || source instanceof basic_1.UnknownType) {
415
420
  return true;
@@ -419,6 +424,7 @@ class TypeUtils {
419
424
  else if (target instanceof basic_1.DataReference) {
420
425
  if (source instanceof basic_1.DataReference
421
426
  || source instanceof basic_1.VoidType
427
+ || source instanceof basic_1.DataType
422
428
  || source instanceof basic_1.AnyType
423
429
  || source instanceof basic_1.UnknownType) {
424
430
  return true;
@@ -431,6 +437,7 @@ class TypeUtils {
431
437
  }
432
438
  else if (source instanceof basic_1.VoidType
433
439
  || source instanceof basic_1.AnyType
440
+ || source instanceof basic_1.DataType
434
441
  || source instanceof basic_1.UnknownType) {
435
442
  return true;
436
443
  }
@@ -837,7 +837,7 @@ class BasicTypes {
837
837
  return new Types.DataReference(found);
838
838
  }
839
839
  else if (chain.concatTokens().toUpperCase() === "DATA") {
840
- return new Types.DataReference(new Types.AnyType());
840
+ return new Types.DataReference(new Types.DataType());
841
841
  }
842
842
  if (this.scope.isBadiDef(name) === true) {
843
843
  return new Types.VoidType(name);
@@ -6,6 +6,7 @@ class Dereference {
6
6
  runSyntax(type) {
7
7
  if (type instanceof basic_1.VoidType
8
8
  || type instanceof basic_1.AnyType
9
+ || type instanceof basic_1.DataType
9
10
  || type === undefined
10
11
  || type instanceof basic_1.UnknownType) {
11
12
  return type;
@@ -5,7 +5,7 @@ const Expressions = require("../../2_statements/expressions");
5
5
  const source_1 = require("./source");
6
6
  class RaiseWith {
7
7
  runSyntax(node, scope, filename) {
8
- for (const f of node.findDirectExpressions(Expressions.SimpleSource3)) {
8
+ for (const f of node.findDirectExpressions(Expressions.SimpleSource1)) {
9
9
  new source_1.Source().runSyntax(f, scope, filename);
10
10
  }
11
11
  }
@@ -42,6 +42,7 @@ class Loop {
42
42
  }
43
43
  else if (!(sourceType instanceof basic_1.TableType)
44
44
  && !(sourceType instanceof basic_1.AnyType)
45
+ && !(sourceType instanceof basic_1.DataType)
45
46
  && !(sourceType instanceof basic_1.VoidType)
46
47
  && concat.startsWith("LOOP AT GROUP ") === false) {
47
48
  throw new Error("Loop, not a table type");
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataReference = void 0;
4
4
  const _abstract_type_1 = require("./_abstract_type");
5
+ const any_type_1 = require("./any_type");
5
6
  class DataReference extends _abstract_type_1.AbstractType {
6
7
  constructor(type, qualifiedName) {
7
8
  super({ qualifiedName: qualifiedName });
@@ -21,7 +22,9 @@ class DataReference extends _abstract_type_1.AbstractType {
21
22
  return "REF TO " + this.type.toABAP();
22
23
  }
23
24
  isGeneric() {
24
- // a DATA definition can be "REF TO data", so its not generic
25
+ if (this.type instanceof any_type_1.AnyType) {
26
+ return true;
27
+ }
25
28
  return false;
26
29
  }
27
30
  containsVoid() {
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataType = void 0;
4
+ const _abstract_type_1 = require("./_abstract_type");
5
+ class DataType extends _abstract_type_1.AbstractType {
6
+ toText() {
7
+ return "```data```";
8
+ }
9
+ toABAP() {
10
+ return "data";
11
+ }
12
+ isGeneric() {
13
+ return true;
14
+ }
15
+ containsVoid() {
16
+ return false;
17
+ }
18
+ toCDS() {
19
+ return "abap.TODO_DATA";
20
+ }
21
+ }
22
+ exports.DataType = DataType;
23
+ //# sourceMappingURL=data_type.js.map
@@ -20,6 +20,7 @@ __exportStar(require("./character_type"), exports);
20
20
  __exportStar(require("./clike_type"), exports);
21
21
  __exportStar(require("./csequence_type"), exports);
22
22
  __exportStar(require("./data_reference_type"), exports);
23
+ __exportStar(require("./data_type"), exports);
23
24
  __exportStar(require("./date_type"), exports);
24
25
  __exportStar(require("./decfloat_type"), exports);
25
26
  __exportStar(require("./decfloat16_type"), exports);
package/build/src/ddic.js CHANGED
@@ -68,7 +68,7 @@ class DDIC {
68
68
  case "TABLE":
69
69
  return new Types.TableType(new Types.AnyType(), { withHeader: false, keyType: Types.TableKeyType.default });
70
70
  case "DATA":
71
- return new Types.AnyType({ qualifiedName: qualifiedName });
71
+ return new Types.DataType({ qualifiedName: qualifiedName });
72
72
  case "NUMERIC":
73
73
  return new Types.NumericGenericType({ qualifiedName: qualifiedName });
74
74
  case "UTCLONG": // todo, take version into account
@@ -126,7 +126,7 @@ class TableType extends _abstract_object_1.AbstractObject {
126
126
  type = new Types.TableType(new basic_1.GenericObjectReferenceType(), tableOptions, this.getName());
127
127
  }
128
128
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "DATA") {
129
- type = new Types.TableType(new basic_1.DataReference(new basic_1.AnyType()), tableOptions, this.getName());
129
+ type = new Types.TableType(new basic_1.DataReference(new Types.DataType()), tableOptions, this.getName());
130
130
  }
131
131
  else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype !== undefined) {
132
132
  const lookup = ddic.lookupObject(this.parsedXML.rowtype);
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.105.18";
68
+ return "2.105.20";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -1152,7 +1152,7 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
1152
1152
  }
1153
1153
  startToken = node.getFirstToken();
1154
1154
  }
1155
- const withs = ((_f = node.findDirectExpression(Expressions.RaiseWith)) === null || _f === void 0 ? void 0 : _f.findDirectExpressions(Expressions.SimpleSource3)) || [];
1155
+ const withs = ((_f = node.findDirectExpression(Expressions.RaiseWith)) === null || _f === void 0 ? void 0 : _f.findDirectExpressions(Expressions.SimpleSource1)) || [];
1156
1156
  const className = ((_g = node.findDirectExpression(Expressions.ClassName)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "ERROR";
1157
1157
  const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1158
1158
  const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
@@ -6,6 +6,7 @@ const Structures = require("../abap/3_structures/structures");
6
6
  const _abap_rule_1 = require("./_abap_rule");
7
7
  const _basic_rule_config_1 = require("./_basic_rule_config");
8
8
  const _irule_1 = require("./_irule");
9
+ const _statement_1 = require("../abap/2_statements/statements/_statement");
9
10
  class EmptyStructureConf extends _basic_rule_config_1.BasicRuleConfig {
10
11
  constructor() {
11
12
  super(...arguments);
@@ -60,6 +61,11 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
60
61
  if (stru === undefined) {
61
62
  return [];
62
63
  }
64
+ for (const statement of file.getStatements()) {
65
+ if (statement.get() instanceof _statement_1.Unknown) {
66
+ return []; // contains parser errors
67
+ }
68
+ }
63
69
  const candidates = [];
64
70
  if (this.getConfig().loop === true) {
65
71
  candidates.push(...stru.findAllStructuresRecursive(Structures.Loop));
@@ -7,6 +7,7 @@ const _basic_rule_config_1 = require("./_basic_rule_config");
7
7
  const _abap_rule_1 = require("./_abap_rule");
8
8
  const _irule_1 = require("./_irule");
9
9
  const nodes_1 = require("../abap/nodes");
10
+ const _statement_1 = require("../abap/2_statements/statements/_statement");
10
11
  class IdenticalContentsConf extends _basic_rule_config_1.BasicRuleConfig {
11
12
  }
12
13
  exports.IdenticalContentsConf = IdenticalContentsConf;
@@ -52,6 +53,11 @@ WRITE 'world'.`,
52
53
  if (structure === undefined) {
53
54
  return [];
54
55
  }
56
+ for (const statement of file.getStatements()) {
57
+ if (statement.get() instanceof _statement_1.Unknown) {
58
+ return []; // contains parser errors
59
+ }
60
+ }
55
61
  for (const i of structure.findAllStructuresRecursive(Structures.If)) {
56
62
  issues = issues.concat(this.analyzeIf(file, i));
57
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.105.18",
3
+ "version": "2.105.20",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "homepage": "https://abaplint.org",
52
52
  "devDependencies": {
53
- "@microsoft/api-extractor": "^7.40.2",
53
+ "@microsoft/api-extractor": "^7.40.3",
54
54
  "@types/chai": "^4.3.11",
55
55
  "@types/mocha": "^10.0.6",
56
56
  "@types/node": "^20.11.19",