@abaplint/transpiler-cli 2.5.14 → 2.5.16
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 +70 -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.30";
|
|
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)) {
|
|
@@ -52925,7 +52936,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
52925
52936
|
code += indent + " " + uniqueName + " = " + c.concatTokens() + ".\n";
|
|
52926
52937
|
}
|
|
52927
52938
|
else if (c.get() instanceof Expressions.Throw) {
|
|
52928
|
-
code += indent + " " + c.concatTokens().replace(
|
|
52939
|
+
code += indent + " " + c.concatTokens().replace(/THROW /i, "RAISE EXCEPTION NEW ") + ".\n";
|
|
52929
52940
|
}
|
|
52930
52941
|
else {
|
|
52931
52942
|
throw "buildCondBody, unexpected expression, " + c.get().constructor.name;
|
|
@@ -60963,8 +60974,10 @@ class PreferRaiseExceptionNew extends _abap_rule_1.ABAPRule {
|
|
|
60963
60974
|
title: "Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE",
|
|
60964
60975
|
shortDescription: `Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE`,
|
|
60965
60976
|
extendedInformation: `
|
|
60966
|
-
|
|
60967
|
-
|
|
60977
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type
|
|
60978
|
+
|
|
60979
|
+
From 752 and up`,
|
|
60980
|
+
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Upport],
|
|
60968
60981
|
goodExample: `RAISE EXCEPTION NEW cx_generation_error( previous = exception ).`,
|
|
60969
60982
|
badExample: `RAISE EXCEPTION TYPE cx_generation_error
|
|
60970
60983
|
EXPORTING
|
|
@@ -67763,6 +67776,7 @@ class FieldChainTranspiler {
|
|
|
67763
67776
|
transpile(node, traversal, prefix = true, filename, wrongScope = false) {
|
|
67764
67777
|
const ret = new chunk_1.Chunk();
|
|
67765
67778
|
const extra = [];
|
|
67779
|
+
let interfaceNameAdded = false;
|
|
67766
67780
|
for (const c of node.getChildren()) {
|
|
67767
67781
|
if (c.get() instanceof core_1.Expressions.SourceField
|
|
67768
67782
|
|| c.get() instanceof core_1.Expressions.Field) {
|
|
@@ -67777,12 +67791,13 @@ class FieldChainTranspiler {
|
|
|
67777
67791
|
ret.append(name + ".", c, traversal);
|
|
67778
67792
|
if (wrongScope === true && traversal.reg.getObject("INTF", c.getFirstToken().getStr())) {
|
|
67779
67793
|
ret.append(traversal_1.Traversal.escapeNamespace(c.getFirstToken().getStr().toLocaleLowerCase()) + "$", c, traversal);
|
|
67794
|
+
interfaceNameAdded = true;
|
|
67780
67795
|
}
|
|
67781
67796
|
}
|
|
67782
67797
|
else if (c.get() instanceof core_1.Expressions.AttributeName) {
|
|
67783
67798
|
const interfaceName = traversal.isInterfaceAttribute(c.getFirstToken());
|
|
67784
67799
|
let name = c.getFirstToken().getStr().toLowerCase();
|
|
67785
|
-
if (prefix && interfaceName && name.startsWith(interfaceName) === false) {
|
|
67800
|
+
if (prefix && interfaceName && name.startsWith(interfaceName) === false && interfaceNameAdded === false) {
|
|
67786
67801
|
name = traversal_1.Traversal.escapeNamespace(name).replace("~", "$");
|
|
67787
67802
|
name = traversal_1.Traversal.escapeNamespace(interfaceName) + "$" + name;
|
|
67788
67803
|
}
|
|
@@ -71091,6 +71106,7 @@ exports.ClassDefinitionLoadTranspiler = ClassDefinitionLoadTranspiler;
|
|
|
71091
71106
|
|
|
71092
71107
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71093
71108
|
exports.ClassImplementationTranspiler = void 0;
|
|
71109
|
+
/* eslint-disable max-len */
|
|
71094
71110
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
71095
71111
|
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
71096
71112
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
@@ -71107,9 +71123,38 @@ class ClassImplementationTranspiler {
|
|
|
71107
71123
|
else if (def === null || def === void 0 ? void 0 : def.getSuperClass()) {
|
|
71108
71124
|
ret += " extends " + traversal_1.Traversal.escapeNamespace((_a = def === null || def === void 0 ? void 0 : def.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
71109
71125
|
}
|
|
71126
|
+
const scope = traversal.findCurrentScopeByToken(token);
|
|
71110
71127
|
return new chunk_1.Chunk().append(ret + ` {
|
|
71111
71128
|
static INTERNAL_TYPE = 'CLAS';
|
|
71112
|
-
static IMPLEMENTED_INTERFACES = [${
|
|
71129
|
+
static IMPLEMENTED_INTERFACES = [${this.findImplementedClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];`, node, traversal);
|
|
71130
|
+
}
|
|
71131
|
+
findImplementedInterface(traversal, def, scope) {
|
|
71132
|
+
if (def === undefined || scope === undefined) {
|
|
71133
|
+
return [];
|
|
71134
|
+
}
|
|
71135
|
+
const list = def.getImplementing().map(i => i.name.toUpperCase());
|
|
71136
|
+
for (const i of def.getImplementing()) {
|
|
71137
|
+
const idef = traversal.findInterfaceDefinition(i.name, scope);
|
|
71138
|
+
list.push(...this.findImplementedInterface(traversal, idef, scope));
|
|
71139
|
+
}
|
|
71140
|
+
return list;
|
|
71141
|
+
}
|
|
71142
|
+
findImplementedClass(traversal, def, scope) {
|
|
71143
|
+
if (def === undefined || scope === undefined) {
|
|
71144
|
+
return [];
|
|
71145
|
+
}
|
|
71146
|
+
const list = def.getImplementing().map(i => i.name.toUpperCase());
|
|
71147
|
+
for (const i of def.getImplementing()) {
|
|
71148
|
+
const idef = traversal.findInterfaceDefinition(i.name, scope);
|
|
71149
|
+
list.push(...this.findImplementedInterface(traversal, idef, scope));
|
|
71150
|
+
}
|
|
71151
|
+
let sup = def.getSuperClass();
|
|
71152
|
+
while (sup !== undefined) {
|
|
71153
|
+
const sdef = traversal.findClassDefinition(sup, scope);
|
|
71154
|
+
list.push(...this.findImplementedClass(traversal, sdef, scope));
|
|
71155
|
+
sup = sdef === null || sdef === void 0 ? void 0 : sdef.getSuperClass();
|
|
71156
|
+
}
|
|
71157
|
+
return list;
|
|
71113
71158
|
}
|
|
71114
71159
|
}
|
|
71115
71160
|
exports.ClassImplementationTranspiler = ClassImplementationTranspiler;
|
|
@@ -73353,6 +73398,23 @@ class MessageTranspiler {
|
|
|
73353
73398
|
options.push("number: \"" + str.substr(1, 3) + "\"");
|
|
73354
73399
|
options.push("type: \"" + str.substr(0, 1).toUpperCase() + "\"");
|
|
73355
73400
|
}
|
|
73401
|
+
const like = messagesource.findExpressionAfterToken("LIKE");
|
|
73402
|
+
if (like) {
|
|
73403
|
+
options.push("displayLike: " + traversal.traverse(like).getCode());
|
|
73404
|
+
}
|
|
73405
|
+
}
|
|
73406
|
+
else {
|
|
73407
|
+
// exception based
|
|
73408
|
+
const exception = node.findDirectExpression(abaplint.Expressions.SimpleSource3);
|
|
73409
|
+
options.push("exception: " + traversal.traverse(exception).getCode());
|
|
73410
|
+
const type = node.findExpressionAfterToken("TYPE");
|
|
73411
|
+
if (type) {
|
|
73412
|
+
options.push("type: " + traversal.traverse(type).getCode());
|
|
73413
|
+
}
|
|
73414
|
+
const like = node.findExpressionAfterToken("LIKE");
|
|
73415
|
+
if (like) {
|
|
73416
|
+
options.push("displayLike: " + traversal.traverse(like).getCode());
|
|
73417
|
+
}
|
|
73356
73418
|
}
|
|
73357
73419
|
const w = [];
|
|
73358
73420
|
let withs = false;
|
|
@@ -76065,7 +76127,6 @@ class InterfaceTranspiler {
|
|
|
76065
76127
|
name = traversal_1.Traversal.escapeNamespace(name);
|
|
76066
76128
|
ret += `class ${name} {\n`;
|
|
76067
76129
|
ret += `static INTERNAL_TYPE = 'INTF';\n`;
|
|
76068
|
-
ret += `static IMPLEMENTED_INTERFACES = [${def === null || def === void 0 ? void 0 : def.getImplementing().map(e => `"` + e.name.toUpperCase() + `"`).join(",")}];\n`;
|
|
76069
76130
|
}
|
|
76070
76131
|
else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {
|
|
76071
76132
|
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.16",
|
|
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.16",
|
|
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.30",
|
|
33
33
|
"progress": "^2.0.3",
|
|
34
34
|
"webpack": "^5.75.0",
|
|
35
35
|
"webpack-cli": "^5.0.1",
|