UNPKG

assemblyscript

Version:

A TypeScript-like language for WebAssembly.

791 lines 498 kB
/// <reference path="./assemblyscript.generated.d.ts" /> declare module "types:assemblyscript/util/options" { /** * @fileoverview Command line options utility definitions. * @license Apache-2.0 */ /** A set of options. */ export interface OptionSet { [key: string]: number | string; } /** Command line option description. */ export interface OptionDescription { /** Textual description. */ description?: string | string[]; /** Data type. One of (b)oolean [default], (i)nteger, (f)loat or (s)tring. Uppercase means multiple values. */ type?: "b" | "i" | "f" | "s" | "I" | "F" | "S"; /** Substituted options, if any. */ value?: OptionSet; /** Short alias, if any. */ alias?: string; /** The default value, if any. */ default?: string | number | boolean | string[] | number[]; /** The category this option belongs in. */ category?: string; } /** Configuration object. */ export interface Config { [key: string]: OptionDescription; } /** Parsing result. */ export interface Result { /** Parsed options. */ options: OptionSet; /** Unknown options. */ unknown: string[]; /** Normal arguments. */ arguments: string[]; /** Trailing arguments. */ trailing: string[]; } /** Parses the specified command line arguments according to the given configuration. */ export function parse(argv: string[], config: Config, propagateDefaults?: boolean): Result; /** Help formatting options. */ export interface HelpOptions { /** Leading indent. Defaults to 2. */ indent?: number; /** Table padding. Defaults to 24. */ padding?: number; /** End of line character. Defaults to "\n". */ eol?: string; } /** Generates the help text for the specified configuration. */ export function help(config: Config, options?: HelpOptions): string; /** Merges two sets of options into one, preferring the current over the parent set. */ export function merge(config: Config, currentOptions: OptionSet, parentOptions: OptionSet, parentBaseDir: string): OptionSet; /** Normalizes a path. */ export function normalizePath(path: string): string; /** Resolves a single relative path. Keeps absolute paths, otherwise prepends baseDir. */ export function resolvePath(path: string, baseDir: string, useNodeResolution?: boolean): string; /** Populates default values on a parsed options result. */ export function addDefaults(config: Config, options: OptionSet): void; } declare module "types:assemblyscript/lib/binaryen" { export * from "binaryen"; export { default } from "binaryen"; } /** * Environment definitions for compiling AssemblyScript to JavaScript using tsc. * * Note that semantic differences require additional explicit conversions for full compatibility. * For example, when casting an i32 to an u8, doing `<u8>(someI32 & 0xff)` will yield the same * result when compiling to WebAssembly or JS while `<u8>someI32` alone does nothing in JS. * * Note that i64's are not portable (JS numbers are IEEE754 doubles with a maximum safe integer * value of 2^53-1) and instead require a compatibility layer to work in JS as well, as for example * {@link glue/js/i64} respectively {@link glue/wasm/i64}. * * @module std/portable */ /***/ // Types declare type bool = boolean; declare type i8 = number; declare type i16 = number; declare type i32 = number; declare type isize = number; declare type u8 = number; declare type u16 = number; declare type u32 = number; declare type usize = number; declare type f32 = number; declare type f64 = number; /** Special type evaluating the indexed access index type. */ declare type indexof<T extends unknown[]> = keyof T; /** Special type evaluating the indexed access value type. */ declare type valueof<T extends unknown[]> = T[0]; // Compiler hints /** Compiler target. 0 = JS, 1 = WASM32, 2 = WASM64. */ declare const ASC_TARGET: number; /** Runtime type. 0 = Stub, 1 = Minimal, 2 = Incremental. */ declare const ASC_RUNTIME: number; /** Provided noAssert option. */ declare const ASC_NO_ASSERT: boolean; /** Provided memoryBase option. */ declare const ASC_MEMORY_BASE: number; /** Provided optimizeLevel option. */ declare const ASC_OPTIMIZE_LEVEL: number; /** Provided shrinkLevel option. */ declare const ASC_SHRINK_LEVEL: number; /** Whether the mutable global feature is enabled. */ declare const ASC_FEATURE_MUTABLE_GLOBAL: boolean; /** Whether the sign extension feature is enabled. */ declare const ASC_FEATURE_SIGN_EXTENSION: boolean; // Builtins /** Performs the sign-agnostic reverse bytes **/ declare function bswap<T = number | number | number | number>(value: T): T; /** Performs the sign-agnostic count leading zero bits operation on a 32-bit integer. All zero bits are considered leading if the value is zero. */ declare function clz<T = number>(value: T): T; /** Performs the sign-agnostic count tailing zero bits operation on a 32-bit integer. All zero bits are considered trailing if the value is zero. */ declare function ctz<T = number>(value: T): T; /** Performs the sign-agnostic count number of one bits operation on a 32-bit integer. */ declare function popcnt<T = number>(value: T): T; /** Performs the sign-agnostic rotate left operation on a 32-bit integer. */ declare function rotl<T = number>(value: T, shift: T): T; /** Performs the sign-agnostic rotate right operation on a 32-bit integer. */ declare function rotr<T = number>(value: T, shift: T): T; /** Computes the absolute value of an integer or float. */ declare function abs<T = number | number | number>(value: T): T; /** Determines the maximum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ declare function max<T = number | number | number>(left: T, right: T): T; /** Determines the minimum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ declare function min<T = number | number | number>(left: T, right: T): T; /** Composes a 32-bit or 64-bit float from the magnitude of `x` and the sign of `y`. */ declare function copysign<T = number | number>(x: T, y: T): T; /** Performs the ceiling operation on a 32-bit or 64-bit float. */ declare function ceil<T = number | number>(value: T): T; /** Performs the floor operation on a 32-bit or 64-bit float. */ declare function floor<T = number | number>(value: T): T; /** Rounds to the nearest integer tied to even of a 32-bit or 64-bit float. */ declare function nearest<T = number | number>(value: T): T; /** Selects one of two pre-evaluated values depending on the condition. */ declare function select<T>(ifTrue: T, ifFalse: T, condition: boolean): T; /** Calculates the square root of a 32-bit or 64-bit float. */ declare function sqrt<T = number | number>(value: T): T; /** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */ declare function trunc<T = number | number>(value: T): T; /** Emits an unreachable operation that results in a runtime error when executed. */ declare function unreachable(): any; // sic /** Changes the type of any value of `usize` kind to another one of `usize` kind. Useful for casting class instances to their pointer values and vice-versa. Beware that this is unsafe.*/ declare function changetype<T>(value: any): T; /** Explicitly requests no bounds checks on the provided expression. Useful for array accesses. */ declare function unchecked<T>(value: T): T; /** Tests if the specified value is a valid integer. Can't distinguish an integer from an integral float. */ declare function isInteger(value: any): value is number; /** Tests if the specified value is a valid float. Can't distinguish a float from an integer. */ declare function isFloat(value: any): value is number; /** Tests if the specified value is of a nullable reference type. */ declare function isNullable(value: any): boolean; /** Tests if the specified value is of a reference type. */ declare function isReference(value: any): value is object | string; /** Tests if the specified value is of a function type */ declare function isFunction(value: any): value is Function; /** Tests if the specified value can be used as a string. */ declare function isString(value: any): value is string | String; /** Tests if the specified value can be used as an array. */ declare function isArray(value: any): value is Array<any>; /** Tests if the specified type *or* expression can be used as an array like object. */ declare function isArrayLike(value: any): value is ArrayLike<any>; /** Tests if the specified expression resolves to a defined element. */ declare function isDefined(expression: any): boolean; /** Tests if the specified expression evaluates to a constant value. */ declare function isConstant(expression: any): boolean; /** Traps if the specified value is not true-ish, otherwise returns the value. */ declare function assert<T>(isTrueish: T, message?: string): T & (object | string | number); // any better way to model `: T != null`? /** Parses an integer string to a 64-bit float. */ declare function parseInt(str: string, radix?: number): number; /** Parses a floating point string to a 64-bit float. */ declare function parseFloat(str: string): number; /** Returns the 64-bit floating-point remainder of `x/y`. */ declare function fmod(x: number, y: number): number; /** Returns the 32-bit floating-point remainder of `x/y`. */ declare function fmodf(x: number, y: number): number; /** Converts any other numeric value to an 8-bit signed integer. */ declare function i8(value: any): number; declare namespace i8 { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Converts a string to a floating-point number and cast to target integer after. */ export function parseFloat(string: string): number; /** Parses a string as an integer. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an i8. */ export function parse(value: string, radix?: number): number; } /** Converts any other numeric value to a 16-bit signed integer. */ declare function i16(value: any): number; declare namespace i16 { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Converts a string to a floating-point number and cast to target integer after. */ export function parseFloat(string: string): number; /** Parses a string as an integer. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an i16. */ export function parse(value: string, radix?: number): number; } /** Converts any other numeric value to a 32-bit signed integer. */ declare function i32(value: any): number; declare namespace i32 { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Converts a string to a floating-point number and cast to target integer after. */ export function parseFloat(string: string): number; /** Parses a string as an integer. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an i32. */ export function parse(value: string, radix?: number): number; } /** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) signed integer. */ declare function isize(value: any): number; declare namespace isize { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Converts a string to a floating-point number and cast to target integer after. */ export function parseFloat(string: string): number; /** Parses a string as an integer. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an iszie. */ export function parse(value: string, radix?: number): number; } /** Converts any other numeric value to an 8-bit unsigned integer. */ declare function u8(value: any): number; declare namespace u8 { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Converts a string to a floating-point number and cast to target integer after. */ export function parseFloat(string: string): number; /** Parses a string as an integer. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an u8. */ export function parse(value: string, radix?: number): number; } /** Converts any other numeric value to a 16-bit unsigned integer. */ declare function u16(value: any): number; declare namespace u16 { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Converts a string to a floating-point number and cast to target integer after. */ export function parseFloat(string: string): number; /** Parses a string as an integer. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an u16. */ export function parse(value: string, radix?: number): number; } /** Converts any other numeric value to a 32-bit unsigned integer. */ declare function u32(value: any): number; declare namespace u32 { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Converts a string to a floating-point number and cast to target integer after. */ export function parseFloat(string: string): number; /** Parses a string as an integer. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an u32. */ export function parse(value: string, radix?: number): number; } /** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) unsigned integer. */ declare function usize(value: any): number; declare namespace usize { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Converts a string to a floating-point number and cast to target integer after. */ export function parseFloat(string: string): number; /** Parses a string as an integer. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an usize. */ export function parse(value: string, radix?: number): number; } /** Converts any other numeric value to a 1-bit unsigned integer. */ declare function bool(value: any): boolean; declare namespace bool { /** Smallest representable value. */ export const MIN_VALUE: boolean; /** Largest representable value. */ export const MAX_VALUE: boolean; /** Parses a string as a bool. */ export function parse(value: string): boolean; } /** Converts any other numeric value to a 32-bit float. */ declare function f32(value: any): number; declare namespace f32 { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Smallest normalized positive value. */ export const MIN_NORMAL_VALUE: number; /** Smallest safely representable integer value. */ export const MIN_SAFE_INTEGER: number; /** Largest safely representable integer value. */ export const MAX_SAFE_INTEGER: number; /** Positive infinity value. */ export const POSITIVE_INFINITY: number; /** Negative infinity value. */ export const NEGATIVE_INFINITY: number; /** Not a number value. */ /* eslint no-shadow-restricted-names: "off" */ export const NaN: number; /** Difference between 1 and the smallest representable value greater than 1. */ export const EPSILON: number; /** Returns a boolean value that indicates whether a value is the reserved value NaN (not a number). */ export function isNaN(value: number): boolean; /** Returns true if passed value is finite. */ export function isFinite(value: number): boolean; /** Returns true if the value passed is a safe integer. */ export function isSafeInteger(value: number): boolean; /** Returns true if the value passed is an integer, false otherwise. */ export function isInteger(value: number): boolean; /** Converts a string to a floating-point number. */ export function parseFloat(string: string): number; /** Parses a string as an integer and convert to an f32. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an f32. */ export function parse(value: string): number; } /** Converts any other numeric value to a 64-bit float. */ declare function f64(value: any): number; declare namespace f64 { /** Smallest representable value. */ export const MIN_VALUE: number; /** Largest representable value. */ export const MAX_VALUE: number; /** Smallest normalized positive value. */ export const MIN_NORMAL_VALUE: number; /** Smallest safely representable integer value. */ export const MIN_SAFE_INTEGER: number; /** Largest safely representable integer value. */ export const MAX_SAFE_INTEGER: number; /** Positive infinity value. */ export const POSITIVE_INFINITY: number; /** Negative infinity value. */ export const NEGATIVE_INFINITY: number; /** Not a number value. */ /* eslint no-shadow-restricted-names: "off" */ export const NaN: number; /** Difference between 1 and the smallest representable value greater than 1. */ export const EPSILON: number; /** Returns a boolean value that indicates whether a value is the reserved value NaN (not a number). */ export function isNaN(value: number): boolean; /** Returns true if passed value is finite. */ export function isFinite(value: number): boolean; /** Returns true if the value passed is a safe integer. */ export function isSafeInteger(value: number): boolean; /** Returns true if the value passed is an integer, false otherwise. */ export function isInteger(value: number): boolean; /** Converts a string to a floating-point number. */ export function parseFloat(string: string): number; /** Parses a string as an integer and convert to an f64. */ export function parseInt(string: string, radix?: number): number; /** Parses a string as an f64. */ export function parse(value: string): number; } // Standard library declare const Mathf: typeof Math; declare const JSMath: typeof Math; declare interface StringConstructor { /** Equivalent to calling `String.fromCharCode` with multiple arguments. */ fromCharCodes(arr: number[]): string; /** Equivalent to calling `String.fromCodePoint` with multiple arguments. */ fromCodePoints(arr: number[]): string; } declare interface String { /** Returns value using relative indexing. Index may be negative */ at(index: number): string; } /** Annotates a class as being unmanaged with limited capabilities. */ declare function unmanaged(constructor: Function): void; /** Environmental tracing function. */ declare function trace(msg: string, n?: number, a0?: number, a1?: number, a2?: number, a3?: number, a4?: number): void; declare interface Array<T> { /** Returns value using relative indexing. Index may be negative */ at(index: number): T; /** Returns an index start searching from the end in the array */ findLastIndex(callbackfn: (value: T, index: number, self: Array<T>) => boolean): number; } declare interface Int8ArrayConstructor { /** Equivalent to calling `new Int8Array` with multiple arguments. */ wrap(buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; } declare interface Int8Array { /** Returns value using relative indexing. Index may be negative */ at(index: number): number; /** Returns an index start searching from the end in the typedarray */ findLastIndex(callbackfn: (value: number, index: number, self: Int8Array) => boolean): number; } declare interface Uint8ArrayConstructor { /** Equivalent to calling `new Uint8Array` with multiple arguments. */ wrap(buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; } declare interface Uint8Array { /** Returns value using relative indexing. Index may be negative */ at(index: number): number; /** Returns an index start searching from the end in the typedarray */ findLastIndex(callbackfn: (value: number, index: number, self: Uint8Array) => boolean): number; } declare interface Uint8ClampedArrayConstructor { /** Equivalent to calling `new Uint8ClampedArray` with multiple arguments. */ wrap(buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; } declare interface Uint8ClampedArray { /** Returns value using relative indexing. Index may be negative */ at(index: number): number; /** Returns an index start searching from the end in the typedarray */ findLastIndex(callbackfn: (value: number, index: number, self: Uint8ClampedArray) => boolean): number; } declare interface Int16ArrayConstructor { /** Equivalent to calling `new Int16Array` with multiple arguments. */ wrap(buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; } declare interface Int16Array { /** Returns value using relative indexing. Index may be negative */ at(index: number): number; /** Returns an index start searching from the end in the typedarray */ findLastIndex(callbackfn: (value: number, index: number, self: Int16Array) => boolean): number; } declare interface Uint16ArrayConstructor { /** Equivalent to calling `new Uint16Array` with multiple arguments. */ wrap(buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; } declare interface Uint16Array { /** Returns value using relative indexing. Index may be negative */ at(index: number): number; /** Returns an index start searching from the end in the typedarray */ findLastIndex(callbackfn: (value: number, index: number, self: Uint16Array) => boolean): number; } declare interface Int32ArrayConstructor { /** Equivalent to calling `new Int32Array` with multiple arguments. */ wrap(buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; } declare interface Int32Array { /** Returns value using relative indexing. Index may be negative */ at(index: number): number; /** Returns an index start searching from the end in the typedarray */ findLastIndex(callbackfn: (value: number, index: number, self: Int32Array) => boolean): number; } declare interface Uint32ArrayConstructor { /** Equivalent to calling `new Uint32Array` with multiple arguments. */ wrap(buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; } declare interface Uint32Array { /** Returns value using relative indexing. Index may be negative */ at(index: number): number; /** Returns an index start searching from the end in the typedarray */ findLastIndex(callbackfn: (value: number, index: number, self: Uint32Array) => boolean): number; } declare interface Float32ArrayConstructor { /** Equivalent to calling `new Float32Array` with multiple arguments. */ wrap(buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; } declare interface Float32Array { /** Returns value using relative indexing. Index may be negative */ at(index: number): number; /** Returns an index start searching from the end in the typedarray */ findLastIndex(callbackfn: (value: number, index: number, self: Float32Array) => boolean): number; } declare interface Float64ArrayConstructor { /** Equivalent to calling `new Float64Array` with multiple arguments. */ wrap(buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; } declare interface Float64Array { /** Returns value using relative indexing. Index may be negative */ at(index: number): number; /** Returns an index start searching from the end in the typedarray */ findLastIndex(callbackfn: (value: number, index: number, self: Float64Array) => boolean): number; } // FIXME: remove declare function offsetof<T>(fieldName?: string): number; declare function idof<T>(): number; declare module "types:assemblyscript/src/glue/binaryen" { /** * @fileoverview Portable definitions for Binaryen's C-API. * * tsc uses the .js file next to it, while asc makes it a Wasm import. * * See: https://github.com/WebAssembly/binaryen/blob/main/src/binaryen-c.h * * @license Apache-2.0 */ module "binaryen"; type Ref = number; export type Index = number; export type ExpressionId = number; export type FeatureFlags = number; export type Op = number; export type ExternalKind = number; export type SideEffects = number; export type ExpressionRunnerFlags = number; export type MemoryOrder = number; export type StringRef = Ref; export type Pointer<T> = Ref; export type ArrayRef<T> = Ref; export type TypeRef = Ref; export type HeapTypeRef = Ref; export type PackedType = number; export type ModuleRef = Ref; export type LiteralRef = Ref; export type ExpressionRef = Ref; export type FunctionRef = Ref; export type ImportRef = Ref; export type ExportRef = Ref; export type GlobalRef = Ref; export type TagRef = Ref; export type TableRef = Ref; export type ElementSegmentRef = Ref; export type RelooperRef = Ref; export type RelooperBlockRef = Ref; export type ExpressionRunnerRef = Ref; export type BinaryenModuleAllocateAndWriteResultRef = Ref; export type TypeBuilderRef = Ref; export type TypeBuilderErrorReason = number; export function _BinaryenTypeCreate(types: ArrayRef<TypeRef>, numTypes: number): TypeRef; export function _BinaryenTypeArity(type: TypeRef): number; export function _BinaryenTypeExpand(type: TypeRef, typesOut: ArrayRef<TypeRef>): void; export function _BinaryenTypeGetHeapType(type: TypeRef): HeapTypeRef; export function _BinaryenTypeFromHeapType(heapType: HeapTypeRef, nullable: boolean): TypeRef; export function _BinaryenTypeIsNullable(type: TypeRef): boolean; export function _BinaryenTypeFuncref(): TypeRef; export function _BinaryenTypeExternref(): TypeRef; export function _BinaryenTypeAnyref(): TypeRef; export function _BinaryenTypeEqref(): TypeRef; export function _BinaryenTypeStructref(): TypeRef; export function _BinaryenTypeArrayref(): TypeRef; export function _BinaryenTypeI31ref(): TypeRef; export function _BinaryenTypeStringref(): TypeRef; export function _BinaryenTypeNullref(): TypeRef; export function _BinaryenTypeNullExternref(): TypeRef; export function _BinaryenTypeNullFuncref(): TypeRef; export function _BinaryenHeapTypeFunc(): HeapTypeRef; export function _BinaryenHeapTypeExt(): HeapTypeRef; export function _BinaryenHeapTypeAny(): HeapTypeRef; export function _BinaryenHeapTypeEq(): HeapTypeRef; export function _BinaryenHeapTypeI31(): HeapTypeRef; export function _BinaryenHeapTypeStruct(): HeapTypeRef; export function _BinaryenHeapTypeArray(): HeapTypeRef; export function _BinaryenHeapTypeString(): HeapTypeRef; export function _BinaryenHeapTypeNone(): HeapTypeRef; export function _BinaryenHeapTypeNoext(): HeapTypeRef; export function _BinaryenHeapTypeNofunc(): HeapTypeRef; export function _BinaryenHeapTypeIsBasic(heapType: HeapTypeRef): boolean; export function _BinaryenHeapTypeIsSignature(heapType: HeapTypeRef): boolean; export function _BinaryenHeapTypeIsStruct(heapType: HeapTypeRef): boolean; export function _BinaryenHeapTypeIsArray(heapType: HeapTypeRef): boolean; export function _BinaryenHeapTypeIsBottom(heapType: HeapTypeRef): boolean; export function _BinaryenHeapTypeGetBottom(heapType: HeapTypeRef): HeapTypeRef; export function _BinaryenHeapTypeIsSubType(left: HeapTypeRef, right: HeapTypeRef): boolean; export function _BinaryenStructTypeGetNumFields(heapType: HeapTypeRef): Index; export function _BinaryenStructTypeGetFieldType(heapType: HeapTypeRef, index: Index): TypeRef; export function _BinaryenStructTypeGetFieldPackedType(heapType: HeapTypeRef, index: Index): PackedType; export function _BinaryenStructTypeIsFieldMutable(heapType: HeapTypeRef, index: Index): boolean; export function _BinaryenArrayTypeGetElementType(heapType: HeapTypeRef): TypeRef; export function _BinaryenArrayTypeGetElementPackedType(heapType: HeapTypeRef): PackedType; export function _BinaryenArrayTypeIsElementMutable(heapType: HeapTypeRef): boolean; export function _BinaryenSignatureTypeGetParams(heapType: HeapTypeRef): TypeRef; export function _BinaryenSignatureTypeGetResults(heapType: HeapTypeRef): TypeRef; export function _BinaryenModuleCreate(): ModuleRef; export function _BinaryenModuleDispose(module: ModuleRef): void; export function _BinaryenSizeofLiteral(): number; export function _BinaryenLiteralInt32(literalOut: LiteralRef, x: number): void; export function _BinaryenLiteralInt64(literalOut: LiteralRef, value: i64): void; export function _BinaryenLiteralFloat32(literalOut: LiteralRef, x: number): void; export function _BinaryenLiteralFloat64(literalOut: LiteralRef, x: number): void; export function _BinaryenLiteralVec128(literalOut: LiteralRef, x: ArrayRef<number>): void; export function _BinaryenLiteralFloat32Bits(literalOut: LiteralRef, x: number): void; export function _BinaryenLiteralFloat64Bits(literalOut: LiteralRef, value: i64): void; export function _BinaryenExpressionGetId(expr: ExpressionRef): ExpressionId; export function _BinaryenExpressionGetType(expr: ExpressionRef): TypeRef; export function _BinaryenExpressionSetType(expr: ExpressionRef, type: TypeRef): void; export function _BinaryenExpressionPrint(expr: ExpressionRef): void; export function _BinaryenExpressionCopy(expr: ExpressionRef, module: ModuleRef): ExpressionRef; export function _BinaryenExpressionFinalize(expr: ExpressionRef): void; export function _BinaryenBlock(module: ModuleRef, name: StringRef, childExprs: ArrayRef<ExpressionRef>, numChildren: Index, type: TypeRef): ExpressionRef; export function _BinaryenBlockGetName(expr: ExpressionRef): StringRef; export function _BinaryenBlockSetName(expr: ExpressionRef, name: StringRef): void; export function _BinaryenBlockGetNumChildren(expr: ExpressionRef): Index; export function _BinaryenBlockGetChildAt(expr: ExpressionRef, index: Index): ExpressionRef; export function _BinaryenBlockSetChildAt(expr: ExpressionRef, index: Index, childExpr: ExpressionRef): void; export function _BinaryenBlockAppendChild(expr: ExpressionRef, childExpr: ExpressionRef): Index; export function _BinaryenBlockInsertChildAt(expr: ExpressionRef, index: Index, childExpr: ExpressionRef): void; export function _BinaryenBlockRemoveChildAt(expr: ExpressionRef, index: Index): ExpressionRef; export function _BinaryenIf(module: ModuleRef, conditionExpr: ExpressionRef, ifTrueExpr: ExpressionRef, ifFalseExpr: ExpressionRef): ExpressionRef; export function _BinaryenIfGetCondition(expr: ExpressionRef): ExpressionRef; export function _BinaryenIfSetCondition(expr: ExpressionRef, conditionExpr: ExpressionRef): void; export function _BinaryenIfGetIfTrue(expr: ExpressionRef): ExpressionRef; export function _BinaryenIfSetIfTrue(expr: ExpressionRef, ifTrueExpr: ExpressionRef): void; export function _BinaryenIfGetIfFalse(expr: ExpressionRef): ExpressionRef; export function _BinaryenIfSetIfFalse(expr: ExpressionRef, ifFalseExpr: ExpressionRef): void; export function _BinaryenLoop(module: ModuleRef, name: StringRef, bodyExpr: ExpressionRef): ExpressionRef; export function _BinaryenLoopGetName(expr: ExpressionRef): StringRef; export function _BinaryenLoopSetName(expr: ExpressionRef, name: StringRef): void; export function _BinaryenLoopGetBody(expr: ExpressionRef): ExpressionRef; export function _BinaryenLoopSetBody(expr: ExpressionRef, bodyExpr: ExpressionRef): void; export function _BinaryenBreak(module: ModuleRef, name: StringRef, conditionExpr: ExpressionRef, valueExpr: ExpressionRef): ExpressionRef; export function _BinaryenBreakGetName(expr: ExpressionRef): StringRef; export function _BinaryenBreakSetName(expr: ExpressionRef, name: StringRef): void; export function _BinaryenBreakGetCondition(expr: ExpressionRef): ExpressionRef; export function _BinaryenBreakSetCondition(expr: ExpressionRef, conditionExpr: ExpressionRef): void; export function _BinaryenBreakGetValue(expr: ExpressionRef): ExpressionRef; export function _BinaryenBreakSetValue(expr: ExpressionRef, valueExpr: ExpressionRef): void; export function _BinaryenSwitch(module: ModuleRef, names: ArrayRef<StringRef>, numNames: Index, defaultName: StringRef, conditionExpr: ExpressionRef, valueExpr: ExpressionRef): ExpressionRef; export function _BinaryenSwitchGetNumNames(expr: ExpressionRef): Index; export function _BinaryenSwitchGetNameAt(expr: ExpressionRef, index: Index): StringRef; export function _BinaryenSwitchSetNameAt(expr: ExpressionRef, index: Index, name: StringRef): void; export function _BinaryenSwitchAppendName(expr: ExpressionRef, name: StringRef): Index; export function _BinaryenSwitchInsertNameAt(expr: ExpressionRef, index: Index, name: StringRef): void; export function _BinaryenSwitchRemoveNameAt(expr: ExpressionRef, index: Index): StringRef; export function _BinaryenSwitchGetDefaultName(expr: ExpressionRef): StringRef; export function _BinaryenSwitchSetDefaultName(expr: ExpressionRef, defaultName: StringRef): void; export function _BinaryenSwitchGetCondition(expr: ExpressionRef): ExpressionRef; export function _BinaryenSwitchSetCondition(expr: ExpressionRef, conditionExpr: ExpressionRef): void; export function _BinaryenSwitchGetValue(expr: ExpressionRef): ExpressionRef; export function _BinaryenSwitchSetValue(expr: ExpressionRef, valueExpr: ExpressionRef): void; export function _BinaryenCall(module: ModuleRef, targetName: StringRef, operandExprs: ArrayRef<ExpressionRef>, numOperands: Index, returnType: TypeRef): ExpressionRef; export function _BinaryenCallGetTarget(expr: ExpressionRef): StringRef; export function _BinaryenCallSetTarget(expr: ExpressionRef, targetName: StringRef): void; export function _BinaryenCallGetNumOperands(expr: ExpressionRef): Index; export function _BinaryenCallGetOperandAt(expr: ExpressionRef, index: Index): ExpressionRef; export function _BinaryenCallSetOperandAt(expr: ExpressionRef, index: Index, operandExpr: ExpressionRef): void; export function _BinaryenCallAppendOperand(expr: ExpressionRef, operandExpr: ExpressionRef): Index; export function _BinaryenCallInsertOperandAt(expr: ExpressionRef, index: Index, operandExpr: ExpressionRef): void; export function _BinaryenCallRemoveOperandAt(expr: ExpressionRef, index: Index): ExpressionRef; export function _BinaryenCallIsReturn(expr: ExpressionRef): boolean; export function _BinaryenCallSetReturn(expr: ExpressionRef, isReturn: boolean): void; // ^ with return = true export function _BinaryenReturnCall(module: ModuleRef, targetName: StringRef, operandExprs: ArrayRef<ExpressionRef>, numOperands: Index, returnType: TypeRef): ExpressionRef; export function _BinaryenCallIndirect(module: ModuleRef, table: StringRef, targetExpr: ExpressionRef, operandExprs: ArrayRef<ExpressionRef>, numOperands: Index, params: TypeRef, results: TypeRef): ExpressionRef; export function _BinaryenCallIndirectGetTable(expr: ExpressionRef): StringRef; export function _BinaryenCallIndirectSetTable(expr: ExpressionRef, table: StringRef): void; export function _BinaryenCallIndirectGetTarget(expr: ExpressionRef): ExpressionRef; export function _BinaryenCallIndirectSetTarget(expr: ExpressionRef, targetExpr: ExpressionRef): void; export function _BinaryenCallIndirectGetNumOperands(expr: ExpressionRef): Index; export function _BinaryenCallIndirectGetOperandAt(expr: ExpressionRef, index: Index): ExpressionRef; export function _BinaryenCallIndirectSetOperandAt(expr: ExpressionRef, index: Index, operandExpr: ExpressionRef): void; export function _BinaryenCallIndirectAppendOperand(expr: ExpressionRef, operandExpr: ExpressionRef): Index; export function _BinaryenCallIndirectInsertOperandAt(expr: ExpressionRef, index: Index, operandExpr: ExpressionRef): void; export function _BinaryenCallIndirectRemoveOperandAt(expr: ExpressionRef, index: Index): ExpressionRef; export function _BinaryenCallIndirectIsReturn(expr: ExpressionRef): boolean; export function _BinaryenCallIndirectSetReturn(expr: ExpressionRef, isReturn: boolean): void; // ^ with return = true export function _BinaryenReturnCallIndirect(module: ModuleRef, table: StringRef, targetExpr: ExpressionRef, operandExprs: ArrayRef<ExpressionRef>, numOperands: Index, params: TypeRef, results: TypeRef): ExpressionRef; export function _BinaryenLocalGet(module: ModuleRef, index: Index, type: TypeRef): ExpressionRef; export function _BinaryenLocalGetGetIndex(expr: ExpressionRef): Index; export function _BinaryenLocalGetSetIndex(expr: ExpressionRef, index: Index): void; export function _BinaryenLocalSet(module: ModuleRef, index: Index, valueExpr: ExpressionRef): ExpressionRef; export function _BinaryenLocalSetIsTee(expr: ExpressionRef): boolean; export function _BinaryenLocalSetGetIndex(expr: ExpressionRef): Index; export function _BinaryenLocalSetSetIndex(expr: ExpressionRef, index: Index): void; export function _BinaryenLocalSetGetValue(expr: ExpressionRef): ExpressionRef; export function _BinaryenLocalSetSetValue(expr: ExpressionRef, valueExpr: ExpressionRef): void; // ^ with type != none export function _BinaryenLocalTee(module: ModuleRef, index: Index, valueExpr: ExpressionRef, type: TypeRef): ExpressionRef; export function _BinaryenGlobalGet(module: ModuleRef, name: StringRef, type: TypeRef): ExpressionRef; export function _BinaryenGlobalGetGetName(expr: ExpressionRef): StringRef; export function _BinaryenGlobalGetSetName(expr: ExpressionRef, name: StringRef): void; export function _BinaryenGlobalSet(module: ModuleRef, name: StringRef, value: ExpressionRef): ExpressionRef; export function _BinaryenGlobalSetGetName(expr: ExpressionRef): StringRef; export function _BinaryenGlobalSetSetName(expr: ExpressionRef, name: StringRef): void; export function _BinaryenGlobalSetGetValue(expr: ExpressionRef): ExpressionRef; export function _BinaryenGlobalSetSetValue(expr: ExpressionRef, valueExpr: ExpressionRef): void; export function _BinaryenMemorySize(module: ModuleRef, memoryName: StringRef, memoryIs64: boolean): ExpressionRef; export function _BinaryenMemoryGrow(module: ModuleRef, delta: ExpressionRef, memoryName: StringRef, memoryIs64: boolean): ExpressionRef; export function _BinaryenMemoryGrowGetDelta(expr: ExpressionRef): ExpressionRef; export function _BinaryenMemoryGrowSetDelta(expr: ExpressionRef, delta: ExpressionRef): void; export function _BinaryenLoad(module: ModuleRef, bytes: number, signed: boolean, offset: number, align: number, type: TypeRef, ptrExpr: ExpressionRef, memoryName: StringRef): ExpressionRef; export function _BinaryenLoadIsAtomic(expr: ExpressionRef): boolean; export function _BinaryenLoadSetAtomic(expr: ExpressionRef, isAtomic: boolean): void; export function _BinaryenLoadIsSigned(expr: ExpressionRef): boolean; export function _BinaryenLoadSetSigned(expr: ExpressionRef, isSigned: boolean): void; export function _BinaryenLoadGetOffset(expr: ExpressionRef): number; export function _BinaryenLoadSetOffset(expr: ExpressionRef, offset: number): void; export function _BinaryenLoadGetBytes(expr: ExpressionRef): number; export function _BinaryenLoadSetBytes(expr: ExpressionRef, bytes: number): void; export function _BinaryenLoadGetAlign(expr: ExpressionRef): number; export function _BinaryenLoadSetAlign(expr: ExpressionRef, align: number): void; export function _BinaryenLoadGetPtr(expr: ExpressionRef): ExpressionRef; export function _BinaryenLoadSetPtr(expr: ExpressionRef, ptrExpr: ExpressionRef): void; // ^ with atomic = true export function _BinaryenAtomicLoad(module: ModuleRef, bytes: Index, offset: Index, type: TypeRef, ptrExpr: ExpressionRef, memoryName: StringRef, memoryOrder: MemoryOrder): ExpressionRef; export function _BinaryenStore(module: ModuleRef, bytes: number, offset: number, align: number, ptrExpr: ExpressionRef, valueExpr: ExpressionRef, type: TypeRef, memoryName: StringRef): ExpressionRef; export function _BinaryenStoreIsAtomic(expr: ExpressionRef): boolean; export function _BinaryenStoreSetAtomic(expr: ExpressionRef, isAtomic: boolean): void; export function _BinaryenStoreGetBytes(expr: ExpressionRef): number; export function _BinaryenStoreSetBytes(expr: ExpressionRef, bytes: number): void; export function _BinaryenStoreGetOffset(expr: ExpressionRef): number; export function _BinaryenStoreSetOffset(expr: ExpressionRef, offset: number): void; export function _BinaryenStoreGetAlign(expr: ExpressionRef): number; export function _BinaryenStoreSetAlign(expr: ExpressionRef, align: number): void; export function _BinaryenStoreGetPtr(expr: ExpressionRef): ExpressionRef; export function _BinaryenStoreSetPtr(expr: ExpressionRef, ptrExpr: ExpressionRef): void; export function _BinaryenStoreGetValue(expr: ExpressionRef): ExpressionRef; export function _BinaryenStoreSetValue(expr: ExpressionRef, valueExpr: ExpressionRef): void; export function _BinaryenStoreGetValueType(expr: ExpressionRef): TypeRef; export function _BinaryenStoreSetValueType(expr: ExpressionRef, valueType: TypeRef): void; // ^ with atomic = true export function _BinaryenAtomicStore(module: ModuleRef, bytes: Index, offset: Index, ptrExpr: ExpressionRef, valueExpr: ExpressionRef, type: TypeRef, memoryName: StringRef, memoryOrder: MemoryOrder): ExpressionRef; export function _BinaryenConst(module: ModuleRef, value: LiteralRef): ExpressionRef; export function _BinaryenConstGetValueI32(expr: ExpressionRef): number; export function _BinaryenConstSetValueI32(expr: ExpressionRef, value: number): void; export function _BinaryenConstGetValueI64(expr: ExpressionRef): i64; export function _BinaryenConstSetValueI64(expr: ExpressionRef, value: i64): void; export function _BinaryenConstGetValueF32(expr: ExpressionRef): number; export function _BinaryenConstSetValueF32(expr: ExpressionRef, value: number): void; export function _BinaryenConstGetValueF64(expr: ExpressionRef): number; export function _BinaryenConstSetValueF64(expr: ExpressionRef, value: number): void; export function _BinaryenConstGetValueV128(expr: ExpressionRef, valueOut: ArrayRef<number>): void; export function _BinaryenConstSetValueV128(expr: ExpressionRef, value: ArrayRef<number>): void; export function _BinaryenUnary(module: ModuleRef, op: Op, valueExpr: ExpressionRef): ExpressionRef; export function _BinaryenUnaryGetOp(expr: ExpressionRef): Op; export function _BinaryenUnarySetOp(expr: ExpressionRef, op: Op): void; export function _BinaryenUnaryGetValue(expr: ExpressionRef): ExpressionRef; export function _BinaryenUnarySetValue(expr: ExpressionRef, valueExpr: ExpressionRef): void; export function _BinaryenWideIntAddSub(module: ModuleRef, op: Op, leftLowExpr: ExpressionRef, leftHighExpr: ExpressionRef, rightLowExpr: ExpressionRef, rightHighExpr: ExpressionRef): ExpressionRef; export function _BinaryenWideIntMul(module: ModuleRef, op: Op, leftExpr: ExpressionRef, rightExpr: ExpressionRef): ExpressionRef; export function _BinaryenBinary(module: ModuleRef, op: Op, leftExpr: ExpressionRef, rightExpr: ExpressionRef): ExpressionRef; export function _BinaryenBinaryGetOp(expr: ExpressionRef): Op; export function _BinaryenBinarySetOp(expr: ExpressionRef, op: Op): void; export function _BinaryenBinaryGetLeft(expr: ExpressionRef): ExpressionRef; export function _BinaryenBinarySetLeft(expr: ExpressionRef, leftExpr: ExpressionRef): void; export function _BinaryenBinaryGetRight(expr: ExpressionRef): ExpressionRef; export function _BinaryenBinarySetRight(expr: ExpressionRef, rightExpr: ExpressionRef): void; export function _BinaryenSelect(module: ModuleRef, conditionExpr: ExpressionRef, ifTrueExpr: ExpressionRef, ifFalseExpr: ExpressionRef): ExpressionRef; export function _BinaryenSelectGetIfTrue(expr: ExpressionRef): ExpressionRef; export function _BinaryenSelectSetIfTrue(expr: ExpressionRef, ifTrueExpr: ExpressionRef): void; export function _BinaryenSelectGetIfFalse(expr: ExpressionRef): ExpressionRef; export function _BinaryenSelectSetIfFalse(expr: ExpressionRef, ifFalseExpr: ExpressionRef): void; export function _BinaryenSelectGetCondition(expr: ExpressionRef): ExpressionRef; export function _BinaryenSelectSetCondition(expr: ExpressionRef, conditionExpr: ExpressionRef): void; export function _BinaryenDrop(module: ModuleRef, valueExpr: ExpressionRef): ExpressionRef; export function _BinaryenDropGetValue(expr: ExpressionRef): ExpressionRef; export function _BinaryenDropSetValue(expr: ExpressionRef, valueExpr: ExpressionRef): void; export function _BinaryenReturn(module: ModuleRef, valueExpr: ExpressionRef): ExpressionRef; export function _BinaryenReturnGetValue(expr: ExpressionRef): ExpressionRef; export function _BinaryenReturnSetValue(expr: ExpressionRef, valueExpr: ExpressionRef): void; export function _BinaryenNop(module: ModuleRef): ExpressionRef; export function _BinaryenUnreachable(module: ModuleRef): ExpressionRef; export function _BinaryenAtomicRMW(module: ModuleRef, op: Op, bytes: number, offset: number, ptrExpr: ExpressionRef, valueExpr: ExpressionRef, type: TypeRef, memoryName: StringRef, memoryOrder: MemoryOrder): ExpressionRef; export function _BinaryenAtomicRMWGetOp(expr: ExpressionRef): Op; export function _BinaryenAtomicRMWSetOp(expr: ExpressionRef, op: Op): void; export function _BinaryenAtomicRMWGetBytes(expr: ExpressionRef): number; export function _BinaryenAtomicRMWSetBytes(expr: ExpressionRef, bytes: number): void; export function _BinaryenAtomicRMWGetOffset(expr: ExpressionRef): number; export function _BinaryenAtomicRMWSetOffset(expr: ExpressionRef, offset: number): void; export function _BinaryenAtomicRMWGetPtr(expr: ExpressionRef): ExpressionRef; export function _BinaryenAtomicRMWSetPtr(expr: ExpressionRef, ptrExpr: ExpressionRef): void; export function _BinaryenAtomicRMWGetValue(expr: ExpressionRef): ExpressionRef; export function _BinaryenAtomicRMWSetValue(expr: ExpressionRef, valueExpr: ExpressionRef): void; export function _BinaryenAtomicCmpxchg(module: ModuleRef, bytes: number, offset: number, ptrExpr: ExpressionRef, expectedExpr: ExpressionRef, replacementExpr: ExpressionRef, type: TypeRef, memoryName: StringRef, memoryOrder: MemoryOrder): ExpressionRef; export function _BinaryenAtomicCmpxchgGetBytes(expr: ExpressionRef): number; export function _BinaryenAtomicCmpxchgSetBytes(expr: ExpressionRef, bytes: number): void; export function _BinaryenAtomicCmpxchgGetOffset(expr: ExpressionRef): number; export function _BinaryenAtomicCmpxchgSetOffset(expr: ExpressionRef, offset: number): void; export function _BinaryenAtomicCmpxchgGetPtr(expr: ExpressionRef): ExpressionRef; export function _BinaryenAtomicCmpxchgSetPtr(expr: ExpressionRef, ptrExpr: ExpressionRef): void; export function _BinaryenAtomicCmpxchgGetExpected(expr: ExpressionRef): ExpressionRef; export function _BinaryenAtomicCmpxchgSetExpected(expr: ExpressionRef, expectedExpr: ExpressionRef): void; export function _BinaryenAtomicCmpxchgGetReplacement(expr: ExpressionRef): ExpressionRef; export function _BinaryenAtomicCmpxchgSetReplacement(expr: ExpressionRef, replacementExpr: ExpressionRef): void; export function _BinaryenAtomicWait(module: ModuleRef, ptrExpr: ExpressionRef, expectedExpr: ExpressionRef, timeoutExpr: ExpressionRef, expectedType: TypeRef, memoryName: StringRef): ExpressionRef; export function _BinaryenAtomicWaitGetPtr(expr: ExpressionRef): ExpressionRef; export function _BinaryenAtomicWaitSetPtr(expr: ExpressionRef, ptrExpr: ExpressionRef): void; export function _BinaryenAtomicWaitGetExpected(expr: ExpressionRef): ExpressionRef; export function _BinaryenAtomicWaitSetExpected(expr: ExpressionRef, expectedExpr: ExpressionRef): void; export function _BinaryenAtomicWaitGetTimeout(expr: ExpressionRef): ExpressionRef; export function _BinaryenAtomicWaitSetTimeout(expr: ExpressionRef, timeoutExpr: ExpressionRef): void; export function _BinaryenAtomicWaitGetExpectedType(expr: ExpressionRef): TypeRef; export function _BinaryenAtomicWaitSetExpectedType(expr: ExpressionRef, expectedType: TypeRef): void; export function _BinaryenAtomicNotify(module: ModuleRef, ptrExpr: ExpressionRef, notifyCountExpr: ExpressionRef, memoryName: StringRef): Ex