Class: ArgumentDef

ArgumentDef(type, isInput, isOutput)

An argument definition is used by FunctionPrototype to define the arguments to a function.

Constructor

new ArgumentDef(type, isInput, isOutput)

Construct an argument definition. The In, Out, and InOut helper classes should be used to construct argument definitions as they are semantically clearer and avoid the possibility of setting both isInput and isOutput to false.

Parameters:
Name Type Description
type Type.<T>

The argument type

isInput boolean

If true the argument provides data to the function

isOutput boolean

If true the argument is populated by the function

Source:

Classes

ArgumentDef

Methods

marshall(memoryManager, unmarshalledIndex, unmarshalledArgs) → {number|T}

Create a representation of the JavaScript value which can be passed to a WebAssembly module instance. For value types this is typically the value itself. For reference types memory will be allocated in the instance, and the data will be copied.

Parameters:
Name Type Description
memoryManager MemoryManager

A class which provides methods to

unmarshalledIndex number

The index of the unmarshalled value

unmarshalledArgs Array.<*>

The unmarshalled arguments

Source:
Throws:

If the argument is not input and/or output.

Type
Error
Returns:

The address of the allocated memory or the marshalled value.

Type
number | T

unmarshall(memoryManager, addressOrValue, unmarshalledIndex, unmarshalledArgs) → {number|T}

Unmarshall a value

Parameters:
Name Type Description
memoryManager MemoryManager

The memory manager

addressOrValue number | T

The marshalled address or value

unmarshalledIndex number

The index of the unmarshalled value or -1

unmarshalledArgs Array.<*>

The unmarshall args

Source:
Returns:

The unmarshalled value.

Type
number | T