@webassemblyjs/ast
AST utils for webassemblyjs
Installation
yarn add @webassemblyjs/astUsage
Traverse
import { traverse } from "@webassemblyjs/ast";
traverse(ast, {
Module(path) {
console.log(path.node);
}
});Instruction signatures
import { signatures } from "@webassemblyjs/ast";
console.log(signatures);Path methods
findParent: NodeLocatorreplaceWith: Node => voidremove: () => voidinsertBefore: Node => voidinsertAfter: Node => voidstop: () => void
AST utils
function
module(id, fields, metadata)function
moduleMetadata(sections, functionNames, localNames)function
moduleNameMetadata(value)function
functionNameMetadata(value, index)function
localNameMetadata(value, localIndex, functionIndex)function
binaryModule(id, blob)function
quoteModule(id, string)function
sectionMetadata(section, startOffset, size, vectorOfSize)function
loopInstruction(label, resulttype, instr)function
instruction(id, args, namedArgs)function
objectInstruction(id, object, args, namedArgs)function
ifInstruction(testLabel, test, result, consequent, alternate)function
stringLiteral(value)function
numberLiteralFromRaw(value, raw)function
longNumberLiteral(value, raw)function
floatLiteral(value, nan, inf, raw)function
elem(table, offset, funcs)function
indexInFuncSection(index)function
valtypeLiteral(name)function
typeInstruction(id, functype)function
start(index)function
globalType(valtype, mutability)function
leadingComment(value)function
blockComment(value)function
data(memoryIndex, offset, init)function
global(globalType, init, name)function
table(elementType, limits, name, elements)function
memory(limits, id)function
funcImportDescr(id, signature)function
moduleImport(module, name, descr)function
moduleExportDescr(exportType, id)function
moduleExport(name, descr)function
limit(min, max)function
signature(params, results)function
program(body)function
identifier(value, raw)function
blockInstruction(label, instr, result)function
callInstruction(index, instrArgs)function
callIndirectInstruction(signature, intrs)function
byteArray(values)function
func(name, signature, body, isExternal, metadata)Constant
isModuleConstant
isModuleMetadataConstant
isModuleNameMetadataConstant
isFunctionNameMetadataConstant
isLocalNameMetadataConstant
isBinaryModuleConstant
isQuoteModuleConstant
isSectionMetadataConstant
isLoopInstructionConstant
isInstructionConstant
isObjectInstructionConstant
isIfInstructionConstant
isStringLiteralConstant
isNumberLiteralConstant
isLongNumberLiteralConstant
isFloatLiteralConstant
isElemConstant
isIndexInFuncSectionConstant
isValtypeLiteralConstant
isTypeInstructionConstant
isStartConstant
isGlobalTypeConstant
isLeadingCommentConstant
isBlockCommentConstant
isDataConstant
isGlobalConstant
isTableConstant
isMemoryConstant
isFuncImportDescrConstant
isModuleImportConstant
isModuleExportDescrConstant
isModuleExportConstant
isLimitConstant
isSignatureConstant
isProgramConstant
isIdentifierConstant
isBlockInstructionConstant
isCallInstructionConstant
isCallIndirectInstructionConstant
isByteArrayConstant
isFuncConstant
assertModuleConstant
assertModuleMetadataConstant
assertModuleNameMetadataConstant
assertFunctionNameMetadataConstant
assertLocalNameMetadataConstant
assertBinaryModuleConstant
assertQuoteModuleConstant
assertSectionMetadataConstant
assertLoopInstructionConstant
assertInstructionConstant
assertObjectInstructionConstant
assertIfInstructionConstant
assertStringLiteralConstant
assertNumberLiteralConstant
assertLongNumberLiteralConstant
assertFloatLiteralConstant
assertElemConstant
assertIndexInFuncSectionConstant
assertValtypeLiteralConstant
assertTypeInstructionConstant
assertStartConstant
assertGlobalTypeConstant
assertLeadingCommentConstant
assertBlockCommentConstant
assertDataConstant
assertGlobalConstant
assertTableConstant
assertMemoryConstant
assertFuncImportDescrConstant
assertModuleImportConstant
assertModuleExportDescrConstant
assertModuleExportConstant
assertLimitConstant
assertSignatureConstant
assertProgramConstant
assertIdentifierConstant
assertBlockInstructionConstant
assertCallInstructionConstant
assertCallIndirectInstructionConstant
assertByteArrayConstant
assertFunc
Last updated
Was this helpful?