@abaplint/core 2.79.1 → 2.79.2

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.
@@ -18,6 +18,12 @@ class FieldAssignment {
18
18
  let type = undefined;
19
19
  if (targetType instanceof basic_1.StructureType) {
20
20
  type = targetType.getComponentByName(name);
21
+ if (type === undefined && targetType.containsVoid() === false) {
22
+ throw new Error(`field ${name} does not exist in structure`);
23
+ }
24
+ }
25
+ else if (targetType instanceof basic_1.VoidType) {
26
+ type = targetType;
21
27
  }
22
28
  new source_1.Source().runSyntax(s, scope, filename, type);
23
29
  }
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.79.1";
71
+ return "2.79.2";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -62,8 +62,20 @@ class ConstantClasses {
62
62
  // possibly this is not even a domain with fixed values
63
63
  issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Domain ${configEntry.domain} does not contain any fixed values. Either add some values or disable this check`, this.getMetadata().key, this.conf.severity));
64
64
  }
65
+ // later we will raise an issue if we did not find it
66
+ let domainNameConstantFound = false;
65
67
  for (const constant of def.constants) {
66
- if (configEntry.useExactType && constant.typeName !== configEntry.domain) {
68
+ if (configEntry.constantForDomainName
69
+ && constant.name === configEntry.constantForDomainName) {
70
+ // we require the constant value to be uppercase just in case
71
+ // in the config it does not matter
72
+ if (constant.value !== configEntry.domain.toLocaleUpperCase()) {
73
+ issues.push(this.issueAtConstant(constant, `Constant value ${constant.value} must match domain name ${configEntry.domain} `));
74
+ }
75
+ domainNameConstantFound = true;
76
+ continue;
77
+ }
78
+ if (configEntry.useExactType && constant.typeName.toLowerCase() !== configEntry.domain.toLowerCase()) {
67
79
  issues.push(this.issueAtConstant(constant, `Use exact type ${configEntry.domain} instead of ${constant.typeName}`));
68
80
  // quickfix will change the type
69
81
  }
@@ -78,10 +90,13 @@ class ConstantClasses {
78
90
  }
79
91
  for (const d of domainValueInfo) {
80
92
  if (!def.constants.find(c => c.value === d.value)) {
81
- issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Missing constant for ${d} (domain ${configEntry.domain})`, this.getMetadata().key, this.conf.severity));
93
+ issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Missing constant for ${d.value} (domain ${configEntry.domain})`, this.getMetadata().key, this.conf.severity));
82
94
  // quickfix will add constant
83
95
  }
84
96
  }
97
+ if (configEntry.constantForDomainName && !domainNameConstantFound) {
98
+ issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Missing constant ${configEntry.constantForDomainName} for name of domain ${configEntry.domain}`, this.getMetadata().key, this.conf.severity));
99
+ }
85
100
  return issues;
86
101
  }
87
102
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.79.1",
3
+ "version": "2.79.2",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",