@abaplint/cli 2.101.16 → 2.101.17

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 +55 -15
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -20557,12 +20557,19 @@ class CurrentScope {
20557
20557
  }
20558
20558
  }
20559
20559
  addReference(usage, referencing, type, filename, extra) {
20560
- var _a;
20560
+ var _a, _b;
20561
20561
  if (usage === undefined || type === undefined) {
20562
20562
  return;
20563
20563
  }
20564
20564
  const position = new _identifier_1.Identifier(usage, filename);
20565
- (_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().references.push({ position, resolved: referencing, referenceType: type, extra });
20565
+ if (Array.isArray(type)) {
20566
+ for (const t of type) {
20567
+ (_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().references.push({ position, resolved: referencing, referenceType: t, extra });
20568
+ }
20569
+ }
20570
+ else {
20571
+ (_b = this.current) === null || _b === void 0 ? void 0 : _b.getData().references.push({ position, resolved: referencing, referenceType: type, extra });
20572
+ }
20566
20573
  }
20567
20574
  addSQLConversion(fieldName, message, token) {
20568
20575
  var _a;
@@ -21625,12 +21632,15 @@ class TypeUtils {
21625
21632
  }
21626
21633
  return false;
21627
21634
  }
21628
- isAssignableStrict(source, target) {
21635
+ isAssignableStrict(source, target, containsMethodCall = false) {
21629
21636
  var _a, _b, _c, _d, _e, _f;
21630
21637
  /*
21631
21638
  console.dir(source);
21632
21639
  console.dir(target);
21633
21640
  */
21641
+ if (containsMethodCall) {
21642
+ return this.isAssignable(source, target);
21643
+ }
21634
21644
  if (source instanceof basic_1.CharacterType) {
21635
21645
  if (target instanceof basic_1.CharacterType) {
21636
21646
  if (((_a = source.getAbstractTypeData()) === null || _a === void 0 ? void 0 : _a.derivedFromConstant) === true) {
@@ -22801,7 +22811,9 @@ class AttributeChain {
22801
22811
  if (context === undefined) {
22802
22812
  throw new Error("Attribute or constant \"" + name + "\" not found in \"" + def.getName() + "\"");
22803
22813
  }
22804
- scope.addReference(nameToken, context, type, filename);
22814
+ for (const t of type) {
22815
+ scope.addReference(nameToken, context, t, filename);
22816
+ }
22805
22817
  // todo, loop, handle ArrowOrDash, ComponentName, TableExpression
22806
22818
  return context.getType();
22807
22819
  }
@@ -24605,7 +24617,7 @@ class MethodCallParam {
24605
24617
  if (sourceType === undefined) {
24606
24618
  throw new Error("No source type determined, method source");
24607
24619
  }
24608
- else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
24620
+ else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType, child.findFirstExpression(Expressions.MethodCallChain) !== undefined) === false) {
24609
24621
  throw new Error("Method parameter type not compatible");
24610
24622
  }
24611
24623
  }
@@ -25510,7 +25522,7 @@ const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifie
25510
25522
  * DATA(bar) = VALUE #( ... ). give error, no type can be derived
25511
25523
  */
25512
25524
  class Source {
25513
- runSyntax(node, scope, filename, targetType) {
25525
+ runSyntax(node, scope, filename, targetType, writeReference = false) {
25514
25526
  if (node === undefined) {
25515
25527
  return undefined;
25516
25528
  }
@@ -25637,12 +25649,16 @@ class Source {
25637
25649
  return undefined;
25638
25650
  }
25639
25651
  let context = new unknown_type_1.UnknownType("todo, Source type");
25652
+ const type = [_reference_1.ReferenceType.DataReadReference];
25653
+ if (writeReference) {
25654
+ type.push(_reference_1.ReferenceType.DataWriteReference);
25655
+ }
25640
25656
  while (children.length >= 0) {
25641
25657
  if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.MethodCallChain) {
25642
25658
  context = new method_call_chain_1.MethodCallChain().runSyntax(first, scope, filename, targetType);
25643
25659
  }
25644
25660
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.FieldChain) {
25645
- context = new field_chain_1.FieldChain().runSyntax(first, scope, filename, _reference_1.ReferenceType.DataReadReference);
25661
+ context = new field_chain_1.FieldChain().runSyntax(first, scope, filename, type);
25646
25662
  }
25647
25663
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.StringTemplate) {
25648
25664
  context = new string_template_1.StringTemplate().runSyntax(first, scope, filename);
@@ -25655,15 +25671,14 @@ class Source {
25655
25671
  }
25656
25672
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Dereference) {
25657
25673
  context = new dereference_1.Dereference().runSyntax(context);
25658
- }
25659
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ArrowOrDash) {
25674
+ // } else if (first instanceof ExpressionNode && first.get() instanceof Expressions.ArrowOrDash) {
25660
25675
  // console.dir("dash");
25661
25676
  }
25662
25677
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
25663
25678
  context = new component_chain_1.ComponentChain().runSyntax(context, first, scope, filename);
25664
25679
  }
25665
25680
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
25666
- context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, _reference_1.ReferenceType.DataReadReference);
25681
+ context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, type);
25667
25682
  }
25668
25683
  first = children.shift();
25669
25684
  if (first === undefined) {
@@ -29295,12 +29310,13 @@ class Loop {
29295
29310
  if (target === undefined) {
29296
29311
  target = node.findDirectExpression(Expressions.FSTarget);
29297
29312
  }
29313
+ const write = (loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectTokenByText("ASSIGNING")) !== undefined;
29298
29314
  const sources = node.findDirectExpressions(Expressions.Source);
29299
29315
  let firstSource = node.findDirectExpression(Expressions.SimpleSource2);
29300
29316
  if (firstSource === undefined) {
29301
29317
  firstSource = sources[0];
29302
29318
  }
29303
- let sourceType = firstSource ? new source_1.Source().runSyntax(firstSource, scope, filename, targetType) : undefined;
29319
+ let sourceType = firstSource ? new source_1.Source().runSyntax(firstSource, scope, filename, targetType, write) : undefined;
29304
29320
  let rowType = undefined;
29305
29321
  const concat = node.concatTokens().toUpperCase();
29306
29322
  if (sourceType === undefined) {
@@ -48396,7 +48412,7 @@ class Registry {
48396
48412
  }
48397
48413
  static abaplintVersion() {
48398
48414
  // magic, see build script "version.sh"
48399
- return "2.101.16";
48415
+ return "2.101.17";
48400
48416
  }
48401
48417
  getDDICReferences() {
48402
48418
  return this.ddicReferences;
@@ -49068,7 +49084,7 @@ Does not take effect on non functional method calls, use https://rules.abaplint.
49068
49084
 
49069
49085
  If parameters are on the same row, no issues are reported, see
49070
49086
  https://rules.abaplint.org/max_one_method_parameter_per_line/ for splitting parameters to lines`,
49071
- tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],
49087
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],
49072
49088
  badExample: `CALL FUNCTION 'FOOBAR'
49073
49089
  EXPORTING
49074
49090
  foo = 2
@@ -67040,6 +67056,12 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
67040
67056
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
67041
67057
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
67042
67058
  class UnnecessaryPragmaConf extends _basic_rule_config_1.BasicRuleConfig {
67059
+ constructor() {
67060
+ super(...arguments);
67061
+ /** Allow NO_TEXT in global CLAS and INTF definitions,
67062
+ its added automatically by SE24 in some cases where it should not */
67063
+ this.allowNoTextGlobal = false;
67064
+ }
67043
67065
  }
67044
67066
  exports.UnnecessaryPragmaConf = UnnecessaryPragmaConf;
67045
67067
  class UnnecessaryPragma extends _abap_rule_1.ABAPRule {
@@ -67089,6 +67111,7 @@ ENDIF.`,
67089
67111
  runParsed(file) {
67090
67112
  const issues = [];
67091
67113
  let noHandler = false;
67114
+ let globalDefinition = false;
67092
67115
  const statements = file.getStatements();
67093
67116
  for (let i = 0; i < statements.length; i++) {
67094
67117
  const statement = statements[i];
@@ -67096,6 +67119,16 @@ ENDIF.`,
67096
67119
  if (statement.get() instanceof Statements.EndTry) {
67097
67120
  noHandler = false;
67098
67121
  }
67122
+ else if (statement.get() instanceof Statements.ClassDefinition
67123
+ || statement.get() instanceof Statements.Interface) {
67124
+ if (statement.findDirectExpression(Expressions.ClassGlobal)) {
67125
+ globalDefinition = true;
67126
+ }
67127
+ }
67128
+ else if (statement.get() instanceof Statements.EndClass
67129
+ || statement.get() instanceof Statements.EndInterface) {
67130
+ globalDefinition = false;
67131
+ }
67099
67132
  else if (statement.get() instanceof _statement_1.Comment) {
67100
67133
  continue;
67101
67134
  }
@@ -67108,9 +67141,16 @@ ENDIF.`,
67108
67141
  else {
67109
67142
  noHandler = this.containsNoHandler(statement, statements[i + 1]);
67110
67143
  }
67111
- issues.push(...this.checkText(statement, file));
67144
+ if (this.getConfig().allowNoTextGlobal === true && globalDefinition === true) {
67145
+ // skip
67146
+ }
67147
+ else {
67148
+ issues.push(...this.checkText(statement, file));
67149
+ }
67112
67150
  issues.push(...this.checkNeeded(statement, file));
67113
- issues.push(...this.checkSubrc(statement, nextStatement, file));
67151
+ if (globalDefinition === false) {
67152
+ issues.push(...this.checkSubrc(statement, nextStatement, file));
67153
+ }
67114
67154
  }
67115
67155
  return issues;
67116
67156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.16",
3
+ "version": "2.101.17",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.101.16",
41
+ "@abaplint/core": "^2.101.17",
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.2.5",
46
+ "@types/node": "^20.2.6",
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.7",
49
49
  "chalk": "^5.2.0",