@abaplint/transpiler 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.
|
@@ -22,7 +22,29 @@ class AssignTranspiler {
|
|
|
22
22
|
options.push("target: " + fs);
|
|
23
23
|
if (sources.length !== 0
|
|
24
24
|
&& assignSource?.findDirectExpression(abaplint.Expressions.Dynamic) === undefined) {
|
|
25
|
-
|
|
25
|
+
// Check for struct-(var) pattern: dynamic component access via FieldLength after -
|
|
26
|
+
const sourceExprForCheck = assignSource?.findDirectExpressionsMulti([abaplint.Expressions.Source, abaplint.Expressions.SimpleSource3])[0];
|
|
27
|
+
const fieldChainForCheck = sourceExprForCheck?.findFirstExpression(abaplint.Expressions.FieldChain);
|
|
28
|
+
const fcChildren = fieldChainForCheck?.getChildren() ?? [];
|
|
29
|
+
const lastFC = fcChildren[fcChildren.length - 1];
|
|
30
|
+
const prevFC = fcChildren[fcChildren.length - 2];
|
|
31
|
+
const isStructDynField = fieldChainForCheck !== undefined
|
|
32
|
+
&& lastFC instanceof abaplint.Nodes.ExpressionNode
|
|
33
|
+
&& lastFC.get() instanceof abaplint.Expressions.FieldLength
|
|
34
|
+
&& prevFC instanceof abaplint.Nodes.TokenNode
|
|
35
|
+
&& prevFC.getFirstToken().getStr() === "-";
|
|
36
|
+
if (isStructDynField) {
|
|
37
|
+
const componentCode = new expressions_1.FieldLengthTranspiler().transpile(lastFC, traversal).getCode();
|
|
38
|
+
const fullSource = sources.pop();
|
|
39
|
+
// Strip trailing .get().getOffset(...) to recover the base structure variable
|
|
40
|
+
const getOffsetIdx = fullSource.lastIndexOf(".get().getOffset(");
|
|
41
|
+
const baseSourceCode = getOffsetIdx >= 0 ? fullSource.substring(0, getOffsetIdx) : fullSource;
|
|
42
|
+
options.push("component: " + componentCode);
|
|
43
|
+
options.push("source: " + baseSourceCode);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
options.push("source: " + sources.pop());
|
|
47
|
+
}
|
|
26
48
|
}
|
|
27
49
|
else {
|
|
28
50
|
let dynamicName = "";
|
|
@@ -41,13 +41,9 @@ class MessageTranspiler {
|
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
// exception or constant based
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
options.push("text: " + traversal.traverse(str).getCode());
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
options.push("exception: " + traversal.traverse(exception).getCode());
|
|
44
|
+
const source = node.findDirectExpression(abaplint.Expressions.MessageSourceSource)?.findDirectExpression(abaplint.Expressions.Source);
|
|
45
|
+
if (source) {
|
|
46
|
+
options.push("exceptionOrText: " + traversal.traverse(source).getCode());
|
|
51
47
|
}
|
|
52
48
|
const type = node.findExpressionAfterToken("TYPE");
|
|
53
49
|
if (type) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.29",
|
|
4
4
|
"description": "Transpiler",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"author": "abaplint",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@abaplint/core": "^2.115.
|
|
32
|
+
"@abaplint/core": "^2.115.25",
|
|
33
33
|
"source-map": "^0.7.6"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|