@abaplint/core 2.120.40 → 2.120.42
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.
|
@@ -347,21 +347,21 @@ class SQLFunction extends combi_1.Expression {
|
|
|
347
347
|
const fn = (name, params, v) => {
|
|
348
348
|
const nameReg = (0, combi_1.regex)(new RegExp("^" + name + "$", "i"));
|
|
349
349
|
if (params === 0) {
|
|
350
|
-
return (0, combi_1.ver)(v, (0, combi_1.seq)(nameReg, (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
350
|
+
return (0, combi_1.ver)(v, (0, combi_1.seq)(nameReg, (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.tok)(tokens_1.WParenRightW)), { also: combi_1.AlsoIn.OpenABAP });
|
|
351
351
|
}
|
|
352
352
|
else if (params === VARIADIC) {
|
|
353
|
-
return (0, combi_1.ver)(v, (0, combi_1.seq)(nameReg, (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.starPrio)(commaParam), (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
353
|
+
return (0, combi_1.ver)(v, (0, combi_1.seq)(nameReg, (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.starPrio)(commaParam), (0, combi_1.tok)(tokens_1.WParenRightW)), { also: combi_1.AlsoIn.OpenABAP });
|
|
354
354
|
}
|
|
355
355
|
else {
|
|
356
356
|
const extra = [];
|
|
357
357
|
for (let i = 1; i < params; i++) {
|
|
358
358
|
extra.push(commaParam);
|
|
359
359
|
}
|
|
360
|
-
return (0, combi_1.ver)(v, (0, combi_1.seq)(nameReg, (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, ...extra, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
360
|
+
return (0, combi_1.ver)(v, (0, combi_1.seq)(nameReg, (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, ...extra, (0, combi_1.tok)(tokens_1.WParenRightW)), { also: combi_1.AlsoIn.OpenABAP });
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
363
|
const castInput = (0, combi_1.altPrio)(sql_case_1.SQLCase, sql_function_input_1.SQLFunctionInput);
|
|
364
|
-
const cast = (0, combi_1.ver)(version_1.Release.v750, (0, combi_1.seq)((0, combi_1.regex)(/^cast$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), castInput, "AS", castTypes, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
364
|
+
const cast = (0, combi_1.ver)(version_1.Release.v750, (0, combi_1.seq)((0, combi_1.regex)(/^cast$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), castInput, "AS", castTypes, (0, combi_1.tok)(tokens_1.WParenRightW)), { also: combi_1.AlsoIn.OpenABAP });
|
|
365
365
|
const hostParen = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
366
366
|
const hostVar = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(simple_source3_1.SimpleSource3, hostParen));
|
|
367
367
|
const abapOnly = (0, combi_1.altPrio)(constant_1.Constant, hostVar);
|
|
@@ -371,7 +371,7 @@ class SQLFunction extends combi_1.Expression {
|
|
|
371
371
|
const kvs = params.map(p => (0, combi_1.seq)((0, combi_1.regex)(new RegExp("^" + p.name + "$", "i")), "=", valueFor(p)));
|
|
372
372
|
const anyKv = kvs.length === 1 ? kvs[0] : (0, combi_1.altPrio)(kvs[0], kvs[1], ...kvs.slice(2));
|
|
373
373
|
const body = (0, combi_1.optPrio)((0, combi_1.seq)(anyKv, (0, combi_1.starPrio)((0, combi_1.seq)(",", anyKv))));
|
|
374
|
-
return (0, combi_1.ver)(v, (0, combi_1.seq)(nameReg, (0, combi_1.tok)(tokens_1.ParenLeftW), body, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
374
|
+
return (0, combi_1.ver)(v, (0, combi_1.seq)(nameReg, (0, combi_1.tok)(tokens_1.ParenLeftW), body, (0, combi_1.tok)(tokens_1.WParenRightW)), { also: combi_1.AlsoIn.OpenABAP });
|
|
375
375
|
};
|
|
376
376
|
return (0, combi_1.altPrio)(cast, sql_replace_regexpr_1.SQLReplaceRegexpr, sql_occurrences_regexpr_1.SQLOccurrencesRegexpr, sql_substring_regexpr_1.SQLSubstringRegexpr, sql_locate_regexpr_1.SQLLocateRegexpr, ...exports.sqlFunctionDefs.map(([name, params, v]) => fn(name, params, v)), ...exports.sqlNamedFunctionDefs.map(([name, v, params]) => namedFn(name, v, params)), ...exports.sqlSpatialFunctionDefs.map(([name, params, v]) => fn(name, params, v)), ...exports.sqlSpatialAggregateDefs.map(([name, params, v]) => fn(name, params, v)));
|
|
377
377
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -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)) {
|