@abaplint/transpiler-cli 2.12.28 → 2.12.29
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 +46 -5
- package/package.json +4 -4
package/build/bundle.js
CHANGED
|
@@ -40515,7 +40515,9 @@ const cds_annotation_array_1 = __webpack_require__(/*! ./cds_annotation_array */
|
|
|
40515
40515
|
class CDSAnnotation extends combi_1.Expression {
|
|
40516
40516
|
getRunnable() {
|
|
40517
40517
|
const nameWithSlash = (0, combi_1.seq)((0, combi_1.regex)(/^\w+$/), (0, combi_1.star)((0, combi_1.seq)("/", (0, combi_1.regex)(/^\w+$/))));
|
|
40518
|
-
|
|
40518
|
+
// Support both "@Name" (single token) and "@ Name" (two tokens with space)
|
|
40519
|
+
const annotationStart = (0, combi_1.alt)((0, combi_1.regex)(/^@\w+$/), (0, combi_1.seq)("@", (0, combi_1.regex)(/^\w+$/)));
|
|
40520
|
+
return (0, combi_1.seq)(annotationStart, (0, combi_1.star)((0, combi_1.seq)(".", nameWithSlash)), (0, combi_1.opt)((0, combi_1.seq)(":", (0, combi_1.alt)(cds_annotation_array_1.CDSAnnotationArray, _1.CDSAnnotationObject, _1.CDSAnnotationSimple))));
|
|
40519
40521
|
}
|
|
40520
40522
|
}
|
|
40521
40523
|
exports.CDSAnnotation = CDSAnnotation;
|
|
@@ -40615,11 +40617,14 @@ class CDSArithmetics extends combi_1.Expression {
|
|
|
40615
40617
|
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)));
|
|
40616
40618
|
const val = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString, _1.CDSAggregate, name);
|
|
40617
40619
|
const operator = (0, combi_1.altPrio)("+", "-", "*", "/");
|
|
40620
|
+
// Support unary operators (e.g., "- field" in CASE expressions)
|
|
40621
|
+
const unary = (0, combi_1.altPrio)("-", "+");
|
|
40622
|
+
const unaryExpression = (0, combi_1.seq)(unary, val);
|
|
40618
40623
|
const operatorValue = (0, combi_1.seq)(operator, val);
|
|
40619
40624
|
const paren = (0, combi_1.seq)("(", val, (0, combi_1.plusPrio)(operatorValue), ")");
|
|
40620
40625
|
const noParen = (0, combi_1.seq)(val, (0, combi_1.plusPrio)(operatorValue));
|
|
40621
40626
|
// todo: this is pretty bad, it needs a rewrite
|
|
40622
|
-
return (0, combi_1.altPrio)((0, combi_1.seq)(paren, (0, combi_1.starPrio)(operatorValue)), noParen);
|
|
40627
|
+
return (0, combi_1.altPrio)(unaryExpression, (0, combi_1.seq)(paren, (0, combi_1.starPrio)(operatorValue)), noParen);
|
|
40623
40628
|
}
|
|
40624
40629
|
}
|
|
40625
40630
|
exports.CDSArithmetics = CDSArithmetics;
|
|
@@ -52027,7 +52032,15 @@ class RenamerHelper {
|
|
|
52027
52032
|
}
|
|
52028
52033
|
}
|
|
52029
52034
|
// start with the last reference in the file first, if there are multiple refs per line
|
|
52030
|
-
|
|
52035
|
+
// sort refs by position descending (row desc, then col desc) so edits don't corrupt positions
|
|
52036
|
+
refs.sort((a, b) => {
|
|
52037
|
+
const rowDiff = b.getStart().getRow() - a.getStart().getRow();
|
|
52038
|
+
if (rowDiff !== 0) {
|
|
52039
|
+
return rowDiff;
|
|
52040
|
+
}
|
|
52041
|
+
return b.getStart().getCol() - a.getStart().getCol();
|
|
52042
|
+
});
|
|
52043
|
+
return this.replaceRefs(refs, oldName, newName);
|
|
52031
52044
|
}
|
|
52032
52045
|
renameDDICCodeReferences(obj, oldName, newName) {
|
|
52033
52046
|
const changes = [];
|
|
@@ -52167,8 +52180,14 @@ class RenamerHelper {
|
|
|
52167
52180
|
////////////////////////
|
|
52168
52181
|
replaceRefs(refs, oldName, newName) {
|
|
52169
52182
|
const changes = [];
|
|
52183
|
+
const seen = new Set();
|
|
52170
52184
|
// "zif_abapgit_auth~is_allowed" is a single token so only replace the first part of a token
|
|
52171
52185
|
for (const r of refs) {
|
|
52186
|
+
const key = r.getFilename() + ":" + r.getStart().getRow() + ":" + r.getStart().getCol();
|
|
52187
|
+
if (seen.has(key)) {
|
|
52188
|
+
continue;
|
|
52189
|
+
}
|
|
52190
|
+
seen.add(key);
|
|
52172
52191
|
const range = vscode_languageserver_types_1.Range.create(r.getStart().getRow() - 1, r.getStart().getCol() - 1, r.getStart().getRow() - 1, r.getStart().getCol() - 1 + oldName.length);
|
|
52173
52192
|
changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: r.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, newName.toLowerCase())]));
|
|
52174
52193
|
}
|
|
@@ -54395,7 +54414,7 @@ class Registry {
|
|
|
54395
54414
|
}
|
|
54396
54415
|
static abaplintVersion() {
|
|
54397
54416
|
// magic, see build script "version.sh"
|
|
54398
|
-
return "2.115.
|
|
54417
|
+
return "2.115.25";
|
|
54399
54418
|
}
|
|
54400
54419
|
getDDICReferences() {
|
|
54401
54420
|
return this.ddicReferences;
|
|
@@ -85362,7 +85381,29 @@ class AssignTranspiler {
|
|
|
85362
85381
|
options.push("target: " + fs);
|
|
85363
85382
|
if (sources.length !== 0
|
|
85364
85383
|
&& assignSource?.findDirectExpression(abaplint.Expressions.Dynamic) === undefined) {
|
|
85365
|
-
|
|
85384
|
+
// Check for struct-(var) pattern: dynamic component access via FieldLength after -
|
|
85385
|
+
const sourceExprForCheck = assignSource?.findDirectExpressionsMulti([abaplint.Expressions.Source, abaplint.Expressions.SimpleSource3])[0];
|
|
85386
|
+
const fieldChainForCheck = sourceExprForCheck?.findFirstExpression(abaplint.Expressions.FieldChain);
|
|
85387
|
+
const fcChildren = fieldChainForCheck?.getChildren() ?? [];
|
|
85388
|
+
const lastFC = fcChildren[fcChildren.length - 1];
|
|
85389
|
+
const prevFC = fcChildren[fcChildren.length - 2];
|
|
85390
|
+
const isStructDynField = fieldChainForCheck !== undefined
|
|
85391
|
+
&& lastFC instanceof abaplint.Nodes.ExpressionNode
|
|
85392
|
+
&& lastFC.get() instanceof abaplint.Expressions.FieldLength
|
|
85393
|
+
&& prevFC instanceof abaplint.Nodes.TokenNode
|
|
85394
|
+
&& prevFC.getFirstToken().getStr() === "-";
|
|
85395
|
+
if (isStructDynField) {
|
|
85396
|
+
const componentCode = new expressions_1.FieldLengthTranspiler().transpile(lastFC, traversal).getCode();
|
|
85397
|
+
const fullSource = sources.pop();
|
|
85398
|
+
// Strip trailing .get().getOffset(...) to recover the base structure variable
|
|
85399
|
+
const getOffsetIdx = fullSource.lastIndexOf(".get().getOffset(");
|
|
85400
|
+
const baseSourceCode = getOffsetIdx >= 0 ? fullSource.substring(0, getOffsetIdx) : fullSource;
|
|
85401
|
+
options.push("component: " + componentCode);
|
|
85402
|
+
options.push("source: " + baseSourceCode);
|
|
85403
|
+
}
|
|
85404
|
+
else {
|
|
85405
|
+
options.push("source: " + sources.pop());
|
|
85406
|
+
}
|
|
85366
85407
|
}
|
|
85367
85408
|
else {
|
|
85368
85409
|
let dynamicName = "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.29",
|
|
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.115.
|
|
31
|
-
"@abaplint/transpiler": "^2.12.
|
|
30
|
+
"@abaplint/core": "^2.115.25",
|
|
31
|
+
"@abaplint/transpiler": "^2.12.29",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/node": "^24.10.13",
|
|
34
34
|
"@types/progress": "^2.0.7",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"typescript": "^5.9.3",
|
|
39
39
|
"p-limit": "^3.1.0",
|
|
40
40
|
"webpack-cli": "^6.0.1",
|
|
41
|
-
"webpack": "^5.105.
|
|
41
|
+
"webpack": "^5.105.2"
|
|
42
42
|
}
|
|
43
43
|
}
|