@abaplint/cli 2.102.16 → 2.102.18

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 +96 -16
  2. package/package.json +4 -4
package/build/cli.js CHANGED
@@ -19387,16 +19387,16 @@ class BuiltIn {
19387
19387
  get(extras) {
19388
19388
  const ret = this.buildSY();
19389
19389
  ret.push(this.buildVariable("screen")); // todo, add structure, or alternatively make native Statements
19390
- ret.push(this.buildConstant("%_BACKSPACE"));
19391
- ret.push(this.buildConstant("%_CHARSIZE"));
19392
- ret.push(this.buildConstant("%_CR_LF"));
19393
19390
  ret.push(this.buildConstant("%_ENDIAN"));
19394
- ret.push(this.buildConstant("%_FORMFEED"));
19395
- ret.push(this.buildConstant("%_HORIZONTAL_TAB"));
19396
- ret.push(this.buildConstant("%_MAXCHAR"));
19397
- ret.push(this.buildConstant("%_MINCHAR"));
19398
- ret.push(this.buildConstant("%_NEWLINE"));
19399
- ret.push(this.buildConstant("%_VERTICAL_TAB"));
19391
+ ret.push(this.buildConstant("%_CHARSIZE"));
19392
+ ret.push(this.buildConstant("%_BACKSPACE", new basic_1.CharacterType(1), "\b"));
19393
+ ret.push(this.buildConstant("%_CR_LF", new basic_1.CharacterType(2), "\r\n"));
19394
+ ret.push(this.buildConstant("%_FORMFEED", new basic_1.CharacterType(1), "\f"));
19395
+ ret.push(this.buildConstant("%_HORIZONTAL_TAB", new basic_1.CharacterType(1), "\t"));
19396
+ ret.push(this.buildConstant("%_MAXCHAR", new basic_1.CharacterType(1), Buffer.from("FDFF", "hex").toString()));
19397
+ ret.push(this.buildConstant("%_MINCHAR", new basic_1.CharacterType(1), Buffer.from("0000", "hex").toString()));
19398
+ ret.push(this.buildConstant("%_NEWLINE", new basic_1.CharacterType(1), "\n"));
19399
+ ret.push(this.buildConstant("%_VERTICAL_TAB", new basic_1.CharacterType(1), "\v"));
19400
19400
  ret.push(this.buildConstant("abap_false", new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" }), "' '"));
19401
19401
  ret.push(this.buildConstant("abap_true", new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" }), "'X'"));
19402
19402
  ret.push(this.buildConstant("abap_undefined", new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" }), "'-'"));
@@ -21896,6 +21896,12 @@ class TypeUtils {
21896
21896
  }
21897
21897
  return true;
21898
21898
  }
21899
+ else if (target instanceof basic_1.SimpleType) {
21900
+ if (source instanceof basic_1.ObjectReferenceType
21901
+ || source instanceof basic_1.TableType) {
21902
+ return false;
21903
+ }
21904
+ }
21899
21905
  return true;
21900
21906
  }
21901
21907
  }
@@ -27573,6 +27579,10 @@ class ClassData {
27573
27579
  if (found === undefined) {
27574
27580
  return undefined;
27575
27581
  }
27582
+ if ((found === null || found === void 0 ? void 0 : found.getType().isGeneric()) === true
27583
+ && (found === null || found === void 0 ? void 0 : found.getType().containsVoid()) === false) {
27584
+ throw new Error("DATA definition cannot be generic, " + found.getName());
27585
+ }
27576
27586
  const meta = [...found.getMeta(), "static" /* IdentifierMeta.Static */];
27577
27587
  return new _typed_identifier_1.TypedIdentifier(found.getToken(), filename, found.getType(), meta, found.getValue());
27578
27588
  }
@@ -31345,6 +31355,10 @@ class Type {
31345
31355
  }
31346
31356
  const found = new basic_types_1.BasicTypes(filename, scope).simpleType(node, qualifiedNamePrefix);
31347
31357
  if (found) {
31358
+ if ((found === null || found === void 0 ? void 0 : found.getType().isGeneric()) === true
31359
+ && (found === null || found === void 0 ? void 0 : found.getType().containsVoid()) === false) {
31360
+ throw new Error("TYPES definition cannot be generic, " + found.getName());
31361
+ }
31348
31362
  return found;
31349
31363
  }
31350
31364
  const fallback = node.findFirstExpression(Expressions.NamespaceSimpleName);
@@ -40471,11 +40485,13 @@ const LServer = __webpack_require__(/*! vscode-languageserver-types */ "./node_m
40471
40485
  const _lsp_utils_1 = __webpack_require__(/*! ./_lsp_utils */ "./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js");
40472
40486
  const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js");
40473
40487
  const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
40488
+ const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
40489
+ const types_1 = __webpack_require__(/*! ../abap/types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
40474
40490
  class CodeLens {
40475
40491
  constructor(reg) {
40476
40492
  this.reg = reg;
40477
40493
  }
40478
- list(textDocument, settings = { messageText: true }) {
40494
+ list(textDocument, settings = { messageText: true, dynamicExceptions: true }) {
40479
40495
  var _a;
40480
40496
  const file = _lsp_utils_1.LSPUtils.getABAPFile(this.reg, textDocument.uri);
40481
40497
  if (file === undefined) {
@@ -40485,7 +40501,7 @@ class CodeLens {
40485
40501
  if (obj === undefined || !(obj instanceof _abap_object_1.ABAPObject)) {
40486
40502
  return [];
40487
40503
  }
40488
- new syntax_1.SyntaxLogic(this.reg, obj).run();
40504
+ const top = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop();
40489
40505
  const ret = [];
40490
40506
  if (settings.messageText === true) {
40491
40507
  const list = this.reg.getMSAGReferences().listByFilename(file.getFilename());
@@ -40500,10 +40516,59 @@ class CodeLens {
40500
40516
  }
40501
40517
  ret.push({
40502
40518
  range: _lsp_utils_1.LSPUtils.tokenToRange(l.token),
40503
- command: LServer.Command.create(text, ""),
40519
+ command: LServer.Command.create(text, "")
40504
40520
  });
40505
40521
  }
40506
40522
  }
40523
+ if (settings.dynamicExceptions === true) {
40524
+ for (const ref of this.findMethodReferences(top)) {
40525
+ if (!(ref.resolved instanceof types_1.MethodDefinition)) {
40526
+ continue;
40527
+ }
40528
+ let text = "";
40529
+ for (const e of ref.resolved.getExceptions()) {
40530
+ if (this.isDynamicException(e, top)) {
40531
+ if (text === "") {
40532
+ text = "Dynamic Exceptions: ";
40533
+ }
40534
+ else {
40535
+ text += " & ";
40536
+ }
40537
+ text += e.toUpperCase();
40538
+ }
40539
+ }
40540
+ if (text !== "") {
40541
+ ret.push({
40542
+ range: _lsp_utils_1.LSPUtils.tokenToRange(ref.resolved.getToken()),
40543
+ command: LServer.Command.create(text, "")
40544
+ });
40545
+ }
40546
+ }
40547
+ }
40548
+ return ret;
40549
+ }
40550
+ isDynamicException(name, top) {
40551
+ var _a;
40552
+ // todo: this method only works with global exceptions?
40553
+ let current = name;
40554
+ while (current !== undefined) {
40555
+ if (current.toUpperCase() === "CX_DYNAMIC_CHECK") {
40556
+ return true;
40557
+ }
40558
+ current = (_a = top.findClassDefinition(current)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
40559
+ }
40560
+ return false;
40561
+ }
40562
+ findMethodReferences(node) {
40563
+ const ret = [];
40564
+ for (const r of node.getData().references) {
40565
+ if (r.referenceType === _reference_1.ReferenceType.MethodReference) {
40566
+ ret.push(r);
40567
+ }
40568
+ }
40569
+ for (const c of node.getChildren()) {
40570
+ ret.push(...this.findMethodReferences(c));
40571
+ }
40507
40572
  return ret;
40508
40573
  }
40509
40574
  }
@@ -48624,7 +48689,7 @@ class Registry {
48624
48689
  }
48625
48690
  static abaplintVersion() {
48626
48691
  // magic, see build script "version.sh"
48627
- return "2.102.16";
48692
+ return "2.102.18";
48628
48693
  }
48629
48694
  getDDICReferences() {
48630
48695
  return this.ddicReferences;
@@ -57338,6 +57403,8 @@ class FunctionModuleRecommendationsConf extends _basic_rule_config_1.BasicRuleCo
57338
57403
  this.recommendations = [
57339
57404
  { name: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC or CL_ABAP_MESSAGE_DIGEST" },
57340
57405
  { name: "CCU_TIMESTAMP_DIFFERENCE", replace: "use CL_ABAP_TSTMP" },
57406
+ { name: "CONVERT_DATE_TO_EXTERNAL", replace: "use CL_ABAP_DATFM" },
57407
+ { name: "CONVERT_TIME_INPUT", replace: "use CL_ABAP_TIMEFM" },
57341
57408
  { name: "ECATT_CONV_XSTRING_TO_STRING", replace: "use CL_BINARY_CONVERT" },
57342
57409
  { name: "F4_FILENAME", replace: "use CL_GUI_FRONTEND_SERVICES" },
57343
57410
  { name: "FUNCTION_EXISTS", replace: "surround with try-catch CX_SY_DYN_CALL_ILLEGAL_METHOD instead" },
@@ -65144,7 +65211,9 @@ class SelectPerformanceConf extends _basic_rule_config_1.BasicRuleConfig {
65144
65211
  this.endSelect = true;
65145
65212
  /** Detects SELECT * */
65146
65213
  this.selectStar = true;
65147
- /** "SELECT" * is considered okay if the table is less than X columns, the table must be known to the linter */
65214
+ /** "SELECT" * is considered okay if the table is less than X columns, the table must be known to the linter
65215
+ * @default 10
65216
+ */
65148
65217
  this.starOkayIfFewColumns = DEFAULT_COLUMNS;
65149
65218
  }
65150
65219
  }
@@ -67102,6 +67171,11 @@ const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "./node_modu
67102
67171
  const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
67103
67172
  const types_1 = __webpack_require__(/*! ../abap/types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
67104
67173
  class UncaughtExceptionConf extends _basic_rule_config_1.BasicRuleConfig {
67174
+ constructor() {
67175
+ super(...arguments);
67176
+ this.reportDynamic = false;
67177
+ this.reportNoCheck = false;
67178
+ }
67105
67179
  }
67106
67180
  exports.UncaughtExceptionConf = UncaughtExceptionConf;
67107
67181
  class UncaughtException extends _abap_rule_1.ABAPRule {
@@ -67268,11 +67342,17 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
67268
67342
  return true;
67269
67343
  }
67270
67344
  const sup = this.globalExceptions[name.toUpperCase()];
67271
- if (sup === "CX_DYNAMIC_CHECK" || sup === "CX_NO_CHECK") {
67345
+ if (sup === "CX_DYNAMIC_CHECK" && this.getConfig().reportDynamic !== true) {
67346
+ return true;
67347
+ }
67348
+ if (sup === "CX_NO_CHECK" && this.getConfig().reportNoCheck !== true) {
67272
67349
  return true;
67273
67350
  }
67274
67351
  const lsup = this.localExceptions[name.toUpperCase()];
67275
- if (lsup === "CX_DYNAMIC_CHECK" || lsup === "CX_NO_CHECK") {
67352
+ if (lsup === "CX_DYNAMIC_CHECK" && this.getConfig().reportDynamic !== true) {
67353
+ return true;
67354
+ }
67355
+ if (lsup === "CX_NO_CHECK" && this.getConfig().reportNoCheck !== true) {
67276
67356
  return true;
67277
67357
  }
67278
67358
  return this.sinked.some(a => a.toUpperCase() === name.toUpperCase())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.16",
3
+ "version": "2.102.18",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,16 +38,16 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.16",
41
+ "@abaplint/core": "^2.102.18",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
45
45
  "@types/mocha": "^10.0.1",
46
- "@types/node": "^20.4.8",
46
+ "@types/node": "^20.5.0",
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.7",
49
49
  "chalk": "^5.3.0",
50
- "eslint": "^8.46.0",
50
+ "eslint": "^8.47.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
53
  "memfs": "^4.2.1",