@abaplint/transpiler 2.13.39 → 2.13.40
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.
|
@@ -53,6 +53,9 @@ class ConcatenateTranspiler {
|
|
|
53
53
|
if (concat.includes(" RESPECTING BLANKS")) {
|
|
54
54
|
extra += ", respectingBlanks: true";
|
|
55
55
|
}
|
|
56
|
+
if (concat.includes(" IN BYTE MODE")) {
|
|
57
|
+
extra += ", byteMode: true";
|
|
58
|
+
}
|
|
56
59
|
const target = traversal.traverse(node.findDirectExpression(abaplint.Expressions.Target));
|
|
57
60
|
return new chunk_1.Chunk()
|
|
58
61
|
.append("abap.statements.concatenate({source: [", node, traversal)
|
|
@@ -37,7 +37,6 @@ exports.ReturnTranspiler = void 0;
|
|
|
37
37
|
const abaplint = __importStar(require("@abaplint/core"));
|
|
38
38
|
const traversal_1 = require("../traversal");
|
|
39
39
|
const chunk_1 = require("../chunk");
|
|
40
|
-
const unique_identifier_1 = require("../unique_identifier");
|
|
41
40
|
class ReturnTranspiler {
|
|
42
41
|
transpile(node, traversal) {
|
|
43
42
|
const source = node.findDirectExpression(abaplint.Expressions.Source);
|
|
@@ -51,8 +50,9 @@ class ReturnTranspiler {
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
let pre = "";
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const syIndexBackup = traversal.findCurrentDoOrWhileIndexBackup(node);
|
|
54
|
+
if (syIndexBackup !== undefined) {
|
|
55
|
+
pre = `abap.builtin.sy.get().index.set(${syIndexBackup});\n`;
|
|
56
56
|
}
|
|
57
57
|
if (scope?.getIdentifier().stype === abaplint.ScopeType.Method
|
|
58
58
|
&& scope?.getIdentifier().sname.toLowerCase() === "constructor") {
|
|
@@ -44,6 +44,7 @@ class DoTranspiler {
|
|
|
44
44
|
const syIndexBackup = unique_identifier_1.UniqueIdentifier.getIndexBackup();
|
|
45
45
|
for (const c of node.getChildren()) {
|
|
46
46
|
if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.Do) {
|
|
47
|
+
traversal.registerDoOrWhileIndexBackup(c, syIndexBackup);
|
|
47
48
|
ret.appendChunk(new statements_1.DoTranspiler(syIndexBackup).transpile(c, traversal));
|
|
48
49
|
ret.appendString("\n");
|
|
49
50
|
}
|
|
@@ -44,6 +44,7 @@ class WhileTranspiler {
|
|
|
44
44
|
const syIndexBackup = unique_identifier_1.UniqueIdentifier.getIndexBackup();
|
|
45
45
|
for (const c of node.getChildren()) {
|
|
46
46
|
if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.While) {
|
|
47
|
+
traversal.registerDoOrWhileIndexBackup(c, syIndexBackup);
|
|
47
48
|
ret.appendChunk(new statements_1.WhileTranspiler(syIndexBackup).transpile(c, traversal));
|
|
48
49
|
ret.appendString("\n");
|
|
49
50
|
}
|
package/build/src/traversal.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare class Traversal {
|
|
|
6
6
|
private readonly file;
|
|
7
7
|
private readonly obj;
|
|
8
8
|
private sqlInferredType;
|
|
9
|
+
private readonly doOrWhileIndexBackups;
|
|
9
10
|
readonly reg: abaplint.IRegistry;
|
|
10
11
|
readonly options: ITranspilerOptions | undefined;
|
|
11
12
|
constructor(spaghetti: abaplint.ISpaghettiScope, file: abaplint.ABAPFile, obj: abaplint.ABAPObject, reg: abaplint.IRegistry, options?: ITranspilerOptions);
|
|
@@ -58,6 +59,8 @@ export declare class Traversal {
|
|
|
58
59
|
determineType(node: abaplint.Nodes.ExpressionNode | abaplint.Nodes.StatementNode, scope: abaplint.ISpaghettiScopeNode | undefined): abaplint.AbstractType | undefined;
|
|
59
60
|
isInsideLoop(node: abaplint.Nodes.StatementNode): boolean;
|
|
60
61
|
isInsideDoOrWhile(node: abaplint.Nodes.StatementNode): boolean;
|
|
62
|
+
registerDoOrWhileIndexBackup(node: abaplint.Nodes.StatementNode, name: string): void;
|
|
63
|
+
findCurrentDoOrWhileIndexBackup(node: abaplint.Nodes.StatementNode): string | undefined;
|
|
61
64
|
registerClassOrInterface(def: abaplint.IClassDefinition | abaplint.IInterfaceDefinition | undefined): string;
|
|
62
65
|
setValues(identifier: abaplint.TypedIdentifier, name: string): string;
|
|
63
66
|
static setValues(identifier: abaplint.TypedIdentifier, name: string): string;
|
package/build/src/traversal.js
CHANGED
|
@@ -47,6 +47,7 @@ class Traversal {
|
|
|
47
47
|
file;
|
|
48
48
|
obj;
|
|
49
49
|
sqlInferredType;
|
|
50
|
+
doOrWhileIndexBackups = new Map();
|
|
50
51
|
reg;
|
|
51
52
|
options;
|
|
52
53
|
constructor(spaghetti, file, obj, reg, options) {
|
|
@@ -779,12 +780,18 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
|
|
|
779
780
|
return stack.length > 0;
|
|
780
781
|
}
|
|
781
782
|
isInsideDoOrWhile(node) {
|
|
783
|
+
return this.findCurrentDoOrWhileIndexBackup(node) !== undefined;
|
|
784
|
+
}
|
|
785
|
+
registerDoOrWhileIndexBackup(node, name) {
|
|
786
|
+
this.doOrWhileIndexBackups.set(node, name);
|
|
787
|
+
}
|
|
788
|
+
findCurrentDoOrWhileIndexBackup(node) {
|
|
782
789
|
const stack = [];
|
|
783
790
|
for (const statement of this.getFile().getStatements()) {
|
|
784
791
|
const get = statement.get();
|
|
785
792
|
if (get instanceof abaplint.Statements.While
|
|
786
793
|
|| get instanceof abaplint.Statements.Do) {
|
|
787
|
-
stack.push(statement);
|
|
794
|
+
stack.push(this.doOrWhileIndexBackups.get(statement));
|
|
788
795
|
}
|
|
789
796
|
else if (get instanceof abaplint.Statements.EndWhile
|
|
790
797
|
|| get instanceof abaplint.Statements.EndDo) {
|
|
@@ -794,7 +801,7 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
|
|
|
794
801
|
break;
|
|
795
802
|
}
|
|
796
803
|
}
|
|
797
|
-
return stack.length
|
|
804
|
+
return stack[stack.length - 1];
|
|
798
805
|
}
|
|
799
806
|
registerClassOrInterface(def) {
|
|
800
807
|
if (def === undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.40",
|
|
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.119.
|
|
32
|
+
"@abaplint/core": "^2.119.65",
|
|
33
33
|
"source-map": "^0.7.6"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|