@abaplint/core 2.120.40 → 2.120.41

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.
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.40";
78
+ return "2.120.41";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
@@ -18,7 +18,7 @@ const KNOWN_CURR_DATA_ELEMENTS = ["BWERT", "DZWERT"];
18
18
  const RESERVED_ELEMENT_NAMES = ["BEGIN", "NUMBER", "POSITION"];
19
19
  const MAX_LABEL_LENGTH = 40;
20
20
  // Annotations which are not supported in CDS view entities
21
- const VIEW_ENTITY_FORBIDDEN_ANNOTATIONS = ["Semantics.unitOfMeasure"];
21
+ const VIEW_ENTITY_FORBIDDEN_ANNOTATIONS = ["Semantics.unitOfMeasure", "Semantics.currencyCode"];
22
22
  class CDSCheckSyntax {
23
23
  constructor() {
24
24
  this.conf = new CDSCheckSyntaxConf();
@@ -62,6 +62,7 @@ Missing objects are only reported when their names match the configured errorNam
62
62
  this.checkFieldAnnotations(tree, ddic, issues, file);
63
63
  this.checkLabels(tree, issues, file);
64
64
  this.checkViewEntityAnnotations(tree, issues, file);
65
+ this.checkSearchable(tree, issues, file);
65
66
  this.checkReservedNames(tree, issues, file);
66
67
  this.checkFields(tree, sources, object, issues, file);
67
68
  return issues;
@@ -283,6 +284,29 @@ Missing objects are only reported when their names match the configured errorNam
283
284
  }
284
285
  }
285
286
  }
287
+ checkSearchable(tree, issues, file) {
288
+ let searchable;
289
+ for (const annotation of tree.findAllExpressionsRecursive(expressions_1.CDSAnnotation)) {
290
+ const normalized = annotation.concatTokens().replace(/\s/g, "").toUpperCase().replace(/^@</, "@");
291
+ if (this.hasSearchAnnotation(normalized, "defaultSearchElement")) {
292
+ return;
293
+ }
294
+ else if (searchable === undefined && this.hasSearchAnnotation(normalized, "searchable")) {
295
+ searchable = annotation;
296
+ }
297
+ }
298
+ if (searchable !== undefined) {
299
+ const message = "@Search.defaultSearchElement: true required on at least one element " +
300
+ "when @Search.searchable: true";
301
+ issues.push(issue_1.Issue.atToken(file, searchable.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
302
+ }
303
+ }
304
+ hasSearchAnnotation(normalized, name) {
305
+ if (normalized.startsWith("@SEARCH") === false) {
306
+ return false;
307
+ }
308
+ return new RegExp("[.{,]" + name.toUpperCase() + ":TRUE").test(normalized);
309
+ }
286
310
  checkReservedNames(tree, issues, file) {
287
311
  var _a, _b;
288
312
  for (const element of tree.findAllExpressionsRecursive(expressions_1.CDSElement)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.120.40",
3
+ "version": "2.120.41",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",