compiler

package
v0.0.0-...-e241fc3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2017 License: BSD-2-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteArchive

func WriteArchive(a *Archive, w io.Writer) error

func WritePkgCode

func WritePkgCode(pkg *Archive, dceSelection map[*Decl]struct{}, minify bool, w *SourceMapFilter) error

func WriteProgramCode

func WriteProgramCode(pkgs []*Archive, w *SourceMapFilter) error

Types

type Archive

type Archive struct {
	ImportPath   string
	Name         string
	Imports      []string
	ExportData   []byte
	Declarations []*Decl
	IncJSCode    []byte
	FileSet      []byte
	Minified     bool
}

func Compile

func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, importContext *ImportContext, minify bool) (*Archive, error)

func ImportDependencies

func ImportDependencies(archive *Archive, importPkg func(string) (*Archive, error)) ([]*Archive, error)

func ReadArchive

func ReadArchive(filename, path string, r io.Reader, packages map[string]*types.Package) (*Archive, error)

type Decl

type Decl struct {
	FullName        string
	Vars            []string
	DeclCode        []byte
	MethodListCode  []byte
	TypeInitCode    []byte
	InitCode        []byte
	DceObjectFilter string
	DceMethodFilter string
	DceDeps         []string
	Blocking        bool
}

type Dependency

type Dependency struct {
	Pkg    string
	Type   string
	Method string
}

type ErrorList

type ErrorList []error

func (ErrorList) Error

func (err ErrorList) Error() string

type ImportContext

type ImportContext struct {
	Packages map[string]*types.Package
	Import   func(string) (*Archive, error)
}

type SourceMapFilter

type SourceMapFilter struct {
	Writer          io.Writer
	MappingCallback func(generatedLine, generatedColumn int, originalPos token.Position)
	// contains filtered or unexported fields
}

func (*SourceMapFilter) Write

func (f *SourceMapFilter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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