Documentation
¶
Index ¶
- Constants
- func BuildDir(ctx *ixgo.Context, dir string) (data []byte, err error)
- func BuildFSDir(ctx *ixgo.Context, fs parser.FileSystem, dir string) (data []byte, err error)
- func BuildFile(ctx *ixgo.Context, filename string, src interface{}) (data []byte, err error)
- func ClassInfo(fname string) (autoLambdas map[string]int, isProj, ok bool)
- func ClassKind(fname string) (isProj, ok bool)
- func RegisterClassFileType(ext string, class string, works []*modfile.Class, pkgPaths ...string) *modfile.Project
- func RegisterPackagePatch(ctx *ixgo.Context, path string, src interface{}) error
- func RegisterProject(proj *modfile.Project)
- type Class
- type Context
- func (c *Context) BuildFSDir(fs parser.FileSystem, dir string) (data []byte, err error)
- func (c *Context) Import(path string) (*types.Package, error)
- func (c *Context) LoadPackages(apkgs map[string]*ast.Package) (*Package, error)
- func (c *Context) ParseDir(dir string) (*Package, error)
- func (c *Context) ParseFSDir(fs parser.FileSystem, dir string) (*Package, error)
- func (c *Context) ParseFile(fname string, src interface{}) (*Package, error)
- func (c *Context) ParseFiles(files []string) (*Package, error)
- type Import
- type Package
- type Project
Constants ¶
const ( // StaticLoad is a mode flag that disables dynamic Importer creation. // When StaticLoad is set, the Context will use only the base Loader // for package imports instead of creating a dynamic ixgo.Importer. // This mode is useful for scenarios where all packages are pre-loaded // or when dynamic importing is not needed. StaticLoad = ixgo.LastMode * 2 // NormalizeExport is a mode flag that normalizes package patch exports. // When NormalizeExport is set, objects from package patches are re-exported // with the base package as their owner, rather than the patch package. // This allows patch symbols to appear as if they belong to the original package // (e.g., gsh.Point instead of gsh@patch.Point), providing a cleaner API. NormalizeExport = ixgo.LastMode * 4 )
Variables ¶
This section is empty.
Functions ¶
func BuildFSDir ¶
BuildFSDir compiles the XGo package in dir using the registered classfiles.
func ClassInfo ¶ added in v1.1.4
ClassInfo describes a file according to the package-level class registrations.
func RegisterClassFileType ¶
func RegisterPackagePatch ¶
func RegisterProject ¶
Types ¶
type Context ¶
type Context struct {
Context *ixgo.Context
FileSet *token.FileSet
Importer types.Importer
Loader ixgo.Loader
// LookupClass resolves a classfile extension to its project for parsing
// and compilation. Its results must stay consistent throughout a build.
//
// A non-nil lookup supplies all classfile definitions for the context.
// Returning false leaves the extension unregistered.
// A nil lookup uses the registrations from [RegisterProject] and
// [RegisterClassFileType].
LookupClass func(ext string) (*Project, bool)
// contains filtered or unexported fields
}
Context parses and compiles XGo packages for an interpreter.
func NewContext ¶
func (*Context) BuildFSDir ¶ added in v1.2.11
BuildFSDir generates Go source for the XGo package in dir using the context's class lookup. Compilation panics are returned as errors.