rtti & refactoring

This commit is contained in:
dcode
2019-04-06 20:17:48 +02:00
parent a9e4813798
commit e1070cee86
266 changed files with 23295 additions and 33925 deletions

View File

@ -1,7 +1,5 @@
import { dirent, rwevent, fdstat, filestat, iovec, clocksubscription, fdsubscription, signal, dirprestat } from "bindings/wasi";
const WASM32 = 1;
const WASM64 = 2;
import { Target } from "common/target";
assert(offsetof<dirent>("next") == 0);
assert(offsetof<dirent>("ino") == 8);
@ -33,10 +31,10 @@ assert(offsetof<filestat>("ctim") == 48);
assert(offsetof<filestat>() == 56);
assert(offsetof<iovec>("buf") == 0);
if (ASC_TARGET == WASM32) {
if (ASC_TARGET == Target.WASM32) {
assert(offsetof<iovec>("buf_len") == 4);
assert(offsetof<iovec>() == 8);
} else if (ASC_TARGET == WASM64) {
} else if (ASC_TARGET == Target.WASM64) {
assert(offsetof<iovec>("buf_len") == 8);
assert(offsetof<iovec>() == 16);
} else {
@ -58,10 +56,10 @@ assert(offsetof<fdsubscription>("fd") == 16);
assert(offsetof<fdsubscription>() == 20);
assert(offsetof<dirprestat>("type") == 0);
if (ASC_TARGET == WASM32) {
if (ASC_TARGET == Target.WASM32) {
assert(offsetof<dirprestat>("name_len") == 4);
assert(offsetof<dirprestat>() == 8);
} else if (ASC_TARGET == WASM64) {
} else if (ASC_TARGET == Target.WASM64) {
assert(offsetof<dirprestat>("name_len") == 8);
assert(offsetof<dirprestat>() == 16);
} else {