@abaplint/core 2.102.6 → 2.102.8

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.
@@ -6120,6 +6120,7 @@ declare class TableType extends AbstractObject {
6120
6120
  };
6121
6121
  getDescription(): string | undefined;
6122
6122
  setDirty(): void;
6123
+ private buildPrimaryKey;
6123
6124
  private buildTableOptions;
6124
6125
  parseType(reg: IRegistry): AbstractType;
6125
6126
  private parseXML;
@@ -16,7 +16,12 @@ class BuiltInMethod extends _identifier_1.Identifier {
16
16
  this.row = row;
17
17
  }
18
18
  getRequiredParameters() {
19
- return [];
19
+ const ret = [];
20
+ for (const i in this.method.mandatory) {
21
+ const id = new tokens_1.Identifier(new position_1.Position(this.row, 1), i);
22
+ ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, this.method.mandatory[i]));
23
+ }
24
+ return ret;
20
25
  }
21
26
  getOptional() {
22
27
  throw new Error("BuiltInMethod->Method not implemented.");
@@ -13,7 +13,7 @@ class Assign {
13
13
  const theSource = sources[sources.length - 1];
14
14
  let sourceType = new source_1.Source().runSyntax(theSource, scope, filename);
15
15
  if (sourceType === undefined || ((_b = node.findDirectExpression(Expressions.AssignSource)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Dynamic))) {
16
- sourceType = new basic_1.VoidType("DynamicAssign");
16
+ sourceType = new basic_1.AnyType();
17
17
  }
18
18
  for (const d of ((_c = node.findDirectExpression(Expressions.AssignSource)) === null || _c === void 0 ? void 0 : _c.findAllExpressions(Expressions.Dynamic)) || []) {
19
19
  new dynamic_1.Dynamic().runSyntax(d, scope, filename);
@@ -5,10 +5,15 @@ const Expressions = require("../../2_statements/expressions");
5
5
  const _reference_1 = require("../_reference");
6
6
  class ClassLocalFriends {
7
7
  runSyntax(node, scope, filename) {
8
- const found = node.findDirectExpression(Expressions.ClassName);
8
+ const classNames = node.findAllExpressions(Expressions.ClassName);
9
+ const found = classNames[0];
9
10
  if (found) {
10
11
  const token = found.getFirstToken();
11
12
  const name = token.getStr();
13
+ if (scope.getParentObj().getType() === "CLAS"
14
+ && name.toUpperCase() !== scope.getParentObj().getName().toUpperCase()) {
15
+ throw new Error(`Befriending must be ` + scope.getParentObj().getName().toUpperCase());
16
+ }
12
17
  const def = scope.findClassDefinition(name);
13
18
  if (def) {
14
19
  scope.addReference(token, def, _reference_1.ReferenceType.ObjectOrientedReference, filename);
@@ -17,6 +22,14 @@ class ClassLocalFriends {
17
22
  throw new Error(`Class ${name.toUpperCase()} not found`);
18
23
  }
19
24
  }
25
+ for (let i = 1; i < classNames.length; i++) {
26
+ const className = classNames[i].concatTokens();
27
+ // make sure to check also DEFINITION DEFERRED
28
+ const found = scope.existsObject(className);
29
+ if (found.found === false) {
30
+ throw new Error(`Class ${className.toUpperCase()} not found`);
31
+ }
32
+ }
20
33
  }
21
34
  }
22
35
  exports.ClassLocalFriends = ClassLocalFriends;
@@ -29,46 +29,45 @@ class TableType extends _abstract_object_1.AbstractObject {
29
29
  this.parsedXML = undefined;
30
30
  super.setDirty();
31
31
  }
32
- buildTableOptions() {
33
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
34
- let primaryKey = undefined;
35
- if (((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.accessmode) === "S") {
36
- primaryKey = {
37
- isUnique: ((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.keykind) === "U",
38
- type: basic_1.TableAccessType.sorted,
39
- keyFields: [],
40
- name: "primary_key",
41
- };
32
+ buildPrimaryKey() {
33
+ var _a, _b, _c, _d, _e;
34
+ const primaryKey = {
35
+ isUnique: ((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.keykind) === "U",
36
+ type: basic_1.TableAccessType.standard,
37
+ keyFields: [],
38
+ name: "primary_key",
39
+ };
40
+ if (((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.accessmode) === "S") {
41
+ primaryKey.type = basic_1.TableAccessType.sorted;
42
42
  }
43
43
  else if (((_c = this.parsedXML) === null || _c === void 0 ? void 0 : _c.accessmode) === "H") {
44
- primaryKey = {
45
- isUnique: ((_d = this.parsedXML) === null || _d === void 0 ? void 0 : _d.keykind) === "U",
46
- type: basic_1.TableAccessType.hashed,
47
- keyFields: [],
48
- name: "primary_key",
49
- };
50
- }
51
- for (const f of ((_e = this.parsedXML) === null || _e === void 0 ? void 0 : _e.dd42v) || []) {
44
+ primaryKey.type = basic_1.TableAccessType.hashed;
45
+ }
46
+ for (const f of ((_d = this.parsedXML) === null || _d === void 0 ? void 0 : _d.dd42v) || []) {
52
47
  if (f.keyname === "") {
53
- primaryKey === null || primaryKey === void 0 ? void 0 : primaryKey.keyFields.push(f.keyfield);
48
+ primaryKey.keyFields.push(f.keyfield);
54
49
  }
55
50
  }
56
- if (((_f = this.parsedXML) === null || _f === void 0 ? void 0 : _f.keydef) === "T" && (primaryKey === null || primaryKey === void 0 ? void 0 : primaryKey.keyFields.length) === 0) {
57
- primaryKey === null || primaryKey === void 0 ? void 0 : primaryKey.keyFields.push("table_line");
51
+ if (((_e = this.parsedXML) === null || _e === void 0 ? void 0 : _e.keydef) === "T" && primaryKey.keyFields.length === 0) {
52
+ primaryKey.keyFields.push("table_line");
58
53
  }
54
+ return primaryKey;
55
+ }
56
+ buildTableOptions() {
57
+ var _a, _b, _c, _d;
59
58
  let keyType = Types.TableKeyType.user;
60
- if (((_g = this.parsedXML) === null || _g === void 0 ? void 0 : _g.keydef) === "D") {
59
+ if (((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.keydef) === "D") {
61
60
  keyType = Types.TableKeyType.default;
62
61
  }
63
62
  const tableOptions = {
64
63
  withHeader: false,
65
64
  keyType: keyType,
66
- primaryKey: primaryKey,
65
+ primaryKey: this.buildPrimaryKey(),
67
66
  secondary: [],
68
67
  };
69
- for (const k of ((_h = this.parsedXML) === null || _h === void 0 ? void 0 : _h.dd43v) || []) {
68
+ for (const k of ((_b = this.parsedXML) === null || _b === void 0 ? void 0 : _b.dd43v) || []) {
70
69
  const fields = [];
71
- for (const f of ((_j = this.parsedXML) === null || _j === void 0 ? void 0 : _j.dd42v) || []) {
70
+ for (const f of ((_c = this.parsedXML) === null || _c === void 0 ? void 0 : _c.dd42v) || []) {
72
71
  if (f.keyname === k.keyname) {
73
72
  fields.push(f.keyfield);
74
73
  }
@@ -84,7 +83,7 @@ class TableType extends _abstract_object_1.AbstractObject {
84
83
  default:
85
84
  break;
86
85
  }
87
- (_k = tableOptions.secondary) === null || _k === void 0 ? void 0 : _k.push({
86
+ (_d = tableOptions.secondary) === null || _d === void 0 ? void 0 : _d.push({
88
87
  name: k.keyname,
89
88
  type: accessType,
90
89
  keyFields: fields,
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.102.6";
68
+ return "2.102.8";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -29,6 +29,9 @@ class CyclomaticComplexity {
29
29
  }
30
30
  setConfig(conf) {
31
31
  this.conf = conf;
32
+ if (this.conf.max === undefined) {
33
+ this.conf.max = new CyclomaticComplexityConf().max;
34
+ }
32
35
  }
33
36
  initialize(_reg) {
34
37
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.102.6",
3
+ "version": "2.102.8",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -53,11 +53,11 @@
53
53
  "@microsoft/api-extractor": "^7.36.3",
54
54
  "@types/chai": "^4.3.5",
55
55
  "@types/mocha": "^10.0.1",
56
- "@types/node": "^20.4.4",
56
+ "@types/node": "^20.4.5",
57
57
  "chai": "^4.3.7",
58
- "eslint": "^8.45.0",
58
+ "eslint": "^8.46.0",
59
59
  "mocha": "^10.2.0",
60
- "c8": "^8.0.0",
60
+ "c8": "^8.0.1",
61
61
  "source-map-support": "^0.5.21",
62
62
  "ts-json-schema-generator": "^1.2.0",
63
63
  "typescript": "^5.1.6"