Remove unnecessary global counting

This commit is contained in:
maik 2020-01-08 09:53:33 +01:00
parent eddb3f0668
commit b81ab44a8f

View file

@ -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");