@abaplint/core 2.89.7 → 2.89.8
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.
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +28 -18
- package/package.json +1 -1
package/build/src/registry.js
CHANGED
|
@@ -690,36 +690,46 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
|
690
690
|
bar->if_t100_dyn_msg~msgv4 = 'abc'.
|
|
691
691
|
RAISE EXCEPTION bar.
|
|
692
692
|
*/
|
|
693
|
-
var _a;
|
|
694
|
-
if (node.get() instanceof Statements.Raise) {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
693
|
+
var _a, _b, _c;
|
|
694
|
+
if (!(node.get() instanceof Statements.Raise)) {
|
|
695
|
+
return undefined;
|
|
696
|
+
}
|
|
697
|
+
let id = undefined;
|
|
698
|
+
let number = undefined;
|
|
699
|
+
let startToken = node.findDirectTokenByText("ID");
|
|
700
|
+
if (startToken) {
|
|
699
701
|
const sources = node.findDirectExpressions(Expressions.Source);
|
|
700
|
-
|
|
702
|
+
id = sources[0].concatTokens();
|
|
701
703
|
const numberExpression = node.findExpressionAfterToken("NUMBER");
|
|
702
704
|
if (numberExpression === undefined) {
|
|
703
705
|
throw "downport raiseException, could not find number";
|
|
704
706
|
}
|
|
705
|
-
|
|
707
|
+
number = numberExpression.concatTokens();
|
|
706
708
|
if (numberExpression.get() instanceof Expressions.MessageNumber) {
|
|
707
709
|
number = "'" + number + "'";
|
|
708
710
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
const s = node.findDirectExpression(Expressions.MessageSource);
|
|
714
|
+
if (s === undefined) {
|
|
715
|
+
return undefined;
|
|
716
|
+
}
|
|
717
|
+
id = "'" + ((_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + "'";
|
|
718
|
+
number = "'" + ((_b = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _b === void 0 ? void 0 : _b.concatTokens().substring(1)) + "'";
|
|
719
|
+
startToken = node.getFirstToken();
|
|
720
|
+
}
|
|
721
|
+
const className = ((_c = node.findDirectExpression(Expressions.ClassName)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "ERROR";
|
|
722
|
+
const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
723
|
+
const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
724
|
+
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
725
|
+
const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
726
|
+
${indentation}${uniqueName1}-msgid = ${id === null || id === void 0 ? void 0 : id.toUpperCase()}.
|
|
715
727
|
${indentation}${uniqueName1}-msgno = ${number}.
|
|
716
728
|
${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
717
729
|
${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.
|
|
718
730
|
${indentation}RAISE EXCEPTION ${uniqueName2}.`;
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
return undefined;
|
|
731
|
+
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);
|
|
732
|
+
return issue_1.Issue.atToken(lowFile, startToken, "Downport RAISE MESSAGE", this.getMetadata().key, this.conf.severity, fix);
|
|
723
733
|
}
|
|
724
734
|
emptyKey(node, lowFile) {
|
|
725
735
|
for (let i of node.findAllExpressions(Expressions.TypeTable)) {
|