Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare for Binaryen compiled to Wasm (#1029)
- Loading branch information
Showing
13 changed files
with
553 additions
and
492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Updates the Binaryen constants in src/module.ts | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
const binaryen = require("binaryen"); | ||
|
||
const srcfile = path.join(__dirname, "..", "src", "module.ts"); | ||
var src = fs.readFileSync(srcfile, "utf8"); | ||
|
||
binaryen.ready.then(() => { | ||
src = src.replace(/enum (\w+) \{([^}]*)\}/g, function($0) { | ||
return $0.replace(/(\w+)[ ]+=[ ]+([^,;\n]+)/g, function($0, key, val) { | ||
var match = val.match(/\b(_Binaryen\w+)\b/); | ||
if (match) { | ||
let fn = match[1]; | ||
let id = binaryen[fn](); | ||
console.log(fn + " = " + id); | ||
return key + " = " + id + " /* " + fn + " */"; | ||
} | ||
return $0; | ||
}); | ||
}); | ||
fs.writeFileSync(srcfile, src, "utf8"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.