@abaplint/transpiler 1.6.41 → 1.6.42
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/src/statements/do.js +4 -4
- package/build/src/unit_test.js +38 -38
- package/package.json +41 -41
|
@@ -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
|
}
|
package/build/src/unit_test.js
CHANGED
|
@@ -4,24 +4,24 @@ exports.UnitTest = void 0;
|
|
|
4
4
|
const abaplint = require("@abaplint/core");
|
|
5
5
|
class UnitTest {
|
|
6
6
|
run(reg, dbSetup, skip) {
|
|
7
|
-
let ret = `import fs from "fs";
|
|
8
|
-
import path from "path";
|
|
9
|
-
import runtime from "@abaplint/runtime";
|
|
10
|
-
import {dirname} from 'path';
|
|
11
|
-
import {fileURLToPath} from 'url';
|
|
12
|
-
global.abap = new runtime.ABAP();
|
|
13
|
-
${this.buildImports(reg)}
|
|
14
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
-
async function initDB() {
|
|
16
|
-
return global.abap.initDB(\`${dbSetup}\`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function run() {
|
|
20
|
-
await initDB();
|
|
21
|
-
const unit = new runtime.UnitTestResult();
|
|
22
|
-
let clas;
|
|
23
|
-
let locl;
|
|
24
|
-
let meth;
|
|
7
|
+
let ret = `import fs from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
import runtime from "@abaplint/runtime";
|
|
10
|
+
import {dirname} from 'path';
|
|
11
|
+
import {fileURLToPath} from 'url';
|
|
12
|
+
global.abap = new runtime.ABAP();
|
|
13
|
+
${this.buildImports(reg)}
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
async function initDB() {
|
|
16
|
+
return global.abap.initDB(\`${dbSetup}\`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function run() {
|
|
20
|
+
await initDB();
|
|
21
|
+
const unit = new runtime.UnitTestResult();
|
|
22
|
+
let clas;
|
|
23
|
+
let locl;
|
|
24
|
+
let meth;
|
|
25
25
|
try {\n`;
|
|
26
26
|
for (const obj of reg.getObjects()) {
|
|
27
27
|
if (reg.isDependency(obj) || !(obj instanceof abaplint.Objects.Class)) {
|
|
@@ -36,8 +36,8 @@ try {\n`;
|
|
|
36
36
|
|| def.methods.length === 0) {
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
|
-
ret += `{
|
|
40
|
-
const {${def.name}} = await import("./${obj.getName().toLowerCase()}.${obj.getType().toLowerCase()}.testclasses.mjs");
|
|
39
|
+
ret += `{
|
|
40
|
+
const {${def.name}} = await import("./${obj.getName().toLowerCase()}.${obj.getType().toLowerCase()}.testclasses.mjs");
|
|
41
41
|
locl = clas.addTestClass("${def.name}");\n`;
|
|
42
42
|
ret += `if (${def.name}.class_setup) await ${def.name}.class_setup();\n`;
|
|
43
43
|
for (const m of def.methods) {
|
|
@@ -65,24 +65,24 @@ locl = clas.addTestClass("${def.name}");\n`;
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
ret += `// -------------------END-------------------
|
|
69
|
-
console.log(abap.console.get());
|
|
70
|
-
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
71
|
-
} catch (e) {
|
|
72
|
-
if (meth) {
|
|
73
|
-
meth.fail();
|
|
74
|
-
}
|
|
75
|
-
console.log(abap.console.get());
|
|
76
|
-
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
77
|
-
throw e;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
run().then(() => {
|
|
82
|
-
process.exit();
|
|
83
|
-
}).catch((err) => {
|
|
84
|
-
console.log(err);
|
|
85
|
-
process.exit(1);
|
|
68
|
+
ret += `// -------------------END-------------------
|
|
69
|
+
console.log(abap.console.get());
|
|
70
|
+
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
71
|
+
} catch (e) {
|
|
72
|
+
if (meth) {
|
|
73
|
+
meth.fail();
|
|
74
|
+
}
|
|
75
|
+
console.log(abap.console.get());
|
|
76
|
+
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
77
|
+
throw e;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
run().then(() => {
|
|
82
|
+
process.exit();
|
|
83
|
+
}).catch((err) => {
|
|
84
|
+
console.log(err);
|
|
85
|
+
process.exit(1);
|
|
86
86
|
});`;
|
|
87
87
|
return ret;
|
|
88
88
|
}
|
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "1.6.
|
|
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
|
-
"prepublishOnly": "rm -rf build && npm run test",
|
|
14
|
-
"pretest": "npm run compile",
|
|
15
|
-
"test": "mocha"
|
|
16
|
-
},
|
|
17
|
-
"mocha": {
|
|
18
|
-
"recursive": true,
|
|
19
|
-
"reporter": "progress",
|
|
20
|
-
"spec": "build/test/**/*.js",
|
|
21
|
-
"require": "source-map-support/register"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"ABAP",
|
|
25
|
-
"abaplint"
|
|
26
|
-
],
|
|
27
|
-
"author": "abaplint",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@abaplint/core": "^2.79.27",
|
|
31
|
-
"source-map": "^0.7.3"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/chai": "^4.2.22",
|
|
35
|
-
"@types/mocha": "^9.0.0",
|
|
36
|
-
"chai": "^4.3.4",
|
|
37
|
-
"mocha": "^9.1.2",
|
|
38
|
-
"source-map-support": "^0.5.20",
|
|
39
|
-
"typescript": "^4.4.3"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@abaplint/transpiler",
|
|
3
|
+
"version": "1.6.42",
|
|
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
|
+
"prepublishOnly": "rm -rf build && npm run test",
|
|
14
|
+
"pretest": "npm run compile",
|
|
15
|
+
"test": "mocha"
|
|
16
|
+
},
|
|
17
|
+
"mocha": {
|
|
18
|
+
"recursive": true,
|
|
19
|
+
"reporter": "progress",
|
|
20
|
+
"spec": "build/test/**/*.js",
|
|
21
|
+
"require": "source-map-support/register"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"ABAP",
|
|
25
|
+
"abaplint"
|
|
26
|
+
],
|
|
27
|
+
"author": "abaplint",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@abaplint/core": "^2.79.27",
|
|
31
|
+
"source-map": "^0.7.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/chai": "^4.2.22",
|
|
35
|
+
"@types/mocha": "^9.0.0",
|
|
36
|
+
"chai": "^4.3.4",
|
|
37
|
+
"mocha": "^9.1.2",
|
|
38
|
+
"source-map-support": "^0.5.20",
|
|
39
|
+
"typescript": "^4.4.3"
|
|
40
|
+
}
|
|
41
|
+
}
|