Skip to content

Commit a837a84

Browse files
committed
wip: some cleanup
1 parent 828f94d commit a837a84

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
dist
22
node_modules
3+
.idea

src/compiler.ts

+5-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var CompilerModule = require('./wasmlib/funcfiftlib.js');
1+
const CompilerModule = require('./wasmlib/funcfiftlib.js');
22

33
/*
44
* CompilerConfig example:
@@ -17,21 +17,6 @@ export type CompilerConfig = {
1717
optLevel: number
1818
};
1919

20-
/*
21-
* CompileResult example:
22-
* If success
23-
* {
24-
* status: 'ok',
25-
* codeBoc: <serialized code cell into BOC with base64 encoding>,
26-
* fiftCode: <fift code from func compiler>
27-
* }
28-
* If failure
29-
* {
30-
* status: 'error',
31-
* message: <the message with reason of failure>
32-
* }
33-
*
34-
*/
3520
export type SuccessResult = {
3621
status: "ok",
3722
codeBoc: string,
@@ -64,27 +49,23 @@ export async function compilerVersion(): Promise<CompilerVersion> {
6449
}
6550

6651
export async function funcCompile(compileConfig: CompilerConfig): Promise<CompileResult> {
67-
6852
let mod = await CompilerModule();
6953

7054
let sourcesArr: string[] = [];
7155

7256
mod.FS.mkdir("/contracts");
7357

74-
(Object.keys(compileConfig.sources)).forEach((fileName) => {
58+
for (let fileName in compileConfig.sources) {
59+
let source = compileConfig.sources[fileName]
7560
sourcesArr.push(`/contracts/${fileName}`);
76-
let code: string = compileConfig.sources[fileName] as any;
77-
mod.FS.writeFile(`/contracts/${fileName}`, code);
78-
});
61+
mod.FS.writeFile(`/contracts/${fileName}`, source);
62+
}
7963

8064
let configJson = JSON.stringify({
8165
sources: sourcesArr,
8266
optLevel: compileConfig.optLevel
8367
});
8468

85-
86-
console.log(configJson);
87-
8869
let configJsonPTR = mod._malloc(configJson.length + 1);
8970
mod.stringToUTF8(configJson, configJsonPTR, configJson.length + 1);
9071

0 commit comments

Comments
 (0)