@abaplint/cli 2.105.0 → 2.105.2

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 +57 -31
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -51042,7 +51042,7 @@ class Registry {
51042
51042
  }
51043
51043
  static abaplintVersion() {
51044
51044
  // magic, see build script "version.sh"
51045
- return "2.105.0";
51045
+ return "2.105.2";
51046
51046
  }
51047
51047
  getDDICReferences() {
51048
51048
  return this.ddicReferences;
@@ -56048,6 +56048,10 @@ Make sure to test the downported code, it might not always be completely correct
56048
56048
  if (found) {
56049
56049
  return found;
56050
56050
  }
56051
+ found = this.assignComponent(low, high, lowFile, highSyntax);
56052
+ if (found) {
56053
+ return found;
56054
+ }
56051
56055
  found = this.downportRefSimple(high, lowFile, highSyntax);
56052
56056
  if (found) {
56053
56057
  return found;
@@ -57157,6 +57161,28 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
57157
57161
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
57158
57162
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN table expr", this.getMetadata().key, this.conf.severity, fix);
57159
57163
  }
57164
+ assignComponent(low, high, lowFile, highSyntax) {
57165
+ if (!(low.get() instanceof _statement_1.Unknown)) {
57166
+ return undefined;
57167
+ }
57168
+ if (!(high.get() instanceof Statements.Assign)) {
57169
+ return undefined;
57170
+ }
57171
+ const assignSource = high.findDirectExpression(Expressions.AssignSource);
57172
+ if (assignSource === undefined || assignSource.getFirstToken().getStr().toUpperCase() !== "COMPONENT") {
57173
+ return undefined;
57174
+ }
57175
+ const componentSource = assignSource.findExpressionAfterToken("COMPONENT");
57176
+ if (componentSource === undefined || componentSource.get() instanceof Expressions.SimpleSource3) {
57177
+ return undefined;
57178
+ }
57179
+ const uniqueName = this.uniqueName(assignSource.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
57180
+ const code = `DATA(${uniqueName}) = ${componentSource.concatTokens()}.\n`;
57181
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
57182
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, componentSource.getFirstToken().getStart(), componentSource.getLastToken().getEnd(), uniqueName);
57183
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
57184
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN COMPONENT source", this.getMetadata().key, this.conf.severity, fix);
57185
+ }
57160
57186
  moveWithSimpleValue(low, high, lowFile) {
57161
57187
  if (!(low.get() instanceof _statement_1.Unknown)) {
57162
57188
  return undefined;
@@ -64642,77 +64668,77 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
64642
64668
  return ret;
64643
64669
  }
64644
64670
  checkData(topNode, regex, file) {
64645
- var _a, _b, _c;
64646
64671
  const ret = [];
64647
64672
  for (const data of topNode.findAllStatements(Statements.Data).concat(topNode.findAllStatements(Statements.DataBegin)).concat(topNode.findAllStatements(Statements.ClassDataBegin)).concat(topNode.findAllStatements(Statements.ClassData))) {
64648
- let name = ((_a = data.findFirstExpression(Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64649
- if (name === "") {
64650
- name = ((_b = data.findFirstExpression(Expressions.NamespaceSimpleName)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
64651
- }
64652
- if (name !== "" && name.match(regex)) {
64653
- const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64673
+ const nameExpression = data.findFirstExpression(Expressions.DefinitionName)
64674
+ || data.findFirstExpression(Expressions.NamespaceSimpleName);
64675
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64676
+ if (name !== "" && nameExpression && name.match(regex)) {
64677
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64654
64678
  ret.push(issue);
64655
64679
  }
64656
64680
  }
64657
64681
  for (const data of topNode.findAllExpressions(Expressions.InlineData)) {
64658
- const name = ((_c = data.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "";
64659
- if (name !== "" && name.match(regex)) {
64660
- const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64682
+ const nameExpression = data.findFirstExpression(Expressions.TargetField);
64683
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64684
+ if (name !== "" && nameExpression && name.match(regex)) {
64685
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64661
64686
  ret.push(issue);
64662
64687
  }
64663
64688
  }
64664
64689
  return ret;
64665
64690
  }
64666
64691
  checkStatics(topNode, regex, file) {
64667
- var _a;
64668
64692
  const ret = [];
64669
64693
  for (const data of topNode.findAllStatements(Statements.Static).concat(topNode.findAllStatements(Statements.StaticBegin))) {
64670
- const name = ((_a = data.findFirstExpression(Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64671
- if (name !== "" && name.match(regex)) {
64672
- const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64694
+ const nameExpression = data.findFirstExpression(Expressions.DefinitionName);
64695
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64696
+ if (name !== "" && nameExpression && name.match(regex)) {
64697
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64673
64698
  ret.push(issue);
64674
64699
  }
64675
64700
  }
64676
64701
  return ret;
64677
64702
  }
64678
64703
  checkFieldSymbols(topNode, regex, file) {
64679
- var _a, _b;
64680
64704
  const ret = [];
64681
64705
  for (const data of topNode.findAllStatements(Statements.FieldSymbol)) {
64682
- const name = ((_a = data.findFirstExpression(Expressions.FieldSymbol)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64683
- if (name !== "" && name.match(regex)) {
64684
- const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64706
+ const nameExpression = data.findFirstExpression(Expressions.FieldSymbol);
64707
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64708
+ if (name !== "" && nameExpression && name.match(regex)) {
64709
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64685
64710
  ret.push(issue);
64686
64711
  }
64687
64712
  }
64688
64713
  for (const data of topNode.findAllExpressions(Expressions.InlineFS)) {
64689
- const name = ((_b = data.findFirstExpression(Expressions.FieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
64690
- if (name !== "" && name.match(regex)) {
64691
- const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64714
+ const nameExpression = data.findFirstExpression(Expressions.FieldSymbol);
64715
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64716
+ if (name !== "" && nameExpression && name.match(regex)) {
64717
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64692
64718
  ret.push(issue);
64693
64719
  }
64694
64720
  }
64695
64721
  return ret;
64696
64722
  }
64697
64723
  checkConstants(topNode, regex, file) {
64698
- var _a;
64699
64724
  const ret = [];
64700
64725
  for (const data of topNode.findAllStatements(Statements.Constant).concat(topNode.findAllStatements(Statements.ConstantBegin))) {
64701
- const name = ((_a = data.findFirstExpression(Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64702
- if (name !== "" && name.match(regex)) {
64703
- const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64726
+ const nameExpression = data.findFirstExpression(Expressions.DefinitionName);
64727
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64728
+ if (name !== "" && nameExpression && name.match(regex)) {
64729
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64704
64730
  ret.push(issue);
64705
64731
  }
64706
64732
  }
64707
64733
  return ret;
64708
64734
  }
64709
64735
  checkTypes(topNode, regex, file) {
64710
- var _a;
64711
64736
  const ret = [];
64712
64737
  for (const data of topNode.findAllStatements(Statements.Type).concat(topNode.findAllStatements(Statements.TypeEnum)).concat(topNode.findAllStatements(Statements.TypeEnumBegin)).concat(topNode.findAllStatements(Statements.TypeMesh)).concat(topNode.findAllStatements(Statements.TypeMeshBegin)).concat(topNode.findAllStatements(Statements.TypeBegin))) {
64713
- const name = ((_a = data.findFirstExpression(Expressions.NamespaceSimpleName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64714
- if (name !== "" && name.match(regex)) {
64715
- const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64738
+ const nameExpression = data.findFirstExpression(Expressions.NamespaceSimpleName);
64739
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64740
+ if (name !== "" && nameExpression && name.match(regex)) {
64741
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64716
64742
  ret.push(issue);
64717
64743
  }
64718
64744
  }
@@ -64724,7 +64750,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
64724
64750
  for (const def of method.findAllExpressions(Expressions.MethodParamName)) {
64725
64751
  const name = def.concatTokens();
64726
64752
  if (name !== "" && name.match(regex)) {
64727
- const issue = issue_1.Issue.atToken(file, method.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64753
+ const issue = issue_1.Issue.atToken(file, def.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64728
64754
  ret.push(issue);
64729
64755
  }
64730
64756
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.105.0",
3
+ "version": "2.105.2",
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.105.0",
41
+ "@abaplint/core": "^2.105.2",
42
42
  "@types/chai": "^4.3.11",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.5",