compiler

package
v0.0.0-...-06d07da Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2015 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