@abaplint/transpiler-cli 2.13.7 → 2.13.9
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/abap_transpile +1 -1
- package/build/bundle.js +107 -2
- package/package.json +3 -3
package/abap_transpile
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
require("./build/bundle");
|
package/build/bundle.js
CHANGED
|
@@ -52326,6 +52326,83 @@ exports.RenameMessageClass = RenameMessageClass;
|
|
|
52326
52326
|
|
|
52327
52327
|
/***/ },
|
|
52328
52328
|
|
|
52329
|
+
/***/ "./node_modules/@abaplint/core/build/src/objects/rename/rename_program.js"
|
|
52330
|
+
/*!********************************************************************************!*\
|
|
52331
|
+
!*** ./node_modules/@abaplint/core/build/src/objects/rename/rename_program.js ***!
|
|
52332
|
+
\********************************************************************************/
|
|
52333
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
52334
|
+
|
|
52335
|
+
"use strict";
|
|
52336
|
+
|
|
52337
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
52338
|
+
exports.RenameProgram = void 0;
|
|
52339
|
+
const Statements = __webpack_require__(/*! ../../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
|
|
52340
|
+
const Expressions = __webpack_require__(/*! ../../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
52341
|
+
const vscode_languageserver_types_1 = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/umd/main.js");
|
|
52342
|
+
const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
52343
|
+
const renamer_helper_1 = __webpack_require__(/*! ./renamer_helper */ "./node_modules/@abaplint/core/build/src/objects/rename/renamer_helper.js");
|
|
52344
|
+
const _lsp_utils_1 = __webpack_require__(/*! ../../lsp/_lsp_utils */ "./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js");
|
|
52345
|
+
const _abap_object_1 = __webpack_require__(/*! ../_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
|
|
52346
|
+
class RenameProgram {
|
|
52347
|
+
constructor(reg) {
|
|
52348
|
+
this.reg = reg;
|
|
52349
|
+
}
|
|
52350
|
+
buildEdits(obj, oldName, newName) {
|
|
52351
|
+
if (!(obj instanceof __1.Program)) {
|
|
52352
|
+
throw new Error("RenameProgram, not a program");
|
|
52353
|
+
}
|
|
52354
|
+
const main = obj.getMainABAPFile();
|
|
52355
|
+
if (main === undefined) {
|
|
52356
|
+
throw new Error(`Main file not found, ${obj.getType()} ${obj.getName()}`);
|
|
52357
|
+
}
|
|
52358
|
+
let changes = [];
|
|
52359
|
+
const helper = new renamer_helper_1.RenamerHelper(this.reg);
|
|
52360
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "NAME", oldName, newName));
|
|
52361
|
+
changes = changes.concat(helper.renameFiles(obj, oldName, newName));
|
|
52362
|
+
const edits = [];
|
|
52363
|
+
for (const s of main.getStatements()) {
|
|
52364
|
+
if (s.get() instanceof Statements.Report || s.get() instanceof Statements.Program) {
|
|
52365
|
+
const exp = s.findFirstExpression(Expressions.ReportName);
|
|
52366
|
+
if (exp) {
|
|
52367
|
+
edits.push(vscode_languageserver_types_1.TextEdit.replace(_lsp_utils_1.LSPUtils.tokenToRange(exp.getFirstToken()), newName.toLowerCase()));
|
|
52368
|
+
}
|
|
52369
|
+
}
|
|
52370
|
+
}
|
|
52371
|
+
if (edits.length > 0) {
|
|
52372
|
+
changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: main.getFilename(), version: 1 }, edits));
|
|
52373
|
+
}
|
|
52374
|
+
// Rename INCLUDE statements in all ABAP objects
|
|
52375
|
+
for (const o of this.reg.getObjects()) {
|
|
52376
|
+
if (o instanceof _abap_object_1.ABAPObject && o !== obj) {
|
|
52377
|
+
for (const file of o.getABAPFiles()) {
|
|
52378
|
+
const includeEdits = [];
|
|
52379
|
+
for (const s of file.getStatements()) {
|
|
52380
|
+
if (s.get() instanceof Statements.Include ||
|
|
52381
|
+
s.get() instanceof Statements.Submit ||
|
|
52382
|
+
s.get() instanceof Statements.Perform) {
|
|
52383
|
+
for (const exp of s.findAllExpressions(Expressions.IncludeName)) {
|
|
52384
|
+
if (exp && exp.getFirstToken().getStr().toUpperCase() === oldName.toUpperCase()) {
|
|
52385
|
+
includeEdits.push(vscode_languageserver_types_1.TextEdit.replace(_lsp_utils_1.LSPUtils.tokenToRange(exp.getFirstToken()), newName.toLowerCase()));
|
|
52386
|
+
}
|
|
52387
|
+
}
|
|
52388
|
+
}
|
|
52389
|
+
}
|
|
52390
|
+
if (includeEdits.length > 0) {
|
|
52391
|
+
changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: file.getFilename(), version: 1 }, includeEdits));
|
|
52392
|
+
}
|
|
52393
|
+
}
|
|
52394
|
+
}
|
|
52395
|
+
}
|
|
52396
|
+
return {
|
|
52397
|
+
documentChanges: changes,
|
|
52398
|
+
};
|
|
52399
|
+
}
|
|
52400
|
+
}
|
|
52401
|
+
exports.RenameProgram = RenameProgram;
|
|
52402
|
+
//# sourceMappingURL=rename_program.js.map
|
|
52403
|
+
|
|
52404
|
+
/***/ },
|
|
52405
|
+
|
|
52329
52406
|
/***/ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table.js"
|
|
52330
52407
|
/*!******************************************************************************!*\
|
|
52331
52408
|
!*** ./node_modules/@abaplint/core/build/src/objects/rename/rename_table.js ***!
|
|
@@ -52417,6 +52494,7 @@ const rename_data_element_1 = __webpack_require__(/*! ./rename_data_element */ "
|
|
|
52417
52494
|
const rename_domain_1 = __webpack_require__(/*! ./rename_domain */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_domain.js");
|
|
52418
52495
|
const rename_global_class_1 = __webpack_require__(/*! ./rename_global_class */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_global_class.js");
|
|
52419
52496
|
const rename_global_interface_1 = __webpack_require__(/*! ./rename_global_interface */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_global_interface.js");
|
|
52497
|
+
const rename_program_1 = __webpack_require__(/*! ./rename_program */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_program.js");
|
|
52420
52498
|
const rename_table_1 = __webpack_require__(/*! ./rename_table */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table.js");
|
|
52421
52499
|
const rename_table_type_1 = __webpack_require__(/*! ./rename_table_type */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table_type.js");
|
|
52422
52500
|
const rename_message_class_1 = __webpack_require__(/*! ./rename_message_class */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_message_class.js");
|
|
@@ -52471,6 +52549,8 @@ class Renamer {
|
|
|
52471
52549
|
return new rename_table_type_1.RenameTableType(this.reg);
|
|
52472
52550
|
case "INTF":
|
|
52473
52551
|
return new rename_global_interface_1.RenameGlobalInterface(this.reg);
|
|
52552
|
+
case "PROG":
|
|
52553
|
+
return new rename_program_1.RenameProgram(this.reg);
|
|
52474
52554
|
case "MSAG":
|
|
52475
52555
|
return new rename_message_class_1.RenameMessageClass(this.reg);
|
|
52476
52556
|
case "SICF":
|
|
@@ -54958,7 +55038,7 @@ class Registry {
|
|
|
54958
55038
|
}
|
|
54959
55039
|
static abaplintVersion() {
|
|
54960
55040
|
// magic, see build script "version.sh"
|
|
54961
|
-
return "2.118.
|
|
55041
|
+
return "2.118.10";
|
|
54962
55042
|
}
|
|
54963
55043
|
getDDICReferences() {
|
|
54964
55044
|
return this.ddicReferences;
|
|
@@ -83336,7 +83416,29 @@ class SourceTranspiler {
|
|
|
83336
83416
|
let ret = new chunk_1.Chunk();
|
|
83337
83417
|
const post = new chunk_1.Chunk();
|
|
83338
83418
|
const children = node.getChildren();
|
|
83339
|
-
for
|
|
83419
|
+
// Pre-scan for unary prefix +/- tokens (WDashW / WPlusW) before any expression
|
|
83420
|
+
let prefixNegated = false;
|
|
83421
|
+
let startIdx = 0;
|
|
83422
|
+
while (startIdx < children.length) {
|
|
83423
|
+
const c = children[startIdx];
|
|
83424
|
+
if (c instanceof core_1.Nodes.TokenNode) {
|
|
83425
|
+
const s = c.getFirstToken().getStr();
|
|
83426
|
+
if (s === "-") {
|
|
83427
|
+
prefixNegated = !prefixNegated;
|
|
83428
|
+
startIdx++;
|
|
83429
|
+
}
|
|
83430
|
+
else if (s === "+") {
|
|
83431
|
+
startIdx++;
|
|
83432
|
+
}
|
|
83433
|
+
else {
|
|
83434
|
+
break;
|
|
83435
|
+
}
|
|
83436
|
+
}
|
|
83437
|
+
else {
|
|
83438
|
+
break;
|
|
83439
|
+
}
|
|
83440
|
+
}
|
|
83441
|
+
for (let i = startIdx; i < children.length; i++) {
|
|
83340
83442
|
const c = children[i];
|
|
83341
83443
|
const isLast = i === children.length - 1;
|
|
83342
83444
|
if (c instanceof core_1.Nodes.ExpressionNode) {
|
|
@@ -83535,6 +83637,9 @@ class SourceTranspiler {
|
|
|
83535
83637
|
}
|
|
83536
83638
|
}
|
|
83537
83639
|
ret.appendChunk(post);
|
|
83640
|
+
if (prefixNegated) {
|
|
83641
|
+
ret = new chunk_1.Chunk().appendString("abap.operators.minus(0, ").appendChunk(ret).appendString(")");
|
|
83642
|
+
}
|
|
83538
83643
|
// console.dir("return: " + ret.getCode());
|
|
83539
83644
|
return ret;
|
|
83540
83645
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.9",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"author": "abaplint",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@abaplint/core": "^2.118.
|
|
31
|
-
"@abaplint/transpiler": "^2.13.
|
|
30
|
+
"@abaplint/core": "^2.118.10",
|
|
31
|
+
"@abaplint/transpiler": "^2.13.9",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/node": "^24.12.0",
|
|
34
34
|
"@types/progress": "^2.0.7",
|