@abaplint/cli 2.120.47 → 2.120.49

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.
Files changed (2) hide show
  1. package/build/cli.js +122 -23
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -27471,6 +27471,13 @@ class TypeUtils {
27471
27471
  || type instanceof basic_1.UnknownType
27472
27472
  || type instanceof basic_1.VoidType;
27473
27473
  }
27474
+ isCharLikeForCompare(type) {
27475
+ return type === undefined
27476
+ || type instanceof basic_1.StringType
27477
+ || type instanceof basic_1.CLikeType
27478
+ || type instanceof basic_1.CSequenceType
27479
+ || this.isCharLikeField(type);
27480
+ }
27474
27481
  isCharLike(type) {
27475
27482
  if (type === undefined) {
27476
27483
  return false;
@@ -29812,6 +29819,7 @@ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/
29812
29819
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
29813
29820
  class Compare {
29814
29821
  static runSyntax(node, input) {
29822
+ var _a;
29815
29823
  const sourceTypes = [];
29816
29824
  const sources = node.findDirectExpressions(Expressions.Source);
29817
29825
  for (const t of sources) {
@@ -29823,8 +29831,16 @@ class Compare {
29823
29831
  for (const t of node.findDirectExpressions(Expressions.MethodCallChain)) {
29824
29832
  method_call_chain_1.MethodCallChain.runSyntax(t, input);
29825
29833
  }
29826
- if (node.findDirectExpression(Expressions.CompareOperator)
29827
- && new _type_utils_1.TypeUtils(input.scope).isCompareable(sourceTypes[0], sourceTypes[1], sources[0], sources[1]) === false
29834
+ const typeUtils = new _type_utils_1.TypeUtils(input.scope);
29835
+ const compareOperator = (_a = node.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
29836
+ if (compareOperator === "CS"
29837
+ && sourceTypes.length === 2
29838
+ && sourceTypes.some((type) => typeUtils.isCharLikeForCompare(type) === false)) {
29839
+ const message = "CS operands must be character-like (data type C, N, D, T, or STRING)";
29840
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
29841
+ }
29842
+ else if (node.findDirectExpression(Expressions.CompareOperator)
29843
+ && typeUtils.isCompareable(sourceTypes[0], sourceTypes[1], sources[0], sources[1]) === false
29828
29844
  && sourceTypes.length === 2) {
29829
29845
  let message = "Incompatible types for comparison";
29830
29846
  if ((sourceTypes[0] instanceof basic_1.DateType
@@ -63093,6 +63109,9 @@ const ddic_1 = __webpack_require__(/*! ../ddic */ "../core/build/src/ddic.js");
63093
63109
  const Types = __importStar(__webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js"));
63094
63110
  const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "../core/build/src/xml_utils.js");
63095
63111
  const domain_1 = __webpack_require__(/*! ./domain */ "../core/build/src/objects/domain.js");
63112
+ const _identifier_1 = __webpack_require__(/*! ../abap/4_file_information/_identifier */ "../core/build/src/abap/4_file_information/_identifier.js");
63113
+ const identifier_1 = __webpack_require__(/*! ../abap/1_lexer/tokens/identifier */ "../core/build/src/abap/1_lexer/tokens/identifier.js");
63114
+ const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
63096
63115
  class DataElement extends _abstract_object_1.AbstractObject {
63097
63116
  constructor() {
63098
63117
  super(...arguments);
@@ -63113,6 +63132,17 @@ class DataElement extends _abstract_object_1.AbstractObject {
63113
63132
  allowNamespace: true,
63114
63133
  };
63115
63134
  }
63135
+ getIdentifier() {
63136
+ const xmlIdentifier = super.getIdentifier();
63137
+ if (xmlIdentifier) {
63138
+ return xmlIdentifier;
63139
+ }
63140
+ const file = this.getAFFFile();
63141
+ if (file === undefined) {
63142
+ return undefined;
63143
+ }
63144
+ return new _identifier_1.Identifier(new identifier_1.Identifier(new position_1.Position(1, 1), this.getName()), file.getFilename());
63145
+ }
63116
63146
  setDirty() {
63117
63147
  this.parsedXML = undefined;
63118
63148
  this.parsedType = undefined;
@@ -63160,7 +63190,6 @@ class DataElement extends _abstract_object_1.AbstractObject {
63160
63190
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.dtelmaster;
63161
63191
  }
63162
63192
  parseType(reg) {
63163
- var _a;
63164
63193
  const references = [];
63165
63194
  let lookup = undefined;
63166
63195
  this.parse();
@@ -63172,7 +63201,53 @@ class DataElement extends _abstract_object_1.AbstractObject {
63172
63201
  return this.parsedType;
63173
63202
  }
63174
63203
  const ddic = new ddic_1.DDIC(reg);
63175
- if (this.parsedXML.refkind === "D") {
63204
+ const lookupPredefinedType = () => {
63205
+ var _a, _b;
63206
+ if (((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.datatype) === undefined || this.parsedXML.datatype === "") {
63207
+ return { type: new Types.UnknownType("DATATYPE unexpectely empty in " + this.getName()) };
63208
+ }
63209
+ return { type: ddic.textToType({
63210
+ text: this.parsedXML.datatype,
63211
+ length: this.parsedXML.leng,
63212
+ decimals: this.parsedXML.decimals,
63213
+ infoText: this.getName(),
63214
+ qualifiedName: this.getName(),
63215
+ conversionExit: undefined,
63216
+ ddicName: this.getName(),
63217
+ description: (_b = this.parsedXML.texts) === null || _b === void 0 ? void 0 : _b.heading,
63218
+ }) };
63219
+ };
63220
+ if (this.parsedXML.affCategory === "referenceToPredefinedType") {
63221
+ const predefined = lookupPredefinedType();
63222
+ lookup = predefined.type instanceof Types.UnknownType
63223
+ ? predefined
63224
+ : { type: new Types.DataReference(predefined.type, this.getName()) };
63225
+ }
63226
+ else if (this.parsedXML.affCategory === "referenceDictionaryType") {
63227
+ if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
63228
+ lookup = { type: new Types.UnknownType("Type name unexpectely empty in " + this.getName()) };
63229
+ }
63230
+ else {
63231
+ const referenced = ddic.lookup(this.parsedXML.domname);
63232
+ lookup = referenced.type instanceof Types.UnknownType
63233
+ ? referenced
63234
+ : Object.assign(Object.assign({}, referenced), { type: new Types.DataReference(referenced.type, this.getName()) });
63235
+ }
63236
+ }
63237
+ else if (this.parsedXML.affCategory === "referenceClasIntType") {
63238
+ if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
63239
+ lookup = { type: new Types.UnknownType("Type name unexpectely empty in " + this.getName()) };
63240
+ }
63241
+ else {
63242
+ lookup = ddic.lookupObject(this.parsedXML.domname);
63243
+ }
63244
+ }
63245
+ else if (this.parsedXML.affCategory !== undefined
63246
+ && this.parsedXML.affCategory !== "domain"
63247
+ && this.parsedXML.affCategory !== "predefinedType") {
63248
+ lookup = { type: new Types.UnknownType("Unknown AFF data type category " + this.parsedXML.affCategory + " in " + this.getName()) };
63249
+ }
63250
+ else if (this.parsedXML.refkind === "D") {
63176
63251
  if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
63177
63252
  lookup = { type: new Types.UnknownType("DOMNAME unexpectely empty in " + this.getName()) };
63178
63253
  }
@@ -63189,21 +63264,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
63189
63264
  }
63190
63265
  }
63191
63266
  else {
63192
- if (this.parsedXML.datatype === undefined || this.parsedXML.datatype === "") {
63193
- lookup = { type: new Types.UnknownType("DATATYPE unexpectely empty in " + this.getName()) };
63194
- }
63195
- else {
63196
- lookup = { type: ddic.textToType({
63197
- text: this.parsedXML.datatype,
63198
- length: this.parsedXML.leng,
63199
- decimals: this.parsedXML.decimals,
63200
- infoText: this.getName(),
63201
- qualifiedName: this.getName(),
63202
- conversionExit: undefined,
63203
- ddicName: this.getName(),
63204
- description: (_a = this.parsedXML.texts) === null || _a === void 0 ? void 0 : _a.heading,
63205
- }) };
63206
- }
63267
+ lookup = lookupPredefinedType();
63207
63268
  }
63208
63269
  }
63209
63270
  if (lookup.object) {
@@ -63218,17 +63279,52 @@ class DataElement extends _abstract_object_1.AbstractObject {
63218
63279
  return lookup.type;
63219
63280
  }
63220
63281
  parse() {
63221
- var _a, _b, _c, _d, _e, _f, _g;
63282
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
63222
63283
  if (this.parsedXML !== undefined) {
63223
63284
  return { updated: false, runtime: 0 };
63224
63285
  }
63225
63286
  const start = Date.now();
63226
63287
  this.parsedXML = {};
63288
+ const jsonFile = this.getAFFFile();
63289
+ if (jsonFile) {
63290
+ try {
63291
+ const parsed = JSON.parse(jsonFile.getRaw());
63292
+ const typeInformation = parsed.dataTypeInformation;
63293
+ const predefinedType = typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.predefinedType;
63294
+ const fieldLabels = parsed.fieldLabels;
63295
+ this.parsedXML = {
63296
+ description: (_a = parsed.header) === null || _a === void 0 ? void 0 : _a.description,
63297
+ affCategory: typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.category,
63298
+ refkind: (typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.category) === "domain" ? "D" : undefined,
63299
+ domname: typeInformation === null || typeInformation === void 0 ? void 0 : typeInformation.typeName,
63300
+ datatype: predefinedType === null || predefinedType === void 0 ? void 0 : predefinedType.dataType,
63301
+ leng: (_b = predefinedType === null || predefinedType === void 0 ? void 0 : predefinedType.length) === null || _b === void 0 ? void 0 : _b.toString(),
63302
+ decimals: (_c = predefinedType === null || predefinedType === void 0 ? void 0 : predefinedType.decimals) === null || _c === void 0 ? void 0 : _c.toString(),
63303
+ texts: {
63304
+ short: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.short,
63305
+ medium: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.medium,
63306
+ long: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.long,
63307
+ heading: fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.heading,
63308
+ },
63309
+ textMaxLengths: {
63310
+ short: (_d = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.shortLength) === null || _d === void 0 ? void 0 : _d.toString(),
63311
+ medium: (_e = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.mediumLength) === null || _e === void 0 ? void 0 : _e.toString(),
63312
+ long: (_f = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.longLength) === null || _f === void 0 ? void 0 : _f.toString(),
63313
+ heading: (_g = fieldLabels === null || fieldLabels === void 0 ? void 0 : fieldLabels.headingLength) === null || _g === void 0 ? void 0 : _g.toString(),
63314
+ },
63315
+ };
63316
+ }
63317
+ catch (_q) {
63318
+ // handled by parseType()
63319
+ }
63320
+ const end = Date.now();
63321
+ return { updated: true, runtime: end - start };
63322
+ }
63227
63323
  const parsed = super.parseRaw2();
63228
63324
  if (parsed === undefined) {
63229
63325
  return { updated: false, runtime: 0 };
63230
63326
  }
63231
- const dd04v = (_c = (_b = (_a = parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"]) === null || _c === void 0 ? void 0 : _c.DD04V;
63327
+ const dd04v = (_k = (_j = (_h = parsed.abapGit) === null || _h === void 0 ? void 0 : _h["asx:abap"]) === null || _j === void 0 ? void 0 : _j["asx:values"]) === null || _k === void 0 ? void 0 : _k.DD04V;
63232
63328
  this.parsedXML = {
63233
63329
  description: dd04v === null || dd04v === void 0 ? void 0 : dd04v.DDTEXT,
63234
63330
  refkind: dd04v === null || dd04v === void 0 ? void 0 : dd04v.REFKIND,
@@ -63251,7 +63347,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
63251
63347
  },
63252
63348
  };
63253
63349
  this.parsedXML.textsTranslations = [];
63254
- for (const item of (0, xml_utils_1.xmlToArray)((_g = (_f = (_e = (_d = parsed.abapGit) === null || _d === void 0 ? void 0 : _d["asx:abap"]) === null || _e === void 0 ? void 0 : _e["asx:values"]) === null || _f === void 0 ? void 0 : _f.DD04_TEXTS) === null || _g === void 0 ? void 0 : _g.item)) {
63350
+ for (const item of (0, xml_utils_1.xmlToArray)((_p = (_o = (_m = (_l = parsed.abapGit) === null || _l === void 0 ? void 0 : _l["asx:abap"]) === null || _m === void 0 ? void 0 : _m["asx:values"]) === null || _o === void 0 ? void 0 : _o.DD04_TEXTS) === null || _p === void 0 ? void 0 : _p.item)) {
63255
63351
  this.parsedXML.textsTranslations.push({
63256
63352
  language: item.DDLANGUAGE,
63257
63353
  description: item.DDTEXT,
@@ -63264,6 +63360,9 @@ class DataElement extends _abstract_object_1.AbstractObject {
63264
63360
  const end = Date.now();
63265
63361
  return { updated: true, runtime: end - start };
63266
63362
  }
63363
+ getAFFFile() {
63364
+ return this.getFiles().find(file => file.getFilename().toLowerCase().endsWith(".dtel.json"));
63365
+ }
63267
63366
  }
63268
63367
  exports.DataElement = DataElement;
63269
63368
  //# sourceMappingURL=data_element.js.map
@@ -70392,7 +70491,7 @@ class Registry {
70392
70491
  }
70393
70492
  static abaplintVersion() {
70394
70493
  // magic, see build script "version.js"
70395
- return "2.120.47";
70494
+ return "2.120.49";
70396
70495
  }
70397
70496
  getDDICReferences() {
70398
70497
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.47",
3
+ "version": "2.120.49",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.47",
42
+ "@abaplint/core": "^2.120.49",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",