runtime

package
v0.3.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SharedIndex = newSharedIndex()

SharedIndex is used for indexing builtins and any other labels common to all instances.

View Source
var SharedIndexNew = newSharedIndex()
View Source
var SharedRuntimeNew = &Runtime{index: SharedIndexNew}

Functions

func ResolveFile

func ResolveFile(
	idx *Index,
	f *ast.File,
	p *build.Instance,
	allFields map[string]ast.Node,
	isBuiltin func(s string) bool,
) errors.Error

func ResolveFiles

func ResolveFiles(
	idx *Index,
	p *build.Instance,
	isBuiltin func(s string) bool,
) (errs errors.Error)

Types

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index maps conversions from label names to internal codes.

All instances belonging to the same package should share this Index.

INDEX IS A TRANSITIONAL TYPE TO BRIDGE THE OLD AND NEW IMPLEMENTATIONS. USE RUNTIME.

func NewIndex

func NewIndex(parent *Index) *Index

NewIndex creates a new index.

func (*Index) AddInst

func (x *Index) AddInst(path string, key, p interface{})

func (*Index) GetImportFromNode

func (x *Index) GetImportFromNode(key interface{}) interface{}

func (*Index) GetImportFromPath

func (x *Index) GetImportFromPath(id string) interface{}

func (*Index) HasLabel

func (x *Index) HasLabel(s string) (ok bool)

func (*Index) IndexToString

func (x *Index) IndexToString(i int64) string

func (*Index) Label

func (x *Index) Label(s string, isIdent bool) adt.Feature

func (*Index) LabelStr

func (idx *Index) LabelStr(l adt.Feature) string

func (*Index) LoadType

func (x *Index) LoadType(t reflect.Type) (v interface{}, ok bool)

func (*Index) NodeLabel

func (x *Index) NodeLabel(n ast.Node) (f adt.Feature, ok bool)

func (*Index) StoreType

func (x *Index) StoreType(t reflect.Type, v interface{})

func (*Index) StrLabel

func (x *Index) StrLabel(str string) adt.Feature

func (*Index) StringToIndex

func (x *Index) StringToIndex(s string) int64

type Runtime

type Runtime struct {

	// Data holds the legacy index strut. It is for transitional purposes only.
	Data interface{}
	// contains filtered or unexported fields
}

A Runtime maintains data structures for indexing and resuse for evaluation.

func New

func New() *Runtime

New creates a new Runtime.

func NewWithIndex

func NewWithIndex(x *Index) *Runtime

func (*Runtime) Build

func (x *Runtime) Build(b *build.Instance) (v *adt.Vertex, errs errors.Error)

func (*Runtime) IndexToString

func (x *Runtime) IndexToString(i int64) string

func (*Runtime) LoadImport

func (x *Runtime) LoadImport(importPath string) (*adt.Vertex, errors.Error)

func (*Runtime) LoadType

func (x *Runtime) LoadType(t reflect.Type) (src ast.Expr, expr adt.Expr, ok bool)

func (*Runtime) StoreType

func (x *Runtime) StoreType(t reflect.Type, src ast.Expr, expr adt.Expr)

func (*Runtime) StringToIndex

func (x *Runtime) StringToIndex(s string) int64

Jump to

Keyboard shortcuts

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