extract

package
v0.0.0-...-4f02c87 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2018 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package extract contains methods to extract type information from ast.Node trees.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayType

func ArrayType(path string, arrayTypeName ast.ArrayTypeName) (types.Array, error)

EnumType extracts a types.Array from an ast.ArrayTypeName.

func ContractAPI

func ContractAPI(contractDefinition ast.ContractDefinition, typeMap types.Map) ([]types.Function, error)

ContractAPI extracts all functions from a ast.ContractDefinition. Remember that public top-level variables in Solidity export automatic getter functions. These functions are also part of the extracted API. typeMap is used to resolve type references in the process.

func ContractDefinitions

func ContractDefinitions(root ast.SourceUnit) []ast.ContractDefinition

ContractDefinitions extracts all ast.ContractDefinition's from an ast.SourceUnit.

func EnumType

func EnumType(path string, enumDefinition ast.EnumDefinition) (types.Named, error)

EnumType extracts a named types.Enum from an ast.EnumDefinition.

func EventType

func EventType(path string, eventDefinition ast.EventDefinition) (types.Named, error)

EventType extracts a named types.Event from an ast.EventDefinition.

func FunctionAPI

func FunctionAPI(functionDefinition ast.FunctionDefinition, typeMap types.Map) (types.Function, error)

FunctionAPI extracts an ast.FunctionDefinition's type information.

func MappingType

func MappingType(path string, mapping ast.Mapping) (types.Mapping, error)

MappingType extracts a types.Mapping from an ast.Mapping.

func Project

func Project(combined ast.Combined) (types.Project, error)

Project extracts an entire smart contract project's combined type information and structure. It will remove the longest shared path prefix among all source units (solidity files). E.g. files "a/x/b.sol" and "a/c.sol" will be referenced as "x/b.sol" and "c.sol", respectively. TODO: Windows support: normalize paths to forward slashes without drive letters, etc.

func StructType

func StructType(path string, structDefinition ast.StructDefinition) (types.Named, error)

StructType extracts a named types.Struct from an ast.StructDefinition.

func Type

func Type(path string, node ast.Node) (types.Type, error)

Type extracts type information from an AST node which may be any of: ast.ContractDefinition, ast.UserDefinedTypeName, ast.ElementaryTypeName, ast.ArrayTypeName, ast.EnumDefinition, ast.StructDefinition, ast.EventDefinition, ast.Mapping. It returns an error for everything else.

func Types

func Types(path string, root ast.SourceUnit) (types.Map, error)

Types extracts all type definitions and references from an ast.SourceUnit.

func VariableAPI

func VariableAPI(variableDeclaration ast.VariableDeclaration, typeMap types.Map) types.Function

VariableAPI extracts the generated getter function that public top-level contract variables get automatically in Solidity.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL