Remove unnecessary global counting
This commit is contained in:
parent
eddb3f0668
commit
b81ab44a8f
1 changed files with 5 additions and 11 deletions
|
|
@ -8,14 +8,11 @@ let list = WebAssembly.Module.exports(m);
|
|||
console.log('exports', list);
|
||||
|
||||
const my_exports = {};
|
||||
let nexports_fn = 0;
|
||||
let nexports_global = 0;
|
||||
let nexports = 0;
|
||||
|
||||
for (const entry of list) {
|
||||
if (entry.kind == 'function'){
|
||||
nexports_fn += 1;
|
||||
}
|
||||
if (entry.kind == 'global'){
|
||||
nexports_global += 1;
|
||||
nexports += 1;
|
||||
}
|
||||
my_exports[entry.name] = true;
|
||||
}
|
||||
|
|
@ -27,12 +24,9 @@ if (my_exports.FOO === undefined)
|
|||
throw new Error("`FOO` wasn't defined");
|
||||
|
||||
if (my_exports.main === undefined) {
|
||||
if (nexports_fn != 1)
|
||||
if (nexports != 1)
|
||||
throw new Error("should only have one function export");
|
||||
} else {
|
||||
if (nexports_fn != 2)
|
||||
if (nexports != 2)
|
||||
throw new Error("should only have two function exports");
|
||||
}
|
||||
|
||||
if (nexports_global != 1)
|
||||
throw new Error("should only have one static export");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue