@abaplint/core 2.83.14 → 2.83.15
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/abaplint.d.ts +5 -0
- package/build/src/abap/2_statements/expressions/index.js +1 -0
- package/build/src/abap/2_statements/expressions/raise_with.js +13 -0
- package/build/src/abap/2_statements/statements/raise.js +2 -3
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +50 -0
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -1880,6 +1880,7 @@ declare namespace Expressions {
|
|
|
1880
1880
|
PerformTables,
|
|
1881
1881
|
PerformUsing,
|
|
1882
1882
|
RadioGroupName,
|
|
1883
|
+
RaiseWith,
|
|
1883
1884
|
ReadTableTarget,
|
|
1884
1885
|
ReceiveParameters,
|
|
1885
1886
|
Redefinition,
|
|
@@ -4256,6 +4257,10 @@ declare class RaiseEvent implements IStatement {
|
|
|
4256
4257
|
getMatcher(): IStatementRunnable;
|
|
4257
4258
|
}
|
|
4258
4259
|
|
|
4260
|
+
declare class RaiseWith extends Expression {
|
|
4261
|
+
getRunnable(): IStatementRunnable;
|
|
4262
|
+
}
|
|
4263
|
+
|
|
4259
4264
|
declare class Ranges implements IStatement {
|
|
4260
4265
|
getMatcher(): IStatementRunnable;
|
|
4261
4266
|
}
|
|
@@ -128,6 +128,7 @@ __exportStar(require("./perform_changing"), exports);
|
|
|
128
128
|
__exportStar(require("./perform_tables"), exports);
|
|
129
129
|
__exportStar(require("./perform_using"), exports);
|
|
130
130
|
__exportStar(require("./radio_group_name"), exports);
|
|
131
|
+
__exportStar(require("./raise_with"), exports);
|
|
131
132
|
__exportStar(require("./read_table_target"), exports);
|
|
132
133
|
__exportStar(require("./receive_parameters"), exports);
|
|
133
134
|
__exportStar(require("./redefinition"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RaiseWith = void 0;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
class RaiseWith extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const wit = (0, combi_1.seq)("WITH", _1.Source, (0, combi_1.opt)(_1.Source), (0, combi_1.opt)(_1.Source), (0, combi_1.opt)(_1.Source));
|
|
9
|
+
return wit;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.RaiseWith = RaiseWith;
|
|
13
|
+
//# sourceMappingURL=raise_with.js.map
|
|
@@ -6,9 +6,8 @@ const version_1 = require("../../../version");
|
|
|
6
6
|
const expressions_1 = require("../expressions");
|
|
7
7
|
class Raise {
|
|
8
8
|
getMatcher() {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const messid = (0, combi_1.seq)("MESSAGE ID", expressions_1.Source, "NUMBER", expressions_1.Source, (0, combi_1.optPrio)(wit));
|
|
9
|
+
const mess = (0, combi_1.seq)("MESSAGE", expressions_1.MessageSource, (0, combi_1.opt)(expressions_1.RaiseWith));
|
|
10
|
+
const messid = (0, combi_1.seq)("MESSAGE ID", expressions_1.Source, "NUMBER", expressions_1.Source, (0, combi_1.optPrio)(expressions_1.RaiseWith));
|
|
12
11
|
const exporting = (0, combi_1.seq)("EXPORTING", expressions_1.ParameterListS);
|
|
13
12
|
const from = (0, combi_1.seq)("TYPE", expressions_1.ClassName, (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.alt)(mess, messid)), (0, combi_1.ver)(version_1.Version.v752, "USING MESSAGE"))), (0, combi_1.optPrio)(exporting));
|
|
14
13
|
const clas = (0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION", (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source), expressions_1.SimpleSource2));
|
package/build/src/registry.js
CHANGED
|
@@ -20,6 +20,7 @@ const basic_1 = require("../abap/types/basic");
|
|
|
20
20
|
const config_1 = require("../config");
|
|
21
21
|
const tokens_1 = require("../abap/1_lexer/tokens");
|
|
22
22
|
// todo: refactor each sub-rule to new classes?
|
|
23
|
+
// todo: add configuration
|
|
23
24
|
class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
24
25
|
}
|
|
25
26
|
exports.DownportConf = DownportConf;
|
|
@@ -53,6 +54,7 @@ Current rules:
|
|
|
53
54
|
* Some occurrences of string template formatting option ALPHA changed to function module call
|
|
54
55
|
* SELECT/INSERT/MODIFY/DELETE/UPDATE "," in field list removed, "@" in source/targets removed
|
|
55
56
|
* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
|
|
57
|
+
* RAISE EXCEPTION ... MESSAGE
|
|
56
58
|
|
|
57
59
|
Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,
|
|
58
60
|
tags: [_irule_1.RuleTag.Experimental, _irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],
|
|
@@ -148,6 +150,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
148
150
|
if (found) {
|
|
149
151
|
return found;
|
|
150
152
|
}
|
|
153
|
+
found = this.raiseException(high, lowFile, highSyntax);
|
|
154
|
+
if (found) {
|
|
155
|
+
return found;
|
|
156
|
+
}
|
|
151
157
|
found = this.emptyKey(high, lowFile);
|
|
152
158
|
if (found) {
|
|
153
159
|
return found;
|
|
@@ -448,6 +454,50 @@ ${indentation}`);
|
|
|
448
454
|
}
|
|
449
455
|
return undefined;
|
|
450
456
|
}
|
|
457
|
+
raiseException(node, lowFile, highSyntax) {
|
|
458
|
+
/*
|
|
459
|
+
Note: IF_T100_DYN_MSG does not exist in 702, so this rule is mostly relevant for the transpiler
|
|
460
|
+
|
|
461
|
+
DATA foo LIKE if_t100_message=>t100key.
|
|
462
|
+
foo-msgid = 'ZHVAM'.
|
|
463
|
+
foo-msgno = '001'.
|
|
464
|
+
foo-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
|
|
465
|
+
foo-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
|
|
466
|
+
foo-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
|
|
467
|
+
foo-attr4 = 'IF_T100_DYN_MSG~MSGV4'.
|
|
468
|
+
DATA bar TYPE REF TO zcl_hvam_exception.
|
|
469
|
+
CREATE OBJECT bar EXPORTING textid = foo.
|
|
470
|
+
bar->if_t100_dyn_msg~msgty = 'E'.
|
|
471
|
+
bar->if_t100_dyn_msg~msgv1 = 'abc'.
|
|
472
|
+
bar->if_t100_dyn_msg~msgv2 = 'abc'.
|
|
473
|
+
bar->if_t100_dyn_msg~msgv3 = 'abc'.
|
|
474
|
+
bar->if_t100_dyn_msg~msgv4 = 'abc'.
|
|
475
|
+
RAISE EXCEPTION bar.
|
|
476
|
+
*/
|
|
477
|
+
var _a;
|
|
478
|
+
if (node.get() instanceof Statements.Raise) {
|
|
479
|
+
const startToken = node.findDirectTokenByText("ID");
|
|
480
|
+
if (startToken === undefined) {
|
|
481
|
+
return undefined;
|
|
482
|
+
}
|
|
483
|
+
const sources = node.findDirectExpressions(Expressions.Source);
|
|
484
|
+
const id = sources[0].concatTokens();
|
|
485
|
+
const number = sources[1].concatTokens();
|
|
486
|
+
const className = ((_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "ERROR";
|
|
487
|
+
const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
488
|
+
const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
489
|
+
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
490
|
+
const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
491
|
+
${indentation}${uniqueName1}-msgid = ${id}.
|
|
492
|
+
${indentation}${uniqueName1}-msgno = ${number}.
|
|
493
|
+
${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
494
|
+
${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.
|
|
495
|
+
${indentation}RAISE EXCEPTION ${uniqueName2}.`;
|
|
496
|
+
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);
|
|
497
|
+
return issue_1.Issue.atToken(lowFile, startToken, "Downport RAISE MESSAGE", this.getMetadata().key, this.conf.severity, fix);
|
|
498
|
+
}
|
|
499
|
+
return undefined;
|
|
500
|
+
}
|
|
451
501
|
emptyKey(node, lowFile) {
|
|
452
502
|
for (let i of node.findAllExpressions(Expressions.TypeTable)) {
|
|
453
503
|
const key = i.findDirectExpression(Expressions.TypeTableKey);
|