Documentation ¶
Index ¶
- Variables
- func RegisterBuiltin(importPath string, f PackageFunc)
- type Compiler
- type Config
- type Interpreter
- type PackageFunc
- type Runtime
- func (r *Runtime) AddInst(path string, key *adt.Vertex, p *build.Instance)
- func (x *Runtime) Build(cfg *Config, b *build.Instance) (v *adt.Vertex, errs errors.Error)
- func (r *Runtime) BuildData(b *build.Instance) (x interface{}, ok bool)
- func (x *Runtime) BuiltinPackagePath(path string) string
- func (r *Runtime) Compile(cfg *Config, source interface{}) (*adt.Vertex, *build.Instance)
- func (r *Runtime) CompileFile(cfg *Config, file *ast.File) (*adt.Vertex, *build.Instance)
- func (r *Runtime) GetInstanceFromNode(key *adt.Vertex) *build.Instance
- func (r *Runtime) IndexToString(i int64) string
- func (r *Runtime) Init()
- func (r *Runtime) IsInitialized() bool
- func (r *Runtime) Label(s string, isIdent bool) adt.Feature
- func (r *Runtime) LabelStr(l adt.Feature) string
- func (r *Runtime) LoadImport(importPath string) *adt.Vertex
- func (x *Runtime) LoadType(t reflect.Type) (src ast.Expr, expr adt.Expr, ok bool)
- func (r *Runtime) NextUniqueID() uint64
- func (r *Runtime) ResolveFiles(p *build.Instance) (errs errors.Error)
- func (r *Runtime) SetBuildData(b *build.Instance, x interface{})
- func (r *Runtime) SetInterpreter(i Interpreter)
- func (x *Runtime) StoreType(t reflect.Type, src ast.Expr, expr adt.Expr)
- func (r *Runtime) StrLabel(str string) adt.Feature
- func (r *Runtime) StringToIndex(s string) int64
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func RegisterBuiltin ¶
func RegisterBuiltin(importPath string, f PackageFunc)
Types ¶
type Compiler ¶ added in v0.6.0
type Compiler interface { // Compile creates a builtin for the given function name and attribute. // funcName is the name of the function to compile, taken from altName in // @extern(name=altName), or from the field name if that's not defined. // Other than "name", the fields in a are implementation specific. Compile(funcName string, a *internal.Attr) (*adt.Builtin, errors.Error) }
A Compiler composes an adt.Builtin for an external function implementation.
type Interpreter ¶ added in v0.6.0
type Interpreter interface { // NewCompiler creates a compiler for b and reports any errors. NewCompiler(b *build.Instance) (Compiler, errors.Error) // Kind returns the string to be used in the file-level @extern attribute. Kind() string }
Interpreter defines an entrypoint for creating per-package interpreters.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
A Runtime maintains data structures for indexing and reuse for evaluation.
func New ¶
func New() *Runtime
New creates a new Runtime. The builtins registered with RegisterBuiltin are available for
func (*Runtime) Build ¶
Build builds b and all its transitive dependencies, insofar they have not been build yet.
func (*Runtime) BuiltinPackagePath ¶ added in v0.4.0
BuiltinPackagePath converts a short-form builtin package identifier to its full path or "" if this doesn't exist.
func (*Runtime) CompileFile ¶ added in v0.4.0
func (*Runtime) GetInstanceFromNode ¶
func (*Runtime) IndexToString ¶
func (*Runtime) IsInitialized ¶ added in v0.6.0
IsInitialized reports whether the runtime has been initialized.
func (*Runtime) NextUniqueID ¶ added in v0.5.0
func (*Runtime) ResolveFiles ¶
TODO(resolve): this is also done in compile, do we need both?
func (*Runtime) SetBuildData ¶ added in v0.4.0
func (*Runtime) SetInterpreter ¶ added in v0.6.0
func (r *Runtime) SetInterpreter(i Interpreter)
SetInterpreter sets the interpreter for interpretation of files marked with @extern(kind).