loader

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Package

type Package struct {
	Pkg          *types.Package // 类型检查后的包
	Info         *types.Info    // 包的类型检查信息
	Files        []*ast.File    // AST语法树
	WsFiles      []*WsFile      // 汇编代码
	WImportFiles []*WhostFile   // 宿主代码文件

	SSAPkg   *ssa.Package
	TestInfo *TestInfo
}

单个包对象

type Program

type Program struct {
	Cfg      *config.Config   // 配置信息
	Manifest *config.Manifest // 主包信息

	Fset *token.FileSet
	Pkgs map[string]*Package

	SSAProgram *ssa.Program
	SSAMainPkg *ssa.Package
}

程序对象 包含程序需要的全部信息

func LoadProgram

func LoadProgram(cfg *config.Config, appPath string) (*Program, error)

加载程序 入口 appPath 是包对应目录的路径

func LoadProgramFile

func LoadProgramFile(cfg *config.Config, filename string, src interface{}) (*Program, error)

加载单文件程序 入口 appPath 是包对应目录的路径

func LoadProgramVFS

func LoadProgramVFS(vfs *config.PkgVFS, cfg *config.Config, pkgPath string) (*Program, error)

基于 VFS 加载程序 入口 pkgPath 是包路径, 必须是 vfs.App 子包

func (*Program) DebugString added in v0.7.0

func (p *Program) DebugString() string

func (*Program) GetPkgPathList added in v0.7.0

func (p *Program) GetPkgPathList() []string

type TestFuncInfo added in v0.7.0

type TestFuncInfo struct {
	FuncPos     token.Pos // 函数位置
	Name        string    // 函数名, 不含包路径
	Output      string    // 期望输出, 为空表示不验证
	OutputPanic bool      // 异常信息
}

测试函数信息

type TestInfo added in v0.5.1

type TestInfo struct {
	Files    []string // 测试文件
	Tests    []TestFuncInfo
	Benchs   []TestFuncInfo
	Examples []TestFuncInfo
}

单元测试信息

type WhostFile added in v0.9.0

type WhostFile struct {
	Name string // 文件名
	Code string // 宿主代码
}

宿主代码文件

type WsFile added in v0.6.0

type WsFile struct {
	Name string // 文件名
	Code string // 汇编代码
}

汇编代码文件

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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