@abaplint/transpiler-cli 2.12.27 → 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 +58 -21
- package/package.json +6 -6
package/build/bundle.js
CHANGED
|
@@ -3184,7 +3184,7 @@ const let_1 = __webpack_require__(/*! ./let */ "./node_modules/@abaplint/core/bu
|
|
|
3184
3184
|
class Cast extends combi_1.Expression {
|
|
3185
3185
|
getRunnable() {
|
|
3186
3186
|
const rparen = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight));
|
|
3187
|
-
const cast = (0, combi_1.seq)("CAST", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.optPrio)(let_1.Let), _1.Source, rparen);
|
|
3187
|
+
const cast = (0, combi_1.seq)("CAST", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.optPrio)(let_1.Let), _1.Source, rparen, (0, combi_1.opt)(_1.Dereference));
|
|
3188
3188
|
return (0, combi_1.ver)(version_1.Version.v740sp02, cast, version_1.Version.OpenABAP);
|
|
3189
3189
|
}
|
|
3190
3190
|
}
|
|
@@ -14330,8 +14330,7 @@ class Move {
|
|
|
14330
14330
|
const equals = (0, combi_1.altPrio)((0, combi_1.altPrio)(chained, "?="), calcAssign);
|
|
14331
14331
|
// todo, move "?=" to CAST?
|
|
14332
14332
|
const eq = (0, combi_1.seq)(expressions_1.Target, equals, expressions_1.Source);
|
|
14333
|
-
|
|
14334
|
-
return (0, combi_1.alt)(move, eq, eqd);
|
|
14333
|
+
return (0, combi_1.alt)(move, eq);
|
|
14335
14334
|
}
|
|
14336
14335
|
}
|
|
14337
14336
|
exports.Move = Move;
|
|
@@ -30541,8 +30540,9 @@ class CreateObject {
|
|
|
30541
30540
|
return;
|
|
30542
30541
|
}
|
|
30543
30542
|
else if (found instanceof basic_1.ObjectReferenceType) {
|
|
30544
|
-
const
|
|
30545
|
-
|
|
30543
|
+
const identifier = found.getIdentifier();
|
|
30544
|
+
const idFound = input.scope.findObjectDefinition(identifier.getName());
|
|
30545
|
+
if (idFound instanceof types_1.InterfaceDefinition && type === undefined) {
|
|
30546
30546
|
const message = "Interface reference, cannot be instantiated";
|
|
30547
30547
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
30548
30548
|
return;
|
|
@@ -30554,11 +30554,11 @@ class CreateObject {
|
|
|
30554
30554
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
30555
30555
|
return;
|
|
30556
30556
|
}
|
|
30557
|
-
else if (
|
|
30558
|
-
cdef =
|
|
30557
|
+
else if (idFound instanceof types_1.ClassDefinition && cdef === undefined) {
|
|
30558
|
+
cdef = idFound;
|
|
30559
30559
|
}
|
|
30560
|
-
if (type === undefined &&
|
|
30561
|
-
const message =
|
|
30560
|
+
if (type === undefined && idFound instanceof types_1.ClassDefinition && idFound.isAbstract() === true) {
|
|
30561
|
+
const message = identifier.getName() + " is abstract, cannot be instantiated";
|
|
30562
30562
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
30563
30563
|
return;
|
|
30564
30564
|
}
|
|
@@ -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 = "";
|
|
@@ -88626,13 +88667,9 @@ class MessageTranspiler {
|
|
|
88626
88667
|
}
|
|
88627
88668
|
else {
|
|
88628
88669
|
// exception or constant based
|
|
88629
|
-
const
|
|
88630
|
-
|
|
88631
|
-
|
|
88632
|
-
options.push("text: " + traversal.traverse(str).getCode());
|
|
88633
|
-
}
|
|
88634
|
-
else {
|
|
88635
|
-
options.push("exception: " + traversal.traverse(exception).getCode());
|
|
88670
|
+
const source = node.findDirectExpression(abaplint.Expressions.MessageSourceSource)?.findDirectExpression(abaplint.Expressions.Source);
|
|
88671
|
+
if (source) {
|
|
88672
|
+
options.push("exceptionOrText: " + traversal.traverse(source).getCode());
|
|
88636
88673
|
}
|
|
88637
88674
|
const type = node.findExpressionAfterToken("TYPE");
|
|
88638
88675
|
if (type) {
|
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,17 +27,17 @@
|
|
|
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
|
-
"@types/node": "^24.10.
|
|
33
|
+
"@types/node": "^24.10.13",
|
|
34
34
|
"@types/progress": "^2.0.7",
|
|
35
35
|
"glob": "=7.2.0",
|
|
36
36
|
"progress": "^2.0.3",
|
|
37
|
-
"ts-json-schema-generator": "
|
|
37
|
+
"ts-json-schema-generator": "=2.4.0",
|
|
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
|
}
|