Documentation ¶
Index ¶
- func Pretty(w io.Writer, m *Module, opts ...PrettyOption)
- type CodeEntry
- type DataSection
- type DataSegment
- type Export
- type ExportDescriptor
- type ExportDescriptorType
- type ExportSection
- type Expr
- type Function
- type FunctionImport
- type FunctionSection
- type FunctionType
- type Global
- type GlobalImport
- type GlobalSection
- type Import
- type ImportDescriptor
- type ImportDescriptorType
- type ImportSection
- type Limit
- type LocalDeclaration
- type MemType
- type MemoryImport
- type Module
- type PrettyOption
- type RawCodeSection
- type RawCodeSegment
- type Table
- type TableImport
- type TableSection
- type TypeSection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DataSection ¶
type DataSection struct {
Segments []DataSegment
}
DataSection represents a WASM data section.
type DataSegment ¶
DataSegment represents a WASM data segment.
func (DataSegment) String ¶
func (seg DataSegment) String() string
type Export ¶
type Export struct { Name string Descriptor ExportDescriptor }
Export represents a WASM export statement.
type ExportDescriptor ¶
type ExportDescriptor struct { Type ExportDescriptorType Index uint32 }
ExportDescriptor represents a WASM export descriptor.
type ExportDescriptorType ¶
type ExportDescriptorType int
ExportDescriptorType defines the allowed kinds of export descriptors.
const ( FunctionExportType ExportDescriptorType = iota TableExportType MemoryExportType GlobalExportType )
Defines the allowed kinds of exports.
func (ExportDescriptorType) String ¶
func (x ExportDescriptorType) String() string
type ExportSection ¶
type ExportSection struct {
Exports []Export
}
ExportSection represents a WASM export section.
type Expr ¶
type Expr struct {
Instrs []instruction.Instruction
}
Expr represents a WASM expression.
type Function ¶
type Function struct { Locals []LocalDeclaration Expr Expr }
Function represents a function in a code segment.
type FunctionImport ¶
type FunctionImport struct {
Func uint32
}
FunctionImport represents a WASM function import statement.
func (FunctionImport) Kind ¶
func (i FunctionImport) Kind() ImportDescriptorType
Kind returns the function import type kind.
func (FunctionImport) String ¶
func (i FunctionImport) String() string
type FunctionSection ¶
type FunctionSection struct {
TypeIndices []uint32
}
FunctionSection represents a WASM function section.
type FunctionType ¶
FunctionType represents a WASM function type definition.
func (FunctionType) String ¶
func (tpe FunctionType) String() string
type GlobalImport ¶
GlobalImport represents a WASM global variable import statement.
func (GlobalImport) Kind ¶
func (i GlobalImport) Kind() ImportDescriptorType
Kind returns the global import type kind.
func (GlobalImport) String ¶
func (i GlobalImport) String() string
type GlobalSection ¶
type GlobalSection struct {
Globals []Global
}
GlobalSection represents a WASM global section.
type Import ¶
type Import struct { Module string Name string Descriptor ImportDescriptor }
Import represents a WASM import statement.
type ImportDescriptor ¶
type ImportDescriptor interface { fmt.Stringer Kind() ImportDescriptorType }
ImportDescriptor represents a WASM import descriptor.
type ImportDescriptorType ¶
type ImportDescriptorType int
ImportDescriptorType defines allowed kinds of import descriptors.
const ( FunctionImportType ImportDescriptorType = iota TableImportType MemoryImportType GlobalImportType )
Defines the allowed kinds of imports.
func (ImportDescriptorType) String ¶
func (x ImportDescriptorType) String() string
type ImportSection ¶
type ImportSection struct {
Imports []Import
}
ImportSection represents a WASM import section.
type LocalDeclaration ¶
LocalDeclaration represents a local variable declaration.
type MemoryImport ¶
type MemoryImport struct {
Mem MemType
}
MemoryImport represents a WASM memory import statement.
func (MemoryImport) Kind ¶
func (i MemoryImport) Kind() ImportDescriptorType
Kind returns the memory import type kind.
func (MemoryImport) String ¶
func (i MemoryImport) String() string
type Module ¶
type Module struct { Version uint32 Type TypeSection Import ImportSection Function FunctionSection Table TableSection Global GlobalSection Export ExportSection Code RawCodeSection Data DataSection }
Module represents a WASM module.
type PrettyOption ¶
type PrettyOption struct {
Contents bool // show raw byte content of data+code sections.
}
PrettyOption defines options for controlling pretty printing.
type RawCodeSection ¶
type RawCodeSection struct {
Segments []RawCodeSegment
}
RawCodeSection represents a WASM code section. The code section is left as a raw byte sequence. See CodeSection for the decoded version.
type RawCodeSegment ¶
type RawCodeSegment struct {
Code []byte
}
RawCodeSegment represents a binary-encoded WASM code segment.
func (RawCodeSegment) String ¶
func (seg RawCodeSegment) String() string
type Table ¶
type Table struct { Type types.ElementType Lim Limit }
Table represents a WASM table statement.
type TableImport ¶
type TableImport struct { Type types.ElementType Lim Limit }
TableImport represents a WASM table import statement.
func (TableImport) Kind ¶
func (i TableImport) Kind() ImportDescriptorType
Kind returns the table import type kind.
func (TableImport) String ¶
func (i TableImport) String() string
type TableSection ¶
type TableSection struct {
Tables []Table
}
TableSection represents a WASM table section.
type TypeSection ¶
type TypeSection struct {
Functions []FunctionType
}
TypeSection represents a WASM type section.