converter

package
v0.0.0-...-42c42d4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Complete

func Complete(src string, pos token.Pos, conf *Config) ([]string, int, int)

Complete returns a list of candidates of code completion.

func Format

func Format(src string) (string, error)

Format formats lgo src code like go fmt command.

func InspectIdent

func InspectIdent(src string, pos token.Pos, conf *Config) (doc, query string)

InspectIdent shows a document or a query for go doc command for the identifier at pos.

func SetLGOImporter

func SetLGOImporter(im types.Importer)

SetLGOImporter sets a global types.Importer used in this package. This method is used in cmd/lgo-internal to install missing .a files to the system.

func SetPackageArchiveInstaller

func SetPackageArchiveInstaller(i PackageArchiveInstaller)

SetPackageArchiveInstaller sets a global PackageArchiveInstaller used in the current process.

Types

type Config

type Config struct {
	Olds         []types.Object
	OldImports   []*types.PkgName
	DefPrefix    string
	RefPrefix    string
	LgoPkgPath   string
	AutoExitCode bool
	RegisterVars bool
}

A Config node controls the spec of Convert function.

type ConvertResult

type ConvertResult struct {
	Src     string
	Pkg     *types.Package
	Checker *types.Checker
	Imports []*types.PkgName
	// A list of package paths imported in the final Src.
	FinalDeps []string

	Err error
}

A ConvertResult is a result of code conversion by Convert.

func Convert

func Convert(src string, conf *Config) *ConvertResult

Convert converts a lgo source to a valid Go source.

type ErrorList

type ErrorList []error

ErrorList is a list of *Errors. The zero value for an ErrorList is an empty ErrorList ready to use.

func (*ErrorList) Add

func (p *ErrorList) Add(err error)

Add adds an Error with given position and error message to an ErrorList.

func (ErrorList) Error

func (p ErrorList) Error() string

An ErrorList implements the error interface.

type PackageArchiveInstaller

type PackageArchiveInstaller interface {
	Install(pkgs []string) error
}

PackageArchiveInstaller is the interface that is used to install .a files of packages used in lgo code before static code analysis.

Jump to

Keyboard shortcuts

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