@abaplint/cli 2.115.21 → 2.115.23

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 +31 -11
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -4274,7 +4274,7 @@ const let_1 = __webpack_require__(/*! ./let */ "./node_modules/@abaplint/core/bu
4274
4274
  class Cast extends combi_1.Expression {
4275
4275
  getRunnable() {
4276
4276
  const rparen = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight));
4277
- const cast = (0, combi_1.seq)("CAST", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.optPrio)(let_1.Let), _1.Source, rparen);
4277
+ const cast = (0, combi_1.seq)("CAST", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.optPrio)(let_1.Let), _1.Source, rparen, (0, combi_1.opt)(_1.Dereference));
4278
4278
  return (0, combi_1.ver)(version_1.Version.v740sp02, cast, version_1.Version.OpenABAP);
4279
4279
  }
4280
4280
  }
@@ -15420,7 +15420,7 @@ class Move {
15420
15420
  const equals = (0, combi_1.altPrio)((0, combi_1.altPrio)(chained, "?="), calcAssign);
15421
15421
  // todo, move "?=" to CAST?
15422
15422
  const eq = (0, combi_1.seq)(expressions_1.Target, equals, expressions_1.Source);
15423
- return (0, combi_1.altPrio)(move, eq);
15423
+ return (0, combi_1.alt)(move, eq);
15424
15424
  }
15425
15425
  }
15426
15426
  exports.Move = Move;
@@ -31630,8 +31630,9 @@ class CreateObject {
31630
31630
  return;
31631
31631
  }
31632
31632
  else if (found instanceof basic_1.ObjectReferenceType) {
31633
- const id = found.getIdentifier();
31634
- if (id instanceof types_1.InterfaceDefinition && type === undefined) {
31633
+ const identifier = found.getIdentifier();
31634
+ const idFound = input.scope.findObjectDefinition(identifier.getName());
31635
+ if (idFound instanceof types_1.InterfaceDefinition && type === undefined) {
31635
31636
  const message = "Interface reference, cannot be instantiated";
31636
31637
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
31637
31638
  return;
@@ -31643,11 +31644,11 @@ class CreateObject {
31643
31644
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
31644
31645
  return;
31645
31646
  }
31646
- else if (id instanceof types_1.ClassDefinition && cdef === undefined) {
31647
- cdef = id;
31647
+ else if (idFound instanceof types_1.ClassDefinition && cdef === undefined) {
31648
+ cdef = idFound;
31648
31649
  }
31649
- if (type === undefined && id instanceof types_1.ClassDefinition && id.isAbstract() === true) {
31650
- const message = id.getName() + " is abstract, cannot be instantiated";
31650
+ if (type === undefined && idFound instanceof types_1.ClassDefinition && idFound.isAbstract() === true) {
31651
+ const message = identifier.getName() + " is abstract, cannot be instantiated";
31651
31652
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
31652
31653
  return;
31653
31654
  }
@@ -33639,6 +33640,7 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_module
33639
33640
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
33640
33641
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
33641
33642
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
33643
+ const dereference_1 = __webpack_require__(/*! ../expressions/dereference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dereference.js");
33642
33644
  class Move {
33643
33645
  runSyntax(node, input) {
33644
33646
  const targets = node.findDirectExpressions(Expressions.Target);
@@ -33655,12 +33657,15 @@ class Move {
33655
33657
  }
33656
33658
  }
33657
33659
  const source = node.findDirectExpression(Expressions.Source);
33658
- const sourceType = source ? source_1.Source.runSyntax(source, input, targetType) : undefined;
33660
+ let sourceType = source ? source_1.Source.runSyntax(source, input, targetType) : undefined;
33659
33661
  if (sourceType === undefined) {
33660
33662
  const message = "No source type determined";
33661
33663
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
33662
33664
  return;
33663
33665
  }
33666
+ if (node.findDirectExpression(Expressions.Dereference)) {
33667
+ sourceType = dereference_1.Dereference.runSyntax(node, sourceType, input);
33668
+ }
33664
33669
  if (inline) {
33665
33670
  inline_data_1.InlineData.runSyntax(inline, input, sourceType);
33666
33671
  targetType = sourceType;
@@ -55480,7 +55485,7 @@ class Registry {
55480
55485
  }
55481
55486
  static abaplintVersion() {
55482
55487
  // magic, see build script "version.sh"
55483
- return "2.115.21";
55488
+ return "2.115.23";
55484
55489
  }
55485
55490
  getDDICReferences() {
55486
55491
  return this.ddicReferences;
@@ -65424,6 +65429,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
65424
65429
  const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
65425
65430
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
65426
65431
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
65432
+ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
65427
65433
  class GlobalClassConf extends _basic_rule_config_1.BasicRuleConfig {
65428
65434
  }
65429
65435
  exports.GlobalClassConf = GlobalClassConf;
@@ -65445,7 +65451,9 @@ class GlobalClass extends _abap_rule_1.ABAPRule {
65445
65451
 
65446
65452
  * global classes must be global definitions
65447
65453
 
65448
- * global interfaces must be global definitions`,
65454
+ * global interfaces must be global definitions
65455
+
65456
+ * global FOR TESTING, must have CATEGORY = 05 in the XML`,
65449
65457
  tags: [_irule_1.RuleTag.Syntax],
65450
65458
  };
65451
65459
  }
@@ -65470,6 +65478,18 @@ class GlobalClass extends _abap_rule_1.ABAPRule {
65470
65478
  const issue = issue_1.Issue.atIdentifier(definition.identifier, "Class must be local", this.getMetadata().key, this.conf.severity);
65471
65479
  output.push(issue);
65472
65480
  }
65481
+ if (definition.isGlobal && obj instanceof Objects.Class) {
65482
+ if (definition.isForTesting === true && obj instanceof Objects.Class && obj.getCategory() !== objects_1.ClassCategory.Test) {
65483
+ const message = "Class is marked as FOR TESTING, but CATEGORY is not 05 in the XML";
65484
+ const issue = issue_1.Issue.atIdentifier(definition.identifier, message, this.getMetadata().key, this.conf.severity);
65485
+ output.push(issue);
65486
+ }
65487
+ else if (definition.isForTesting === false && obj instanceof Objects.Class && obj.getCategory() === objects_1.ClassCategory.Test) {
65488
+ const message = "Class has CATEGORY 05 in the XML, but is not marked as FOR TESTING";
65489
+ const issue = issue_1.Issue.atIdentifier(definition.identifier, message, this.getMetadata().key, this.conf.severity);
65490
+ output.push(issue);
65491
+ }
65492
+ }
65473
65493
  }
65474
65494
  for (const impl of file.getInfo().listClassImplementations()) {
65475
65495
  if (file.getFilename().match(/\.clas\.abap$/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.115.21",
3
+ "version": "2.115.23",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.115.21",
41
+ "@abaplint/core": "^2.115.23",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",