compiler

package
v0.0.0-...-5a170ab Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

This package implements the BeeHive compiler that automatically generates Map functions by inspecting event handlers of applications. This compiler is simplistic and supports a few, common scenarios.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoHandler = errors.New("compiler: no handler provided")
)

Functions

func GenerateMap

func GenerateMap(w io.Writer, handlers []*Handler) error

Generates map function for the given handlers into the writer. Handlers must be all of the same package.

Types

type Handler

type Handler struct {
	Type    ast.Expr          // Type of the handler.
	Rcv     *ast.FuncDecl     // Rcv function of the handler. Cannot be nil.
	Map     *ast.FuncDecl     // Map function of the handler. Can be nil.
	Imports map[string]string // Packages that must be imported for mapping.
	Package string            // Package name of this handler.
}

Represents a message handler.

func HandlersInDir

func HandlersInDir(fset *token.FileSet, path string) ([]*Handler, error)

func HandlersInPackage

func HandlersInPackage(pkg *ast.Package) ([]*Handler, error)

Finds all the event handlers declared in package.

Jump to

Keyboard shortcuts

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