impl

package
v0.0.0-...-1cdaf33 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrMethodExists

type ErrMethodExists struct {
	Wanted Func
	Exists ast.FuncDecl
}

ErrMethodExists will be returned when a method should be created but an existing method already exists for the given receiver.

func (*ErrMethodExists) Error

func (e *ErrMethodExists) Error() string

type Func

type Func struct {
	Name   string
	Params []Param
	Res    []Param
}

Func represents a function signature.

type Implementer

type Implementer struct {
	Recv, IFace, Dir string
	// contains filtered or unexported fields
}

An Implementer can, for a certain directory, create and/or update implementation with Go source code for a particular interface

func (*Implementer) GenForPosition

func (i *Implementer) GenForPosition(p *token.Position) ([]byte, error)

GenForPosition allows users to have more flexible stub generation, with the ability to specify exactly where the implementation should be generated. If the token.Position argument is nil, the generated code will be inserted immediately after the receiving type's declaration.

func (*Implementer) GenStubs

func (i *Implementer) GenStubs() ([]byte, error)

GenStubs prints nicely formatted method stubs for fns using receiver expression recv. If the Implementer is not in a valid state, or an error occurs, the error will be returned.

func (*Implementer) Position

func (i *Implementer) Position() (*token.Position, error)

Position returns, if found, the token.Position of the end of the type declaration for the specified receiver.

func (*Implementer) Visit

func (i *Implementer) Visit(node ast.Node) (w ast.Visitor)

Visit implements ast.Visit

type Method

type Method struct {
	Recv string
	Func
}

Method represents a method signature.

type Param

type Param struct {
	Name string
	Type string
}

Param represents a parameter in a function or method signature.

type Pkg

type Pkg struct {
	*build.Package
	*token.FileSet
}

Pkg is a parsed build.Package.

Jump to

Keyboard shortcuts

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