Expose package name of a compiled source

Exposing package name of the compiled source allows using it in `Eval`, as well as in logs and for other purposes.
This commit is contained in:
Denys Smirnov
2022-11-07 17:22:12 +02:00
committed by GitHub
parent 7bb8b4631f
commit 97cf8c4210

View File

@@ -17,6 +17,11 @@ type Program struct {
init []*node
}
// PackageName returns name used in a package clause.
func (p *Program) PackageName() string {
return p.pkgName
}
// FileSet is the fileset that must be used for parsing Go that will be passed
// to interp.CompileAST().
func (interp *Interpreter) FileSet() *token.FileSet {