fn

package
Version: v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fn provides the Analyser interface for functions and supporting utils.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilMeth      = errors.New("interface method is nil")
	ErrNilImpl      = errors.New("interface implementation is nil")
	ErrAbstractMeth = errors.New("interface method is abstract")
)

Functions

func FindConcrete

func FindConcrete(prog *ssa.Program, fn *ssa.Function) *ssa.Function

FindConcrete finds the concrete version of a given ssa.Function by unwrapping the synthetic wrappers of fn.

func LookupImpl

func LookupImpl(prog *ssa.Program, meth *types.Func, impl ssa.Value) (*ssa.Function, error)

LookupImpl finds an implementation Function of a given interface/abstract type. Return function is not guaranteed to be concrete, use FindConcrete on the results to get a concrete function.

Types

type Analyser

type Analyser interface {
	// EnterFunc analyses a Function.
	EnterFunc(fn *ssa.Function)

	// ExitFunc finishes analysing a Function.
	// It should be used for cleanup etc.
	ExitFunc(fn *ssa.Function)
}

Analyser is an interface for Function analysis, handles function entry and exit.

type DoesNotImplError

type DoesNotImplError struct {
	Iface *types.Interface
	Impl  ssa.Value
}

DoesNotImplError is the error when a supplied implementation Impl does not implement an interface Iface.

type MethNotFoundError

type MethNotFoundError struct {
	Iface *types.Interface // Interface to look in.
	Meth  *types.Func      // Expected method signature.
}

MethNotFoundError is the error when an interface Iface is implemented without method Meth.

func (MethNotFoundError) Error

func (e MethNotFoundError) Error() string

type MethTypeError

type MethTypeError struct {
	Iface *types.Interface // Interface to implement.
	Meth  *types.Func      // Method of the interface.
	Impl  *types.Func      // Implemented method.
}

MethTypeError is the error when interface Iface with method Meth is implemented as Impl with a wrong type. See also go/types.MissingMethod.

func (MethTypeError) Error

func (e MethTypeError) Error() string

type UnknownInvokeError

type UnknownInvokeError struct {
	Iface *types.Interface
	Impl  ssa.Value
}

func (UnknownInvokeError) Error

func (e UnknownInvokeError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to