loader

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: BSD-3-Clause Imports: 27 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCachedGoroot added in v0.14.0

func GetCachedGoroot(config *compileopts.Config) (string, error)

GetCachedGoroot creates a new GOROOT by merging both the standard GOROOT and the GOROOT from TinyGo using lots of symbolic links.

Types

type Errors

type Errors struct {
	Pkg  *Package
	Errs []error
}

Errors contains a list of parser errors or a list of typechecker errors for the given package.

func (Errors) Error

func (e Errors) Error() string

type Package

type Package struct {
	*Program
	*packages.Package
	Files []*ast.File
	Pkg   *types.Package
	types.Info
}

Package holds a loaded package, its imports, and its parsed files.

func (*Package) Check

func (p *Package) Check() error

Check runs the package through the typechecker. The package must already be loaded and all dependencies must have been checked already.

Idempotent.

func (*Package) Import

func (p *Package) Import(to string) (*types.Package, error)

Import implements types.Importer. It loads and parses packages it encounters along the way, if needed.

func (*Package) Parse

func (p *Package) Parse() error

Parse parses and typechecks this package.

Idempotent.

type Program

type Program struct {
	Build    *build.Context
	Tests    bool
	Packages map[string]*Package
	MainPkg  *Package

	TypeChecker  types.Config
	Dir          string // current working directory (for error reporting)
	TINYGOROOT   string // root of the TinyGo installation or root of the source code
	CFlags       []string
	LDFlags      []string
	ClangHeaders string
	// contains filtered or unexported fields
}

Program holds all packages and some metadata about the program as a whole.

func (*Program) Load added in v0.14.0

func (p *Program) Load(importPath string) error

Load loads the given package with all dependencies (including the runtime package). Call .Parse() afterwards to parse all Go files (including CGo processing, if necessary).

func (*Program) LoadSSA

func (p *Program) LoadSSA() *ssa.Program

LoadSSA constructs the SSA form of the loaded packages.

The program must already be parsed and type-checked with the .Parse() method.

func (*Program) Parse

func (p *Program) Parse() error

Parse parses all packages and typechecks them.

The returned error may be an Errors error, which contains a list of errors.

Idempotent.

func (*Program) Sorted

func (p *Program) Sorted() []*Package

Sorted returns a list of all packages, sorted in a way that no packages come before the packages they depend upon.

Jump to

Keyboard shortcuts

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