Documentation ¶
Index ¶
- type Emulator
- func (e *Emulator) AddFunctionDefinition(function *sources.Function)
- func (e *Emulator) AddStructDeclaration(_struct *sources.Struct)
- func (e *Emulator) Emit(subject string, event *Event)
- func (e *Emulator) Eval(expr *sources.Expression) []*Value
- func (e *Emulator) FindVariable(name string) *Variable
- func (e *Emulator) MustFindVariable(name string) *Variable
- func (e *Emulator) MustResolveIdentifier(name string) *Value
- func (e *Emulator) MustSetVariable(name string, value *Value)
- func (e Emulator) OnEvent(subject string, handler func(*Event))
- func (e *Emulator) Recover(tokens sources.Tokens)
- func (e *Emulator) Reset()
- func (e *Emulator) ResetFunctions()
- func (e *Emulator) ResetStack()
- func (e *Emulator) ResetStorage()
- func (e *Emulator) ResetStructs()
- func (e *Emulator) ResolveIdentifier(name string) *Value
- func (e *Emulator) Run()
- func (e *Emulator) SetVariable(variable *Variable)
- type Event
- type Stack
- type StackFrame
- type Value
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Emulator ¶
type Emulator struct { ErrorCount uint // contains filtered or unexported fields }
Emulator is a Solidity emulator.
func (*Emulator) AddFunctionDefinition ¶
AddFunctionDefinition adds a function definition.
func (*Emulator) AddStructDeclaration ¶
AddStructDeclaration adds a struct declaration.
func (*Emulator) Eval ¶
func (e *Emulator) Eval(expr *sources.Expression) []*Value
Eval evaluates an expression, returning a new expression.
func (*Emulator) FindVariable ¶
FindVariable attempts to find and return a variable.
func (*Emulator) MustFindVariable ¶
MustFindVariable must return a variable, otherwise the emulator panics.
func (*Emulator) MustResolveIdentifier ¶
MustResolveIdentifier must return a value, otherwise the emulator panics.
func (*Emulator) MustSetVariable ¶
MustSetVariable must find and set a variable, otherwise the emulator panics.
func (*Emulator) ResetFunctions ¶
func (e *Emulator) ResetFunctions()
ResetFunctions resets function definitions.
func (*Emulator) ResetStructs ¶
func (e *Emulator) ResetStructs()
ResetStructs resets struct declarations.
func (*Emulator) ResolveIdentifier ¶
ResolveIdentifier attempts to resolve an identifier's value.
func (*Emulator) SetVariable ¶
SetVariable sets a new variable.
type Event ¶
type Event struct { Source *sources.Source Stack *Stack Contract *sources.Contract Function *sources.Function CallerFunction *sources.Function Expression *sources.Expression Expressions []*sources.Expression FunctionCallArguments *sources.FunctionCallArguments }
Event is an event emitted by the emulator.
type Stack ¶
type Stack []*StackFrame
func (*Stack) CurrentFrame ¶
func (s *Stack) CurrentFrame() *StackFrame
func (*Stack) Pop ¶
func (s *Stack) Pop() *StackFrame
type StackFrame ¶
type Value ¶
type Value struct { Solved bool Expression *sources.Expression }
Value represents a value.
func (Value) InferredTypeName ¶
InferredTypeName returns the inferred type name of a value.