@abaplint/cli 2.101.20 → 2.101.21

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 +60 -57
  2. package/package.json +4 -4
package/build/cli.js CHANGED
@@ -48453,7 +48453,7 @@ class Registry {
48453
48453
  }
48454
48454
  static abaplintVersion() {
48455
48455
  // magic, see build script "version.sh"
48456
- return "2.101.20";
48456
+ return "2.101.21";
48457
48457
  }
48458
48458
  getDDICReferences() {
48459
48459
  return this.ddicReferences;
@@ -54109,7 +54109,7 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
54109
54109
  bar->if_t100_dyn_msg~msgv4 = 'abc'.
54110
54110
  RAISE EXCEPTION bar.
54111
54111
  */
54112
- var _a, _b, _c;
54112
+ var _a, _b, _c, _d, _e, _f, _g;
54113
54113
  if (!(node.get() instanceof Statements.Raise)) {
54114
54114
  return undefined;
54115
54115
  }
@@ -54133,20 +54133,45 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
54133
54133
  if (s === undefined) {
54134
54134
  return undefined;
54135
54135
  }
54136
- id = "'" + ((_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + "'";
54137
- number = "'" + ((_b = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _b === void 0 ? void 0 : _b.concatTokens().substring(1)) + "'";
54136
+ if (s.findDirectExpression(Expressions.MessageClass)) {
54137
+ id = "'" + ((_b = (_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) + "'";
54138
+ }
54139
+ else {
54140
+ id = (_c = s.findExpressionAfterToken("ID")) === null || _c === void 0 ? void 0 : _c.concatTokens();
54141
+ }
54142
+ if (s.findDirectExpression(Expressions.MessageTypeAndNumber)) {
54143
+ number = "'" + ((_d = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _d === void 0 ? void 0 : _d.concatTokens().substring(1)) + "'";
54144
+ }
54145
+ else {
54146
+ number = (_e = s.findExpressionAfterToken("NUMBER")) === null || _e === void 0 ? void 0 : _e.concatTokens();
54147
+ }
54138
54148
  startToken = node.getFirstToken();
54139
54149
  }
54140
- const className = ((_c = node.findDirectExpression(Expressions.ClassName)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "ERROR";
54150
+ const withs = ((_f = node.findDirectExpression(Expressions.RaiseWith)) === null || _f === void 0 ? void 0 : _f.findDirectExpressions(Expressions.Source)) || [];
54151
+ const className = ((_g = node.findDirectExpression(Expressions.ClassName)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "ERROR";
54141
54152
  const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
54142
54153
  const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
54143
54154
  const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
54144
- const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
54145
- ${indentation}${uniqueName1}-msgid = ${id === null || id === void 0 ? void 0 : id.toUpperCase()}.
54146
- ${indentation}${uniqueName1}-msgno = ${number}.
54147
- ${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
54148
- ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.
54149
- ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
54155
+ let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
54156
+ ${indentation}${uniqueName1}-msgid = ${id}.
54157
+ ${indentation}${uniqueName1}-msgno = ${number}.\n`;
54158
+ if (withs.length > 0) {
54159
+ abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
54160
+ ${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
54161
+ ${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
54162
+ ${indentation}${uniqueName1}-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n`;
54163
+ }
54164
+ abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
54165
+ ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n`;
54166
+ if (withs.length > 0) {
54167
+ abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgty = 'E'.\n`;
54168
+ }
54169
+ let count = 1;
54170
+ for (const w of withs) {
54171
+ abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgv${count} = ${w.concatTokens()}.\n`;
54172
+ count++;
54173
+ }
54174
+ abap += `${indentation}RAISE EXCEPTION ${uniqueName2}.`;
54150
54175
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);
54151
54176
  return issue_1.Issue.atToken(lowFile, startToken, "Downport RAISE MESSAGE", this.getMetadata().key, this.conf.severity, fix);
54152
54177
  }
@@ -54616,50 +54641,36 @@ ${indentation}${uniqueName}`;
54616
54641
  }
54617
54642
  // must be very simple string templates, like "|{ ls_line-no ALPHA = IN }|"
54618
54643
  stringTemplateAlpha(low, high, lowFile, highSyntax) {
54619
- var _a, _b, _c;
54644
+ var _a, _b;
54620
54645
  if (!(low.get() instanceof _statement_1.Unknown)) {
54621
54646
  return undefined;
54622
54647
  }
54623
54648
  else if (!(high.get() instanceof Statements.Move)) {
54624
54649
  return undefined;
54625
54650
  }
54626
- const topSource = high.findDirectExpression(Expressions.Source);
54627
- if (topSource === undefined || topSource.getChildren().length !== 1) {
54628
- return undefined;
54629
- }
54630
- let top = true;
54631
- let child = topSource.getFirstChild();
54632
- if (!(child.get() instanceof Expressions.StringTemplate)) {
54633
- child = child.findFirstExpression(Expressions.StringTemplate);
54634
- top = false;
54635
- }
54636
- if (child === undefined || !(child.get() instanceof Expressions.StringTemplate)) {
54637
- return undefined;
54638
- }
54639
- const templateTokens = child.getChildren();
54640
- if (templateTokens.length !== 3
54641
- || templateTokens[0].getFirstToken().getStr() !== "|{"
54642
- || templateTokens[2].getFirstToken().getStr() !== "}|") {
54643
- return undefined;
54644
- }
54645
- const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);
54646
- const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();
54647
- let functionName = "";
54648
- switch (formatting) {
54649
- case "ALPHA = IN":
54650
- functionName = "CONVERSION_EXIT_ALPHA_INPUT";
54651
- break;
54652
- case "ALPHA = OUT":
54653
- functionName = "CONVERSION_EXIT_ALPHA_OUTPUT";
54654
- break;
54655
- default:
54651
+ for (const child of high.findAllExpressionsRecursive(Expressions.StringTemplate)) {
54652
+ const templateTokens = child.getChildren();
54653
+ if (templateTokens.length !== 3
54654
+ || templateTokens[0].getFirstToken().getStr() !== "|{"
54655
+ || templateTokens[2].getFirstToken().getStr() !== "}|") {
54656
54656
  return undefined;
54657
- }
54658
- const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
54659
- const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
54660
- const topTarget = (_c = high.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();
54661
- const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
54662
- if (top === false) {
54657
+ }
54658
+ const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);
54659
+ const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();
54660
+ let functionName = "";
54661
+ switch (formatting) {
54662
+ case "ALPHA = IN":
54663
+ functionName = "CONVERSION_EXIT_ALPHA_INPUT";
54664
+ break;
54665
+ case "ALPHA = OUT":
54666
+ functionName = "CONVERSION_EXIT_ALPHA_OUTPUT";
54667
+ break;
54668
+ default:
54669
+ return undefined;
54670
+ }
54671
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
54672
+ const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
54673
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
54663
54674
  const code = `DATA ${uniqueName} TYPE string.
54664
54675
  ${indentation}CALL FUNCTION '${functionName}'
54665
54676
  ${indentation} EXPORTING
@@ -54671,15 +54682,7 @@ ${indentation} output = ${uniqueName}.\n`;
54671
54682
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
54672
54683
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
54673
54684
  }
54674
- else {
54675
- const code = `CALL FUNCTION '${functionName}'
54676
- ${indentation} EXPORTING
54677
- ${indentation} input = ${source}
54678
- ${indentation} IMPORTING
54679
- ${indentation} output = ${topTarget}.`;
54680
- const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
54681
- return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
54682
- }
54685
+ return undefined;
54683
54686
  }
54684
54687
  outlineLoopInput(low, high, lowFile, highSyntax) {
54685
54688
  if (!(low.get() instanceof _statement_1.Unknown)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.20",
3
+ "version": "2.101.21",
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.101.20",
41
+ "@abaplint/core": "^2.101.21",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
@@ -47,7 +47,7 @@
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.7",
49
49
  "chalk": "^5.2.0",
50
- "eslint": "^8.42.0",
50
+ "eslint": "^8.43.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
53
  "memfs": "^3.5.3",
@@ -55,7 +55,7 @@
55
55
  "mocha": "^10.2.0",
56
56
  "progress": "^2.0.3",
57
57
  "typescript": "^5.1.3",
58
- "webpack": "^5.86.0",
58
+ "webpack": "^5.87.0",
59
59
  "webpack-cli": "^5.1.4",
60
60
  "xml-js": "^1.6.11"
61
61
  },