@abaplint/transpiler 2.0.42 → 2.0.45
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/README.md +2 -2
- package/build/src/handle_data_element.js +5 -5
- package/build/src/handle_table.js +4 -4
- package/build/src/handle_table_type.js +3 -3
- package/build/src/statements/close_dataset.d.ts +7 -0
- package/build/src/statements/close_dataset.js +11 -0
- package/build/src/statements/delete_dataset.d.ts +7 -0
- package/build/src/statements/delete_dataset.js +11 -0
- package/build/src/statements/do.js +4 -4
- package/build/src/statements/get_dataset.d.ts +7 -0
- package/build/src/statements/get_dataset.js +11 -0
- package/build/src/statements/index.d.ts +9 -1
- package/build/src/statements/index.js +9 -1
- package/build/src/statements/open_dataset.d.ts +7 -0
- package/build/src/statements/open_dataset.js +11 -0
- package/build/src/statements/read_dataset.d.ts +7 -0
- package/build/src/statements/read_dataset.js +11 -0
- package/build/src/statements/set_dataset.d.ts +7 -0
- package/build/src/statements/set_dataset.js +11 -0
- package/build/src/statements/sort_dataset.d.ts +7 -0
- package/build/src/statements/sort_dataset.js +11 -0
- package/build/src/statements/truncate_dataset.d.ts +7 -0
- package/build/src/statements/truncate_dataset.js +11 -0
- package/build/src/traversal.js +5 -3
- package/build/src/unit_test.js +68 -68
- package/package.json +42 -42
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# @abaplint/transpiler
|
|
2
|
-
|
|
1
|
+
# @abaplint/transpiler
|
|
2
|
+
|
|
3
3
|
Transpiler
|
|
@@ -18,11 +18,11 @@ class HandleDataElement {
|
|
|
18
18
|
fixedValues = doma.getFixedValues();
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
22
|
-
"objectType": "DTEL",
|
|
23
|
-
"type": ${new transpile_types_1.TranspileTypes().toType(type)},
|
|
24
|
-
"domain": ${JSON.stringify(obj.getDomainName())},
|
|
25
|
-
"fixedValues": ${JSON.stringify(fixedValues)},
|
|
21
|
+
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
22
|
+
"objectType": "DTEL",
|
|
23
|
+
"type": ${new transpile_types_1.TranspileTypes().toType(type)},
|
|
24
|
+
"domain": ${JSON.stringify(obj.getDomainName())},
|
|
25
|
+
"fixedValues": ${JSON.stringify(fixedValues)},
|
|
26
26
|
};`);
|
|
27
27
|
const output = {
|
|
28
28
|
object: {
|
|
@@ -12,10 +12,10 @@ class HandleTable {
|
|
|
12
12
|
return [];
|
|
13
13
|
}
|
|
14
14
|
const type = obj.parseType(reg);
|
|
15
|
-
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
16
|
-
"objectType": "TABL",
|
|
17
|
-
"type": ${new transpile_types_1.TranspileTypes().toType(type)},
|
|
18
|
-
"keyFields": ${JSON.stringify(obj.listKeys())},
|
|
15
|
+
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
16
|
+
"objectType": "TABL",
|
|
17
|
+
"type": ${new transpile_types_1.TranspileTypes().toType(type)},
|
|
18
|
+
"keyFields": ${JSON.stringify(obj.listKeys())},
|
|
19
19
|
};`);
|
|
20
20
|
const output = {
|
|
21
21
|
object: {
|
|
@@ -11,9 +11,9 @@ class HandleTableType {
|
|
|
11
11
|
return [];
|
|
12
12
|
}
|
|
13
13
|
const type = obj.parseType(reg);
|
|
14
|
-
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
15
|
-
"objectType": "TTYP",
|
|
16
|
-
"type": ${new transpile_types_1.TranspileTypes().toType(type)},
|
|
14
|
+
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
15
|
+
"objectType": "TTYP",
|
|
16
|
+
"type": ${new transpile_types_1.TranspileTypes().toType(type)},
|
|
17
17
|
};`);
|
|
18
18
|
const output = {
|
|
19
19
|
object: {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as abaplint from "@abaplint/core";
|
|
2
|
+
import { IStatementTranspiler } from "./_statement_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class CloseDatasetTranspiler implements IStatementTranspiler {
|
|
6
|
+
transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloseDatasetTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class CloseDatasetTranspiler {
|
|
6
|
+
transpile(_node, _traversal) {
|
|
7
|
+
return new chunk_1.Chunk(`throw new Error("CloseDataset, not supported, transpiler");`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.CloseDatasetTranspiler = CloseDatasetTranspiler;
|
|
11
|
+
//# sourceMappingURL=close_dataset.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as abaplint from "@abaplint/core";
|
|
2
|
+
import { IStatementTranspiler } from "./_statement_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class DeleteDatasetTranspiler implements IStatementTranspiler {
|
|
6
|
+
transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteDatasetTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class DeleteDatasetTranspiler {
|
|
6
|
+
transpile(_node, _traversal) {
|
|
7
|
+
return new chunk_1.Chunk(`throw new Error("DeleteDataset, not supported, transpiler");`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.DeleteDatasetTranspiler = DeleteDatasetTranspiler;
|
|
11
|
+
//# sourceMappingURL=delete_dataset.js.map
|
|
@@ -12,14 +12,14 @@ class DoTranspiler {
|
|
|
12
12
|
const source = new expressions_1.SourceTranspiler(true).transpile(found, traversal).getCode();
|
|
13
13
|
const idSource = unique_identifier_1.UniqueIdentifier.get();
|
|
14
14
|
const id = unique_identifier_1.UniqueIdentifier.get();
|
|
15
|
-
return new chunk_1.Chunk(`const ${idSource} = ${source};
|
|
16
|
-
for (let ${id} = 0; ${id} < ${idSource}; ${id}++) {
|
|
15
|
+
return new chunk_1.Chunk(`const ${idSource} = ${source};
|
|
16
|
+
for (let ${id} = 0; ${id} < ${idSource}; ${id}++) {
|
|
17
17
|
abap.builtin.sy.get().index.set(${id} + 1);`);
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
20
|
const unique = unique_identifier_1.UniqueIdentifier.get();
|
|
21
|
-
return new chunk_1.Chunk(`let ${unique} = 1;
|
|
22
|
-
while (true) {
|
|
21
|
+
return new chunk_1.Chunk(`let ${unique} = 1;
|
|
22
|
+
while (true) {
|
|
23
23
|
abap.builtin.sy.get().index.set(${unique}++);`);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as abaplint from "@abaplint/core";
|
|
2
|
+
import { IStatementTranspiler } from "./_statement_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class GetDatasetTranspiler implements IStatementTranspiler {
|
|
6
|
+
transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetDatasetTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class GetDatasetTranspiler {
|
|
6
|
+
transpile(_node, _traversal) {
|
|
7
|
+
return new chunk_1.Chunk(`throw new Error("GetDataset, not supported, transpiler");`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.GetDatasetTranspiler = GetDatasetTranspiler;
|
|
11
|
+
//# sourceMappingURL=get_dataset.js.map
|
|
@@ -8,12 +8,12 @@ export * from "./call_function";
|
|
|
8
8
|
export * from "./call_transformation";
|
|
9
9
|
export * from "./call";
|
|
10
10
|
export * from "./case";
|
|
11
|
-
export * from "./scan";
|
|
12
11
|
export * from "./check";
|
|
13
12
|
export * from "./class_deferred";
|
|
14
13
|
export * from "./class_implementation";
|
|
15
14
|
export * from "./class_local_friends";
|
|
16
15
|
export * from "./clear";
|
|
16
|
+
export * from "./close_dataset";
|
|
17
17
|
export * from "./collect";
|
|
18
18
|
export * from "./commit";
|
|
19
19
|
export * from "./concatenate";
|
|
@@ -25,6 +25,7 @@ export * from "./create_data";
|
|
|
25
25
|
export * from "./create_object";
|
|
26
26
|
export * from "./data";
|
|
27
27
|
export * from "./delete_database";
|
|
28
|
+
export * from "./delete_dataset";
|
|
28
29
|
export * from "./delete_internal";
|
|
29
30
|
export * from "./describe";
|
|
30
31
|
export * from "./do";
|
|
@@ -47,6 +48,7 @@ export * from "./form";
|
|
|
47
48
|
export * from "./free";
|
|
48
49
|
export * from "./function_pool";
|
|
49
50
|
export * from "./get_bit";
|
|
51
|
+
export * from "./get_dataset";
|
|
50
52
|
export * from "./get_locale";
|
|
51
53
|
export * from "./get_parameter";
|
|
52
54
|
export * from "./get_reference";
|
|
@@ -63,10 +65,12 @@ export * from "./modify_database";
|
|
|
63
65
|
export * from "./modify_internal";
|
|
64
66
|
export * from "./move_corresponding";
|
|
65
67
|
export * from "./move";
|
|
68
|
+
export * from "./open_dataset";
|
|
66
69
|
export * from "./parameter";
|
|
67
70
|
export * from "./perform";
|
|
68
71
|
export * from "./raise_event";
|
|
69
72
|
export * from "./raise";
|
|
73
|
+
export * from "./read_dataset";
|
|
70
74
|
export * from "./read_line";
|
|
71
75
|
export * from "./read_report";
|
|
72
76
|
export * from "./read_table";
|
|
@@ -75,18 +79,22 @@ export * from "./replace";
|
|
|
75
79
|
export * from "./report";
|
|
76
80
|
export * from "./return";
|
|
77
81
|
export * from "./rollback";
|
|
82
|
+
export * from "./scan";
|
|
78
83
|
export * from "./select";
|
|
79
84
|
export * from "./set_bit";
|
|
85
|
+
export * from "./set_dataset";
|
|
80
86
|
export * from "./set_handler";
|
|
81
87
|
export * from "./set_locale";
|
|
82
88
|
export * from "./set_parameter";
|
|
83
89
|
export * from "./shift";
|
|
90
|
+
export * from "./sort_dataset";
|
|
84
91
|
export * from "./sort";
|
|
85
92
|
export * from "./split";
|
|
86
93
|
export * from "./start_of_selection";
|
|
87
94
|
export * from "./submit";
|
|
88
95
|
export * from "./subtract";
|
|
89
96
|
export * from "./translate";
|
|
97
|
+
export * from "./truncate_dataset";
|
|
90
98
|
export * from "./try";
|
|
91
99
|
export * from "./type";
|
|
92
100
|
export * from "./unassign";
|
|
@@ -24,12 +24,12 @@ __exportStar(require("./call_function"), exports);
|
|
|
24
24
|
__exportStar(require("./call_transformation"), exports);
|
|
25
25
|
__exportStar(require("./call"), exports);
|
|
26
26
|
__exportStar(require("./case"), exports);
|
|
27
|
-
__exportStar(require("./scan"), exports);
|
|
28
27
|
__exportStar(require("./check"), exports);
|
|
29
28
|
__exportStar(require("./class_deferred"), exports);
|
|
30
29
|
__exportStar(require("./class_implementation"), exports);
|
|
31
30
|
__exportStar(require("./class_local_friends"), exports);
|
|
32
31
|
__exportStar(require("./clear"), exports);
|
|
32
|
+
__exportStar(require("./close_dataset"), exports);
|
|
33
33
|
__exportStar(require("./collect"), exports);
|
|
34
34
|
__exportStar(require("./commit"), exports);
|
|
35
35
|
__exportStar(require("./concatenate"), exports);
|
|
@@ -41,6 +41,7 @@ __exportStar(require("./create_data"), exports);
|
|
|
41
41
|
__exportStar(require("./create_object"), exports);
|
|
42
42
|
__exportStar(require("./data"), exports);
|
|
43
43
|
__exportStar(require("./delete_database"), exports);
|
|
44
|
+
__exportStar(require("./delete_dataset"), exports);
|
|
44
45
|
__exportStar(require("./delete_internal"), exports);
|
|
45
46
|
__exportStar(require("./describe"), exports);
|
|
46
47
|
__exportStar(require("./do"), exports);
|
|
@@ -63,6 +64,7 @@ __exportStar(require("./form"), exports);
|
|
|
63
64
|
__exportStar(require("./free"), exports);
|
|
64
65
|
__exportStar(require("./function_pool"), exports);
|
|
65
66
|
__exportStar(require("./get_bit"), exports);
|
|
67
|
+
__exportStar(require("./get_dataset"), exports);
|
|
66
68
|
__exportStar(require("./get_locale"), exports);
|
|
67
69
|
__exportStar(require("./get_parameter"), exports);
|
|
68
70
|
__exportStar(require("./get_reference"), exports);
|
|
@@ -79,10 +81,12 @@ __exportStar(require("./modify_database"), exports);
|
|
|
79
81
|
__exportStar(require("./modify_internal"), exports);
|
|
80
82
|
__exportStar(require("./move_corresponding"), exports);
|
|
81
83
|
__exportStar(require("./move"), exports);
|
|
84
|
+
__exportStar(require("./open_dataset"), exports);
|
|
82
85
|
__exportStar(require("./parameter"), exports);
|
|
83
86
|
__exportStar(require("./perform"), exports);
|
|
84
87
|
__exportStar(require("./raise_event"), exports);
|
|
85
88
|
__exportStar(require("./raise"), exports);
|
|
89
|
+
__exportStar(require("./read_dataset"), exports);
|
|
86
90
|
__exportStar(require("./read_line"), exports);
|
|
87
91
|
__exportStar(require("./read_report"), exports);
|
|
88
92
|
__exportStar(require("./read_table"), exports);
|
|
@@ -91,18 +95,22 @@ __exportStar(require("./replace"), exports);
|
|
|
91
95
|
__exportStar(require("./report"), exports);
|
|
92
96
|
__exportStar(require("./return"), exports);
|
|
93
97
|
__exportStar(require("./rollback"), exports);
|
|
98
|
+
__exportStar(require("./scan"), exports);
|
|
94
99
|
__exportStar(require("./select"), exports);
|
|
95
100
|
__exportStar(require("./set_bit"), exports);
|
|
101
|
+
__exportStar(require("./set_dataset"), exports);
|
|
96
102
|
__exportStar(require("./set_handler"), exports);
|
|
97
103
|
__exportStar(require("./set_locale"), exports);
|
|
98
104
|
__exportStar(require("./set_parameter"), exports);
|
|
99
105
|
__exportStar(require("./shift"), exports);
|
|
106
|
+
__exportStar(require("./sort_dataset"), exports);
|
|
100
107
|
__exportStar(require("./sort"), exports);
|
|
101
108
|
__exportStar(require("./split"), exports);
|
|
102
109
|
__exportStar(require("./start_of_selection"), exports);
|
|
103
110
|
__exportStar(require("./submit"), exports);
|
|
104
111
|
__exportStar(require("./subtract"), exports);
|
|
105
112
|
__exportStar(require("./translate"), exports);
|
|
113
|
+
__exportStar(require("./truncate_dataset"), exports);
|
|
106
114
|
__exportStar(require("./try"), exports);
|
|
107
115
|
__exportStar(require("./type"), exports);
|
|
108
116
|
__exportStar(require("./unassign"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as abaplint from "@abaplint/core";
|
|
2
|
+
import { IStatementTranspiler } from "./_statement_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class OpenDatasetTranspiler implements IStatementTranspiler {
|
|
6
|
+
transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenDatasetTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class OpenDatasetTranspiler {
|
|
6
|
+
transpile(_node, _traversal) {
|
|
7
|
+
return new chunk_1.Chunk(`throw new Error("OpenDataset, not supported, transpiler");`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.OpenDatasetTranspiler = OpenDatasetTranspiler;
|
|
11
|
+
//# sourceMappingURL=open_dataset.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as abaplint from "@abaplint/core";
|
|
2
|
+
import { IStatementTranspiler } from "./_statement_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class ReadDatasetTranspiler implements IStatementTranspiler {
|
|
6
|
+
transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReadDatasetTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class ReadDatasetTranspiler {
|
|
6
|
+
transpile(_node, _traversal) {
|
|
7
|
+
return new chunk_1.Chunk(`throw new Error("ReadDataset, not supported, transpiler");`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ReadDatasetTranspiler = ReadDatasetTranspiler;
|
|
11
|
+
//# sourceMappingURL=read_dataset.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as abaplint from "@abaplint/core";
|
|
2
|
+
import { IStatementTranspiler } from "./_statement_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class SetDatasetTranspiler implements IStatementTranspiler {
|
|
6
|
+
transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetDatasetTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class SetDatasetTranspiler {
|
|
6
|
+
transpile(_node, _traversal) {
|
|
7
|
+
return new chunk_1.Chunk(`throw new Error("SetDataset, not supported, transpiler");`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.SetDatasetTranspiler = SetDatasetTranspiler;
|
|
11
|
+
//# sourceMappingURL=set_dataset.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as abaplint from "@abaplint/core";
|
|
2
|
+
import { IStatementTranspiler } from "./_statement_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class SortDatasetTranspiler implements IStatementTranspiler {
|
|
6
|
+
transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SortDatasetTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class SortDatasetTranspiler {
|
|
6
|
+
transpile(_node, _traversal) {
|
|
7
|
+
return new chunk_1.Chunk(`throw new Error("SortDataset, not supported, transpiler");`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.SortDatasetTranspiler = SortDatasetTranspiler;
|
|
11
|
+
//# sourceMappingURL=sort_dataset.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as abaplint from "@abaplint/core";
|
|
2
|
+
import { IStatementTranspiler } from "./_statement_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class TruncateDatasetTranspiler implements IStatementTranspiler {
|
|
6
|
+
transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TruncateDatasetTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class TruncateDatasetTranspiler {
|
|
6
|
+
transpile(_node, _traversal) {
|
|
7
|
+
return new chunk_1.Chunk(`throw new Error("TruncateDataset, not supported, transpiler");`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.TruncateDatasetTranspiler = TruncateDatasetTranspiler;
|
|
11
|
+
//# sourceMappingURL=truncate_dataset.js.map
|
package/build/src/traversal.js
CHANGED
|
@@ -220,9 +220,11 @@ class Traversal {
|
|
|
220
220
|
return undefined;
|
|
221
221
|
}
|
|
222
222
|
// local classes
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
if (ref.getFilename() === this.getFilename()) {
|
|
224
|
+
const scope = this.findCurrentScopeByToken(ref.getToken());
|
|
225
|
+
if ((scope === null || scope === void 0 ? void 0 : scope.getIdentifier().stype) === abaplint.ScopeType.Interface) {
|
|
226
|
+
return scope === null || scope === void 0 ? void 0 : scope.getIdentifier().sname;
|
|
227
|
+
}
|
|
226
228
|
}
|
|
227
229
|
// global classes
|
|
228
230
|
const file = this.reg.getFileByName(ref.getFilename());
|
package/build/src/unit_test.js
CHANGED
|
@@ -6,11 +6,11 @@ const abaplint = require("@abaplint/core");
|
|
|
6
6
|
class UnitTest {
|
|
7
7
|
// todo, move this method somewhere else, its much more than just unit test relevant
|
|
8
8
|
initializationScript(reg, dbSetup, extraSetup) {
|
|
9
|
-
let ret = `/* eslint-disable import/newline-after-import */
|
|
10
|
-
import runtime from "@abaplint/runtime";
|
|
11
|
-
globalThis.abap = new runtime.ABAP();
|
|
12
|
-
${this.buildImports(reg)}
|
|
13
|
-
|
|
9
|
+
let ret = `/* eslint-disable import/newline-after-import */
|
|
10
|
+
import runtime from "@abaplint/runtime";
|
|
11
|
+
globalThis.abap = new runtime.ABAP();
|
|
12
|
+
${this.buildImports(reg)}
|
|
13
|
+
|
|
14
14
|
export async function initializeABAP() {\n`;
|
|
15
15
|
ret += ` const sqlite = \`${dbSetup.schemas.sqlite}\`;\n`;
|
|
16
16
|
ret += ` const hdb = \`${dbSetup.schemas.hdb}\`;\n`;
|
|
@@ -32,19 +32,19 @@ export async function initializeABAP() {\n`;
|
|
|
32
32
|
return filename.replace(/\//g, "%23");
|
|
33
33
|
}
|
|
34
34
|
unitTestScriptOpen(reg, _skip, _only) {
|
|
35
|
-
let ret = `/* eslint-disable curly */
|
|
36
|
-
import fs from "fs";
|
|
37
|
-
import path from "path";
|
|
38
|
-
import {fileURLToPath} from "url";
|
|
39
|
-
import {initializeABAP} from "./init.mjs";
|
|
40
|
-
|
|
41
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
42
|
-
|
|
43
|
-
async function run() {
|
|
44
|
-
await initializeABAP();
|
|
45
|
-
let lt_input = new abap.types.Table(new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30})}), {"withHeader":false,"type":"STANDARD","isUnique":false,"keyFields":[]});
|
|
46
|
-
let ls_input = new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30})});
|
|
47
|
-
let ls_result = new abap.types.Structure({list: new abap.types.Table(new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30}), expected: new abap.types.String(), actual: new abap.types.String(), status: new abap.types.String(), runtime: new abap.types.Integer(), message: new abap.types.String(), js_location: new abap.types.String()}), {"withHeader":false,"type":"STANDARD","isUnique":false,"keyFields":[]}), json: new abap.types.String()});
|
|
35
|
+
let ret = `/* eslint-disable curly */
|
|
36
|
+
import fs from "fs";
|
|
37
|
+
import path from "path";
|
|
38
|
+
import {fileURLToPath} from "url";
|
|
39
|
+
import {initializeABAP} from "./init.mjs";
|
|
40
|
+
|
|
41
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
42
|
+
|
|
43
|
+
async function run() {
|
|
44
|
+
await initializeABAP();
|
|
45
|
+
let lt_input = new abap.types.Table(new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30})}), {"withHeader":false,"type":"STANDARD","isUnique":false,"keyFields":[]});
|
|
46
|
+
let ls_input = new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30})});
|
|
47
|
+
let ls_result = new abap.types.Structure({list: new abap.types.Table(new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30}), expected: new abap.types.String(), actual: new abap.types.String(), status: new abap.types.String(), runtime: new abap.types.Integer(), message: new abap.types.String(), js_location: new abap.types.String()}), {"withHeader":false,"type":"STANDARD","isUnique":false,"keyFields":[]}), json: new abap.types.String()});
|
|
48
48
|
`;
|
|
49
49
|
for (const obj of reg.getObjects()) {
|
|
50
50
|
if (reg.isDependency(obj) || !(obj instanceof abaplint.Objects.Class)) {
|
|
@@ -64,44 +64,44 @@ async function run() {
|
|
|
64
64
|
if (m.isForTesting === false) {
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
|
-
ret += ` ls_input.get().class_name.set("${obj.getName()}");
|
|
68
|
-
ls_input.get().testclass_name.set("${def.name.toUpperCase()}");
|
|
69
|
-
ls_input.get().method_name.set("${m.name.toUpperCase()}");
|
|
67
|
+
ret += ` ls_input.get().class_name.set("${obj.getName()}");
|
|
68
|
+
ls_input.get().testclass_name.set("${def.name.toUpperCase()}");
|
|
69
|
+
ls_input.get().method_name.set("${m.name.toUpperCase()}");
|
|
70
70
|
abap.statements.append({source: ls_input, target: lt_input});`;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
ret += `
|
|
76
|
-
|
|
77
|
-
ls_result.set(await abap.Classes["KERNEL_UNIT_RUNNER"].run({it_input: lt_input}));
|
|
78
|
-
fs.writeFileSync(__dirname + path.sep + "output.json", ls_result.get().json.get());
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
run().then(() => {
|
|
82
|
-
process.exit(0);
|
|
83
|
-
}).catch((err) => {
|
|
84
|
-
console.log(err);
|
|
85
|
-
process.exit(1);
|
|
75
|
+
ret += `
|
|
76
|
+
|
|
77
|
+
ls_result.set(await abap.Classes["KERNEL_UNIT_RUNNER"].run({it_input: lt_input}));
|
|
78
|
+
fs.writeFileSync(__dirname + path.sep + "output.json", ls_result.get().json.get());
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
run().then(() => {
|
|
82
|
+
process.exit(0);
|
|
83
|
+
}).catch((err) => {
|
|
84
|
+
console.log(err);
|
|
85
|
+
process.exit(1);
|
|
86
86
|
});`;
|
|
87
87
|
return ret;
|
|
88
88
|
}
|
|
89
89
|
unitTestScript(reg, skip, _only) {
|
|
90
|
-
let ret = `/* eslint-disable curly */
|
|
91
|
-
import fs from "fs";
|
|
92
|
-
import path from "path";
|
|
93
|
-
import {fileURLToPath} from "url";
|
|
94
|
-
import {initializeABAP} from "./init.mjs";
|
|
95
|
-
import runtime from "@abaplint/runtime";
|
|
96
|
-
|
|
97
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
98
|
-
|
|
99
|
-
async function run() {
|
|
100
|
-
await initializeABAP();
|
|
101
|
-
const unit = new runtime.UnitTestResult();
|
|
102
|
-
let clas;
|
|
103
|
-
let locl;
|
|
104
|
-
let meth;
|
|
90
|
+
let ret = `/* eslint-disable curly */
|
|
91
|
+
import fs from "fs";
|
|
92
|
+
import path from "path";
|
|
93
|
+
import {fileURLToPath} from "url";
|
|
94
|
+
import {initializeABAP} from "./init.mjs";
|
|
95
|
+
import runtime from "@abaplint/runtime";
|
|
96
|
+
|
|
97
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
98
|
+
|
|
99
|
+
async function run() {
|
|
100
|
+
await initializeABAP();
|
|
101
|
+
const unit = new runtime.UnitTestResult();
|
|
102
|
+
let clas;
|
|
103
|
+
let locl;
|
|
104
|
+
let meth;
|
|
105
105
|
try {\n`;
|
|
106
106
|
for (const obj of reg.getObjects()) {
|
|
107
107
|
if (reg.isDependency(obj) || !(obj instanceof abaplint.Objects.Class)) {
|
|
@@ -115,9 +115,9 @@ async function run() {
|
|
|
115
115
|
// todo, fix, there might be global test methods
|
|
116
116
|
continue;
|
|
117
117
|
}
|
|
118
|
-
ret += ` {
|
|
119
|
-
const {${def.name}} = await import("./${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}.testclasses.mjs");
|
|
120
|
-
locl = clas.addTestClass("${def.name}");
|
|
118
|
+
ret += ` {
|
|
119
|
+
const {${def.name}} = await import("./${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}.testclasses.mjs");
|
|
120
|
+
locl = clas.addTestClass("${def.name}");
|
|
121
121
|
if (${def.name}.class_setup) await ${def.name}.class_setup();\n`;
|
|
122
122
|
for (const m of def.methods) {
|
|
123
123
|
if (m.isForTesting === false) {
|
|
@@ -144,24 +144,24 @@ async function run() {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
ret += `// -------------------END-------------------
|
|
148
|
-
console.log(abap.console.get());
|
|
149
|
-
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
150
|
-
} catch (e) {
|
|
151
|
-
if (meth) {
|
|
152
|
-
meth.fail();
|
|
153
|
-
}
|
|
154
|
-
console.log(abap.console.get());
|
|
155
|
-
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
156
|
-
throw e;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
run().then(() => {
|
|
161
|
-
process.exit(0);
|
|
162
|
-
}).catch((err) => {
|
|
163
|
-
console.log(err);
|
|
164
|
-
process.exit(1);
|
|
147
|
+
ret += `// -------------------END-------------------
|
|
148
|
+
console.log(abap.console.get());
|
|
149
|
+
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
150
|
+
} catch (e) {
|
|
151
|
+
if (meth) {
|
|
152
|
+
meth.fail();
|
|
153
|
+
}
|
|
154
|
+
console.log(abap.console.get());
|
|
155
|
+
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
156
|
+
throw e;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
run().then(() => {
|
|
161
|
+
process.exit(0);
|
|
162
|
+
}).catch((err) => {
|
|
163
|
+
console.log(err);
|
|
164
|
+
process.exit(1);
|
|
165
165
|
});`;
|
|
166
166
|
return ret;
|
|
167
167
|
}
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Transpiler",
|
|
5
|
-
"main": "build/src/index.js",
|
|
6
|
-
"typings": "build/src/index.d.ts",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"compile": "tsc",
|
|
13
|
-
"publish:major": "npm --no-git-tag-version version major && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
-
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
-
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
16
|
-
"test": "npm run compile && mocha"
|
|
17
|
-
},
|
|
18
|
-
"mocha": {
|
|
19
|
-
"recursive": true,
|
|
20
|
-
"reporter": "progress",
|
|
21
|
-
"spec": "build/test/**/*.js",
|
|
22
|
-
"require": "source-map-support/register"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"ABAP",
|
|
26
|
-
"abaplint"
|
|
27
|
-
],
|
|
28
|
-
"author": "abaplint",
|
|
29
|
-
"license": "MIT",
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@abaplint/core": "^2.91.
|
|
32
|
-
"source-map": "^0.7.4"
|
|
33
|
-
},
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"@types/chai": "^4.3.1",
|
|
36
|
-
"@types/mocha": "^9.1.1",
|
|
37
|
-
"chai": "^4.3.6",
|
|
38
|
-
"mocha": "^10.0.0",
|
|
39
|
-
"source-map-support": "^0.5.21",
|
|
40
|
-
"typescript": "^4.7.
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@abaplint/transpiler",
|
|
3
|
+
"version": "2.0.45",
|
|
4
|
+
"description": "Transpiler",
|
|
5
|
+
"main": "build/src/index.js",
|
|
6
|
+
"typings": "build/src/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"compile": "tsc",
|
|
13
|
+
"publish:major": "npm --no-git-tag-version version major && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
+
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
+
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
16
|
+
"test": "npm run compile && mocha"
|
|
17
|
+
},
|
|
18
|
+
"mocha": {
|
|
19
|
+
"recursive": true,
|
|
20
|
+
"reporter": "progress",
|
|
21
|
+
"spec": "build/test/**/*.js",
|
|
22
|
+
"require": "source-map-support/register"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"ABAP",
|
|
26
|
+
"abaplint"
|
|
27
|
+
],
|
|
28
|
+
"author": "abaplint",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@abaplint/core": "^2.91.4",
|
|
32
|
+
"source-map": "^0.7.4"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/chai": "^4.3.1",
|
|
36
|
+
"@types/mocha": "^9.1.1",
|
|
37
|
+
"chai": "^4.3.6",
|
|
38
|
+
"mocha": "^10.0.0",
|
|
39
|
+
"source-map-support": "^0.5.21",
|
|
40
|
+
"typescript": "^4.7.4"
|
|
41
|
+
}
|
|
42
|
+
}
|