diff --git a/src/glue/binaryen.d.ts b/src/glue/binaryen.d.ts index 153169a97f..be422e9759 100644 --- a/src/glue/binaryen.d.ts +++ b/src/glue/binaryen.d.ts @@ -82,6 +82,16 @@ export declare function _BinaryenHeapTypeNofunc(): HeapTypeRef; export declare function _BinaryenHeapTypeIsBottom(heapType: HeapTypeRef): bool; export declare function _BinaryenHeapTypeGetBottom(heapType: HeapTypeRef): HeapTypeRef; +export declare function _BinaryenHeapTypeIsSubType(left: HeapTypeRef, right: HeapTypeRef): bool; +export declare function _BinaryenStructTypeGetNumFields(heapType: HeapTypeRef): Index; +export declare function _BinaryenStructTypeGetFieldType(heapType: HeapTypeRef, index: Index): TypeRef; +export declare function _BinaryenStructTypeGetFieldPackedType(heapType: HeapTypeRef, index: Index): PackedType; +export declare function _BinaryenStructTypeIsFieldMutable(heapType: HeapTypeRef, index: Index): bool; +export declare function _BinaryenArrayTypeGetElementType(heapType: HeapTypeRef): TypeRef; +export declare function _BinaryenArrayTypeGetElementPackedType(heapType: HeapTypeRef): PackedType; +export declare function _BinaryenArrayTypeIsElementMutable(heapType: HeapTypeRef): bool; +export declare function _BinaryenSignatureTypeGetParams(heapType: HeapTypeRef): TypeRef; +export declare function _BinaryenSignatureTypeGetResults(heapType: HeapTypeRef): TypeRef; export declare function _BinaryenModuleCreate(): ModuleRef; export declare function _BinaryenModuleDispose(module: ModuleRef): void; diff --git a/src/glue/binaryen.js b/src/glue/binaryen.js index 76a98a75b7..cb3e4d3013 100644 --- a/src/glue/binaryen.js +++ b/src/glue/binaryen.js @@ -45,6 +45,16 @@ export const { _BinaryenHeapTypeIsBottom, _BinaryenHeapTypeGetBottom, + _BinaryenHeapTypeIsSubType, + _BinaryenStructTypeGetNumFields, + _BinaryenStructTypeGetFieldType, + _BinaryenStructTypeGetFieldPackedType, + _BinaryenStructTypeIsFieldMutable, + _BinaryenArrayTypeGetElementType, + _BinaryenArrayTypeGetElementPackedType, + _BinaryenArrayTypeIsElementMutable, + _BinaryenSignatureTypeGetParams, + _BinaryenSignatureTypeGetResults, _BinaryenModuleCreate, _BinaryenModuleDispose, diff --git a/src/module.ts b/src/module.ts index a7c88871b6..f74fcf9c59 100644 --- a/src/module.ts +++ b/src/module.ts @@ -124,6 +124,10 @@ export namespace HeapTypeRef { export function getBottom(ht: HeapTypeRef): HeapTypeRef { return binaryen._BinaryenHeapTypeGetBottom(ht); } + + export function isSubtype(ht: HeapTypeRef, superHt: HeapTypeRef): bool { + return binaryen._BinaryenHeapTypeIsSubType(ht, superHt); + } } /** Packed array element respectively struct field types. */