Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Definition Reading Functions

  • decimalPlaces(definition: AstNode): number
  • functionKind(node: AstNode): string | undefined
  • compatibility function, since pre-0.5.0 functions don't have node.kind returns undefined if you don't put in a function node

    Parameters

    Returns string | undefined

  • isArray(definition: AstNode): boolean
  • isContractPayable(definition: AstNode): boolean
  • isDynamicArray(definition: AstNode): boolean
  • isEnum(definition: AstNode): boolean
  • isMapping(definition: AstNode): boolean
  • isReference(definition: AstNode): boolean
  • isSimpleConstant(definition: AstNode): boolean
  • isStruct(definition: AstNode): boolean
  • similar compatibility function for mutability for pre-0.4.16 versions returns undefined if you don't give it a FunctionDefinition or VariableDeclaration

    Parameters

    Returns Mutability | undefined

  • rationalValue(definition: AstNode): BN
  • extract the actual numerical value from a node of type rational. currently assumes result will be integer (currently returns BN)

    Parameters

    Returns BN

  • regularizeTypeIdentifier(identifier: string): string
  • adds "_ptr" on to the end of type identifiers that might need it; note that this operates on identifiers, not definitions

    Parameters

    • identifier: string

    Returns string

  • specifiedSize(definition: AstNode): number
  • stackSize(definition: AstNode): number
  • stack size, in words, of a given type note: this function assumes that UDVTs only ever take up a single word, which is currently true

    Parameters

    Returns number

  • staticLength(definition: AstNode): number
  • length of a statically sized array -- please only use for arrays already verified to be static!

    Parameters

    Returns number

  • staticLengthAsString(definition: AstNode): string
  • typeClass(definition: AstNode): string
  • returns basic type class for a variable definition node e.g.: t_uint256 becomes uint t_struct$_Thing_$20_memory_ptr becomes struct

    Parameters

    Returns string

  • typeClassLongForm(definition: AstNode): string
  • similar to typeClass, but includes any numeric qualifiers e.g.: t_uint256 becomes uint256

    Parameters

    Returns string

  • typeId(definition: AstNode): number
  • for user-defined types -- structs, enums, contracts often you can get these from referencedDeclaration, but not always

    Parameters

    Returns number

  • typeIdentifier(definition: AstNode): string
  • typeString(definition: AstNode): string
  • typeStringWithoutLocation(definition: AstNode): string
  • For function types; returns internal or external (not for use on other types! will cause an error!) should only return "internal" or "external"

    Parameters

    Returns Visibility

Other Functions

  • definitionToAbi(node: AstNode, referenceDeclarations: AstNodes): Abi.Entry | undefined
  • functionClass(node: AstNode): string | undefined

Generated using TypeDoc