@abaplint/core 2.120.41 → 2.120.43

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.
@@ -5628,9 +5628,11 @@ declare type ParsedDataDefinition = {
5628
5628
  sqlViewName: string | undefined;
5629
5629
  definitionName: string | undefined;
5630
5630
  description: string | undefined;
5631
+ /** name is the name of the element, nameInSource the name in the prefixed source, if aliased via "as" */
5631
5632
  fields: {
5632
5633
  key: boolean;
5633
5634
  name: string;
5635
+ nameInSource?: string;
5634
5636
  prefix: string;
5635
5637
  annotations: string[];
5636
5638
  }[];
@@ -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
  }
@@ -13,7 +13,7 @@ class Write {
13
13
  const to = (0, combi_1.seq)("TO", expressions_1.Target);
14
14
  const options = (0, combi_1.per)(mask, to, (0, combi_1.seq)("EXPONENT", expressions_1.Source), "NO-GROUPING", "NO-ZERO", "CENTERED", (0, combi_1.seq)("INPUT", (0, combi_1.opt)(onOff)), "NO-GAP", "LEFT-JUSTIFIED", as, (0, combi_1.seq)("FRAMES", onOff), (0, combi_1.seq)("HOTSPOT", (0, combi_1.opt)(onOff)), "RIGHT-JUSTIFIED", (0, combi_1.seq)("TIME ZONE", expressions_1.Source), (0, combi_1.seq)("UNDER", expressions_1.Source), (0, combi_1.seq)("STYLE", expressions_1.Source), (0, combi_1.seq)("ROUND", expressions_1.Source), (0, combi_1.seq)("QUICKINFO", expressions_1.Source), "ENVIRONMENT TIME FORMAT", dateFormat, (0, combi_1.seq)("UNIT", expressions_1.Source), (0, combi_1.seq)("INTENSIFIED", (0, combi_1.opt)(onOff)), (0, combi_1.seq)("INDEX", expressions_1.Source), (0, combi_1.seq)("DECIMALS", expressions_1.Source), (0, combi_1.seq)("INVERSE", (0, combi_1.opt)(onOff)), expressions_1.Color, (0, combi_1.seq)("CURRENCY", expressions_1.Source), "RESET", "NO-SIGN");
15
15
  // Need to refactor all this sometime,
16
- const ret = (0, combi_1.seq)("WRITE", (0, combi_1.alt)((0, combi_1.seq)("AT /", (0, combi_1.opt)(expressions_1.Source), (0, combi_1.opt)("NO-GAP")), (0, combi_1.seq)((0, combi_1.opt)(expressions_1.WriteOffsetLength), (0, combi_1.alt)(expressions_1.Source, expressions_1.Dynamic, "/"), (0, combi_1.opt)(options))));
16
+ const ret = (0, combi_1.seq)("WRITE", (0, combi_1.alt)((0, combi_1.seq)("AT /", (0, combi_1.opt)(expressions_1.Source), (0, combi_1.opt)(options)), (0, combi_1.seq)((0, combi_1.opt)(expressions_1.WriteOffsetLength), (0, combi_1.alt)(expressions_1.Source, expressions_1.Dynamic, "/"), (0, combi_1.opt)(options))));
17
17
  return (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, ret);
18
18
  }
19
19
  }
@@ -5,6 +5,7 @@ const basic_1 = require("../abap/types/basic");
5
5
  const ddic_1 = require("../ddic");
6
6
  class CDSDetermineTypes {
7
7
  parseType(reg, parsedData, ddlsName) {
8
+ var _a;
8
9
  const ddic = new ddic_1.DDIC(reg);
9
10
  if ((parsedData === null || parsedData === void 0 ? void 0 : parsedData.fields.length) === 0) {
10
11
  return basic_1.VoidType.get("DDLS:todo");
@@ -41,10 +42,11 @@ class CDSDetermineTypes {
41
42
  });
42
43
  continue;
43
44
  }
45
+ const nameInSource = (_a = f.nameInSource) !== null && _a !== void 0 ? _a : f.name;
44
46
  const lookup = ddic.lookupTableOrView(source.name);
45
47
  if (lookup.type) {
46
48
  if (lookup.type instanceof basic_1.StructureType) {
47
- const type = lookup.type.getComponentByName(f.name);
49
+ const type = lookup.type.getComponentByName(nameInSource);
48
50
  if (type) {
49
51
  components.push({
50
52
  name: f.name,
@@ -54,7 +56,7 @@ class CDSDetermineTypes {
54
56
  else {
55
57
  components.push({
56
58
  name: f.name,
57
- type: new basic_1.UnknownType(f.name + " not found in " + source.name + ", CDSDetermineTypes"),
59
+ type: new basic_1.UnknownType(nameInSource + " not found in " + source.name + ", CDSDetermineTypes"),
58
60
  });
59
61
  }
60
62
  }
@@ -138,19 +138,18 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
138
138
  }
139
139
  for (const e of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressions(expressions_1.CDSElement)) || []) {
140
140
  let prefix = "";
141
+ let nameInSource = undefined;
141
142
  let found = (_a = e.findDirectExpression(expressions_1.CDSAs)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.CDSName);
142
- if (found === undefined) {
143
- const list = (_b = e.findDirectExpression(expressions_1.CDSPrefixedName)) === null || _b === void 0 ? void 0 : _b.findAllExpressions(expressions_1.CDSName);
144
- if (list) {
145
- if (e.concatTokens().toUpperCase().includes(" REDIRECTED TO ")) {
146
- found = list[0];
147
- }
148
- else {
149
- found = list[list.length - 1];
150
- if (list.length > 1) {
151
- prefix = list[0].concatTokens();
152
- }
153
- }
143
+ const list = (_b = e.findDirectExpression(expressions_1.CDSPrefixedName)) === null || _b === void 0 ? void 0 : _b.findAllExpressions(expressions_1.CDSName);
144
+ if (list !== undefined) {
145
+ const redirected = list.length > 1 && e.concatTokens().toUpperCase().includes(" REDIRECTED TO ");
146
+ if (list.length > 1 && redirected === false) {
147
+ // "prefix.field" is looked up as "field" in "prefix", also when aliased via "as"
148
+ prefix = list[0].concatTokens();
149
+ nameInSource = list[list.length - 1].concatTokens();
150
+ }
151
+ if (found === undefined) {
152
+ found = redirected === true ? list[0] : list[list.length - 1];
154
153
  }
155
154
  }
156
155
  if (found === undefined) {
@@ -172,6 +171,7 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
172
171
  }
173
172
  this.parsedData.fields.push({
174
173
  name: name,
174
+ nameInSource: nameInSource,
175
175
  annotations: annotations,
176
176
  prefix: prefix,
177
177
  key: e.findDirectTokenByText("KEY") !== undefined,
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.41";
78
+ return "2.120.43";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
@@ -46,6 +46,8 @@ class XMLConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
46
46
  super(...arguments);
47
47
  /** Problem severity for text and translation length checks */
48
48
  this.textAndTranslationLengthSeverity = severity_1.Severity.Error;
49
+ /** Problem severity for data element(DTEL) field checks */
50
+ this.dataElementSeverity = severity_1.Severity.Error;
49
51
  }
50
52
  }
51
53
  exports.XMLConsistencyConf = XMLConsistencyConf;
@@ -254,7 +256,7 @@ class XMLConsistency {
254
256
  }
255
257
  checkRequiredField(file, fieldName, value) {
256
258
  if (value === undefined || value === "") {
257
- return issue_1.Issue.atRow(file, 1, `Missing required field ${fieldName} in DD04V`, this.getMetadata().key, this.conf.severity);
259
+ return issue_1.Issue.atRow(file, 1, `Missing required field ${fieldName} in DD04V`, this.getMetadata().key, this.conf.dataElementSeverity);
258
260
  }
259
261
  return undefined;
260
262
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.120.41",
3
+ "version": "2.120.43",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",