@abaplint/cli 2.120.81 → 2.120.82

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 +44 -11
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -24712,6 +24712,7 @@ class ABAPFileInformationParser {
24712
24712
  return results;
24713
24713
  }
24714
24714
  parseAttributes(node, visibility) {
24715
+ var _a;
24715
24716
  if (node === undefined) {
24716
24717
  return [];
24717
24718
  }
@@ -24720,23 +24721,34 @@ class ABAPFileInformationParser {
24720
24721
  return [];
24721
24722
  }
24722
24723
  const ret = [];
24723
- for (const d of contents.findDirectStatements(Statements.Data)) {
24724
+ const data = contents.findDirectStatements(Statements.Data);
24725
+ for (const structure of contents.findDirectStructures(Structures.Data)) {
24726
+ const begin = structure.findDirectStatement(Statements.DataBegin);
24727
+ if (begin.findDirectExpression(Expressions.DefinitionName)) {
24728
+ data.push(begin);
24729
+ }
24730
+ }
24731
+ for (const d of data) {
24724
24732
  const name = d.findFirstExpression(Expressions.DefinitionName).getFirstToken();
24725
24733
  ret.push({
24726
24734
  name: name.getStr(),
24727
24735
  identifier: new _identifier_1.Identifier(name, this.filename),
24728
24736
  level: _abap_file_information_1.AttributeLevel.Instance,
24729
- readOnly: d.concatTokens().toUpperCase().includes(" READ-ONLY"),
24737
+ readOnly: this.isReadOnly(d),
24730
24738
  visibility,
24731
24739
  });
24732
24740
  }
24733
- for (const d of contents.findDirectStatements(Statements.ClassData)) {
24734
- const name = d.findFirstExpression(Expressions.DefinitionName).getFirstToken();
24741
+ const classData = contents.findDirectStatements(Statements.ClassData);
24742
+ for (const structure of contents.findDirectStructures(Structures.ClassData)) {
24743
+ classData.push(structure.findDirectStatement(Statements.ClassDataBegin));
24744
+ }
24745
+ for (const d of classData) {
24746
+ const name = ((_a = d.findFirstExpression(Expressions.DefinitionName)) !== null && _a !== void 0 ? _a : d.findDirectExpression(Expressions.NamespaceSimpleName)).getFirstToken();
24735
24747
  ret.push({
24736
24748
  name: name.getStr(),
24737
24749
  identifier: new _identifier_1.Identifier(name, this.filename),
24738
24750
  level: _abap_file_information_1.AttributeLevel.Static,
24739
- readOnly: d.concatTokens().toUpperCase().includes(" READ-ONLY"),
24751
+ readOnly: this.isReadOnly(d),
24740
24752
  visibility,
24741
24753
  });
24742
24754
  }
@@ -24752,6 +24764,12 @@ class ABAPFileInformationParser {
24752
24764
  }
24753
24765
  return ret;
24754
24766
  }
24767
+ isReadOnly(statement) {
24768
+ const definition = statement.findDirectExpression(Expressions.DataDefinition);
24769
+ const nodes = definition ? [definition, ...definition.findAllExpressions(Expressions.TypeTableKey)] : [statement];
24770
+ // In these grammar nodes, a direct READ token only occurs in the READ-ONLY modifier.
24771
+ return nodes.some(node => node.findDirectTokenByText("READ") !== undefined);
24772
+ }
24755
24773
  parseMethodDefinition(node, visibility) {
24756
24774
  var _a;
24757
24775
  if (node === undefined) {
@@ -27553,7 +27571,9 @@ class Procedural {
27553
27571
  }
27554
27572
  }
27555
27573
  if (found === undefined) {
27556
- found = ddic.lookup(param.type).type;
27574
+ const lookup = ddic.lookup(param.type);
27575
+ this.addDDICUsing(lookup.object, nameToken, filename);
27576
+ found = lookup.type;
27557
27577
  }
27558
27578
  if (param.direction === types_1.FunctionModuleParameterDirection.tables) {
27559
27579
  if (found instanceof basic_1.TableType) {
@@ -27565,10 +27585,12 @@ class Procedural {
27565
27585
  }
27566
27586
  if ((found instanceof basic_1.UnknownType || found instanceof basic_1.VoidType) && ((_a = param.type) === null || _a === void 0 ? void 0 : _a.includes("-"))) {
27567
27587
  const [name, field] = param.type.split("-");
27568
- const f = ddic.lookupTableOrView(name).type;
27588
+ const lookup = ddic.lookupTableOrView(name);
27589
+ const f = lookup.type;
27569
27590
  if (f && f instanceof basic_1.StructureType) {
27570
27591
  const c = f.getComponentByName(field);
27571
27592
  if (c) {
27593
+ this.addDDICUsing(lookup.object, nameToken, filename);
27572
27594
  found = c;
27573
27595
  }
27574
27596
  }
@@ -27632,6 +27654,12 @@ class Procedural {
27632
27654
  }
27633
27655
  }
27634
27656
  }
27657
+ addDDICUsing(object, token, filename) {
27658
+ if (object === undefined) {
27659
+ return;
27660
+ }
27661
+ this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object, token, filename });
27662
+ }
27635
27663
  functionModuleParameterMeta(param) {
27636
27664
  const ret = [];
27637
27665
  if (param.direction === types_1.FunctionModuleParameterDirection.importing) {
@@ -71522,7 +71550,7 @@ class Registry {
71522
71550
  }
71523
71551
  static abaplintVersion() {
71524
71552
  // magic, see build script "version.js"
71525
- return "2.120.81";
71553
+ return "2.120.82";
71526
71554
  }
71527
71555
  getDDICReferences() {
71528
71556
  return this.ddicReferences;
@@ -101871,10 +101899,14 @@ If the statement contains a JOIN it is not checked`,
101871
101899
  setConfig(conf) {
101872
101900
  this.conf = conf;
101873
101901
  }
101874
- buildFix(file, statement) {
101902
+ buildFix(file, statement, rows) {
101903
+ const end = statement.getLastToken().getEnd();
101904
+ const suffix = rows[end.getRow() - 1].slice(end.getCol() - 1).trimStart();
101905
+ // Keep chained '*' continuations out of the full-line comment column.
101906
+ const newline = suffix !== "" && suffix.startsWith('"') === false ? "\n " : "";
101875
101907
  return {
101876
101908
  description: `Add "#EC CI_NOORDER`,
101877
- edit: edit_helper_1.EditHelper.insertAt(file, statement.getLastToken().getStart(), ` "#EC CI_NOORDER`),
101909
+ edit: edit_helper_1.EditHelper.insertAt(file, end, ` "#EC CI_NOORDER${newline}`),
101878
101910
  };
101879
101911
  }
101880
101912
  run(obj) {
@@ -101890,6 +101922,7 @@ If the statement contains a JOIN it is not checked`,
101890
101922
  const message = "SELECT SINGLE possibily not unique";
101891
101923
  for (const file of obj.getABAPFiles()) {
101892
101924
  const statements = file.getStatements();
101925
+ const rows = file.getRawRows();
101893
101926
  for (let i = 0; i < statements.length; i++) {
101894
101927
  const s = statements[i];
101895
101928
  if (!(s.get() instanceof Statements.Select)) {
@@ -101936,7 +101969,7 @@ If the statement contains a JOIN it is not checked`,
101936
101969
  }
101937
101970
  }
101938
101971
  if (set.size > 0) {
101939
- const fix = this.buildFix(file, s);
101972
+ const fix = this.buildFix(file, s, rows);
101940
101973
  issues.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.getConfig().severity, undefined, [fix]));
101941
101974
  }
101942
101975
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.81",
3
+ "version": "2.120.82",
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.81",
42
+ "@abaplint/core": "^2.120.82",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",