@abaplint/transpiler-cli 2.5.15 → 2.5.17
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/bundle.js +69 -9
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -46138,7 +46138,7 @@ class Registry {
|
|
|
46138
46138
|
}
|
|
46139
46139
|
static abaplintVersion() {
|
|
46140
46140
|
// magic, see build script "version.sh"
|
|
46141
|
-
return "2.95.
|
|
46141
|
+
return "2.95.31";
|
|
46142
46142
|
}
|
|
46143
46143
|
getDDICReferences() {
|
|
46144
46144
|
return this.references;
|
|
@@ -51140,7 +51140,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
51140
51140
|
return undefined;
|
|
51141
51141
|
}
|
|
51142
51142
|
//////////////////////////////////////////
|
|
51143
|
-
downportSQLExtras(low, high, lowFile,
|
|
51143
|
+
downportSQLExtras(low, high, lowFile, highSyntax) {
|
|
51144
51144
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
51145
51145
|
return undefined;
|
|
51146
51146
|
}
|
|
@@ -51168,7 +51168,18 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
51168
51168
|
for (const c of candidates.reverse()) {
|
|
51169
51169
|
if (c.getFirstToken() instanceof tokens_1.WAt
|
|
51170
51170
|
|| c.getFirstToken() instanceof tokens_1.At) {
|
|
51171
|
-
|
|
51171
|
+
const tokens = c.getAllTokens();
|
|
51172
|
+
if (tokens[1] instanceof tokens_1.ParenLeftW && tokens[tokens.length - 1] instanceof tokens_1.WParenRightW) {
|
|
51173
|
+
const source = c.findDirectExpression(Expressions.Source);
|
|
51174
|
+
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
51175
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA(${uniqueName}) = ${source === null || source === void 0 ? void 0 : source.concatTokens()}.\n`);
|
|
51176
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, c.getFirstToken().getStart(), c.getLastToken().getEnd(), "@" + uniqueName);
|
|
51177
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
51178
|
+
return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, outline complex @", this.getMetadata().key, this.conf.severity, fix);
|
|
51179
|
+
}
|
|
51180
|
+
else {
|
|
51181
|
+
addFix(c.getFirstToken());
|
|
51182
|
+
}
|
|
51172
51183
|
}
|
|
51173
51184
|
}
|
|
51174
51185
|
for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop], true)) {
|
|
@@ -52880,9 +52891,10 @@ ${indentation} output = ${topTarget}.`;
|
|
|
52880
52891
|
}
|
|
52881
52892
|
const indent = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
52882
52893
|
const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);
|
|
52894
|
+
const last = i.findDirectTokenByText(")");
|
|
52883
52895
|
const abap = `DATA ${uniqueName} ${type}.\n` + bodyCode;
|
|
52884
52896
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
|
|
52885
|
-
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(),
|
|
52897
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), last.getEnd(), uniqueName);
|
|
52886
52898
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
52887
52899
|
return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport COND", this.getMetadata().key, this.conf.severity, fix);
|
|
52888
52900
|
}
|
|
@@ -52925,7 +52937,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
52925
52937
|
code += indent + " " + uniqueName + " = " + c.concatTokens() + ".\n";
|
|
52926
52938
|
}
|
|
52927
52939
|
else if (c.get() instanceof Expressions.Throw) {
|
|
52928
|
-
code += indent + " " + c.concatTokens().replace(
|
|
52940
|
+
code += indent + " " + c.concatTokens().replace(/THROW /i, "RAISE EXCEPTION NEW ") + ".\n";
|
|
52929
52941
|
}
|
|
52930
52942
|
else {
|
|
52931
52943
|
throw "buildCondBody, unexpected expression, " + c.get().constructor.name;
|
|
@@ -60963,8 +60975,10 @@ class PreferRaiseExceptionNew extends _abap_rule_1.ABAPRule {
|
|
|
60963
60975
|
title: "Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE",
|
|
60964
60976
|
shortDescription: `Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE`,
|
|
60965
60977
|
extendedInformation: `
|
|
60966
|
-
|
|
60967
|
-
|
|
60978
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type
|
|
60979
|
+
|
|
60980
|
+
From 752 and up`,
|
|
60981
|
+
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Upport],
|
|
60968
60982
|
goodExample: `RAISE EXCEPTION NEW cx_generation_error( previous = exception ).`,
|
|
60969
60983
|
badExample: `RAISE EXCEPTION TYPE cx_generation_error
|
|
60970
60984
|
EXPORTING
|
|
@@ -71093,6 +71107,7 @@ exports.ClassDefinitionLoadTranspiler = ClassDefinitionLoadTranspiler;
|
|
|
71093
71107
|
|
|
71094
71108
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71095
71109
|
exports.ClassImplementationTranspiler = void 0;
|
|
71110
|
+
/* eslint-disable max-len */
|
|
71096
71111
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
71097
71112
|
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
71098
71113
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
@@ -71109,9 +71124,38 @@ class ClassImplementationTranspiler {
|
|
|
71109
71124
|
else if (def === null || def === void 0 ? void 0 : def.getSuperClass()) {
|
|
71110
71125
|
ret += " extends " + traversal_1.Traversal.escapeNamespace((_a = def === null || def === void 0 ? void 0 : def.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
71111
71126
|
}
|
|
71127
|
+
const scope = traversal.findCurrentScopeByToken(token);
|
|
71112
71128
|
return new chunk_1.Chunk().append(ret + ` {
|
|
71113
71129
|
static INTERNAL_TYPE = 'CLAS';
|
|
71114
|
-
static IMPLEMENTED_INTERFACES = [${
|
|
71130
|
+
static IMPLEMENTED_INTERFACES = [${this.findImplementedClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];`, node, traversal);
|
|
71131
|
+
}
|
|
71132
|
+
findImplementedInterface(traversal, def, scope) {
|
|
71133
|
+
if (def === undefined || scope === undefined) {
|
|
71134
|
+
return [];
|
|
71135
|
+
}
|
|
71136
|
+
const list = def.getImplementing().map(i => i.name.toUpperCase());
|
|
71137
|
+
for (const i of def.getImplementing()) {
|
|
71138
|
+
const idef = traversal.findInterfaceDefinition(i.name, scope);
|
|
71139
|
+
list.push(...this.findImplementedInterface(traversal, idef, scope));
|
|
71140
|
+
}
|
|
71141
|
+
return list;
|
|
71142
|
+
}
|
|
71143
|
+
findImplementedClass(traversal, def, scope) {
|
|
71144
|
+
if (def === undefined || scope === undefined) {
|
|
71145
|
+
return [];
|
|
71146
|
+
}
|
|
71147
|
+
const list = def.getImplementing().map(i => i.name.toUpperCase());
|
|
71148
|
+
for (const i of def.getImplementing()) {
|
|
71149
|
+
const idef = traversal.findInterfaceDefinition(i.name, scope);
|
|
71150
|
+
list.push(...this.findImplementedInterface(traversal, idef, scope));
|
|
71151
|
+
}
|
|
71152
|
+
let sup = def.getSuperClass();
|
|
71153
|
+
while (sup !== undefined) {
|
|
71154
|
+
const sdef = traversal.findClassDefinition(sup, scope);
|
|
71155
|
+
list.push(...this.findImplementedClass(traversal, sdef, scope));
|
|
71156
|
+
sup = sdef === null || sdef === void 0 ? void 0 : sdef.getSuperClass();
|
|
71157
|
+
}
|
|
71158
|
+
return list;
|
|
71115
71159
|
}
|
|
71116
71160
|
}
|
|
71117
71161
|
exports.ClassImplementationTranspiler = ClassImplementationTranspiler;
|
|
@@ -73355,6 +73399,23 @@ class MessageTranspiler {
|
|
|
73355
73399
|
options.push("number: \"" + str.substr(1, 3) + "\"");
|
|
73356
73400
|
options.push("type: \"" + str.substr(0, 1).toUpperCase() + "\"");
|
|
73357
73401
|
}
|
|
73402
|
+
const like = messagesource.findExpressionAfterToken("LIKE");
|
|
73403
|
+
if (like) {
|
|
73404
|
+
options.push("displayLike: " + traversal.traverse(like).getCode());
|
|
73405
|
+
}
|
|
73406
|
+
}
|
|
73407
|
+
else {
|
|
73408
|
+
// exception based
|
|
73409
|
+
const exception = node.findDirectExpression(abaplint.Expressions.SimpleSource3);
|
|
73410
|
+
options.push("exception: " + traversal.traverse(exception).getCode());
|
|
73411
|
+
const type = node.findExpressionAfterToken("TYPE");
|
|
73412
|
+
if (type) {
|
|
73413
|
+
options.push("type: " + traversal.traverse(type).getCode());
|
|
73414
|
+
}
|
|
73415
|
+
const like = node.findExpressionAfterToken("LIKE");
|
|
73416
|
+
if (like) {
|
|
73417
|
+
options.push("displayLike: " + traversal.traverse(like).getCode());
|
|
73418
|
+
}
|
|
73358
73419
|
}
|
|
73359
73420
|
const w = [];
|
|
73360
73421
|
let withs = false;
|
|
@@ -76067,7 +76128,6 @@ class InterfaceTranspiler {
|
|
|
76067
76128
|
name = traversal_1.Traversal.escapeNamespace(name);
|
|
76068
76129
|
ret += `class ${name} {\n`;
|
|
76069
76130
|
ret += `static INTERNAL_TYPE = 'INTF';\n`;
|
|
76070
|
-
ret += `static IMPLEMENTED_INTERFACES = [${def === null || def === void 0 ? void 0 : def.getImplementing().map(e => `"` + e.name.toUpperCase() + `"`).join(",")}];\n`;
|
|
76071
76131
|
}
|
|
76072
76132
|
else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {
|
|
76073
76133
|
ret += "}\n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.17",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"author": "abaplint",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@abaplint/transpiler": "^2.5.
|
|
28
|
+
"@abaplint/transpiler": "^2.5.17",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|
|
32
|
-
"@abaplint/core": "^2.95.
|
|
32
|
+
"@abaplint/core": "^2.95.31",
|
|
33
33
|
"progress": "^2.0.3",
|
|
34
34
|
"webpack": "^5.75.0",
|
|
35
35
|
"webpack-cli": "^5.0.1",
|