Documentation
¶
Overview ¶
Package vm contains the Elk Virtual Machine. It interprets Elk Bytecode produced by the Elk compiler.
Package vm contains the Elk Virtual Machine. It interprets Elk Bytecode produced by the Elk compiler.
Index ¶
- Constants
- Variables
- func Accessor(container *value.MethodContainer, attrName string)
- func Alias(container *value.MethodContainer, newName, oldName string)
- func ArrayListContains(vm *Thread, list *value.ArrayList, val value.Value) (bool, value.Value)
- func ArrayListEqual(vm *Thread, x, y *value.ArrayList) (bool, value.Value)
- func ArrayTupleContains(vm *Thread, tuple *value.ArrayTuple, val value.Value) (bool, value.Value)
- func ArrayTupleEqual(vm *Thread, x, y *value.ArrayTuple) (bool, value.Value)
- func BeginlessClosedRangeContains(vm *Thread, r *value.BeginlessClosedRange, val value.Value) (bool, value.Value)
- func BeginlessClosedRangeEqual(vm *Thread, x, y *value.BeginlessClosedRange) (bool, value.Value)
- func BeginlessOpenRangeContains(vm *Thread, r *value.BeginlessOpenRange, val value.Value) (bool, value.Value)
- func BeginlessOpenRangeEqual(vm *Thread, x, y *value.BeginlessOpenRange) (bool, value.Value)
- func ClosedRangeContains(vm *Thread, r *value.ClosedRange, val value.Value) (bool, value.Value)
- func ClosedRangeEqual(vm *Thread, x *value.ClosedRange, y *value.ClosedRange) (bool, value.Value)
- func ClosedRangeIteratorNext(vm *Thread, i *value.ClosedRangeIterator) (value.Value, value.Value)
- func Decrement(vm *Thread, val value.Value) (value.Value, value.Value)
- func Def(container *value.MethodContainer, name string, function NativeFunction, ...)
- func DefineAccessor(container *value.MethodContainer, attrName value.Symbol, index int)
- func DefineGetter(container *value.MethodContainer, name value.Symbol, index int)
- func DefineNativeMethod(container *value.MethodContainer, name value.Symbol, params int, optParams int, ...) (err value.Value)
- func DefineSetter(container *value.MethodContainer, attrName value.Symbol, index int)
- func EndlessClosedRangeContains(vm *Thread, r *value.EndlessClosedRange, val value.Value) (bool, value.Value)
- func EndlessClosedRangeEqual(vm *Thread, x *value.EndlessClosedRange, y *value.EndlessClosedRange) (bool, value.Value)
- func EndlessClosedRangeIteratorNext(vm *Thread, i *value.EndlessClosedRangeIterator) (value.Value, value.Value)
- func EndlessOpenRangeContains(vm *Thread, r *value.EndlessOpenRange, val value.Value) (bool, value.Value)
- func EndlessOpenRangeEqual(vm *Thread, x, y *value.EndlessOpenRange) (bool, value.Value)
- func EndlessOpenRangeIteratorNext(vm *Thread, i *value.EndlessOpenRangeIterator) (value.Value, value.Value)
- func Equal(vm *Thread, left, right value.Value) (value.Value, value.Value)
- func Getter(container *value.MethodContainer, name string)
- func GreaterThan(vm *Thread, left, right value.Value) (value.Value, value.Value)
- func GreaterThanEqual(vm *Thread, left, right value.Value) (value.Value, value.Value)
- func Hash(vm *Thread, key value.Value) (value.UInt64, value.Value)
- func HashMapConcat(vm *Thread, x *value.HashMap, y *value.HashMap) (*value.HashMap, value.Value)
- func HashMapContains(vm *Thread, hashMap *value.HashMap, pair *value.Pair) (bool, value.Value)
- func HashMapContainsKey(vm *Thread, hashMap *value.HashMap, key value.Value) (bool, value.Value)
- func HashMapContainsValue(vm *Thread, hashMap *value.HashMap, val value.Value) (bool, value.Value)
- func HashMapCopy(vm *Thread, target *value.HashMap, source *value.HashMap) value.Value
- func HashMapCopyTable(vm *Thread, target *value.HashMap, source []value.Pair) value.Value
- func HashMapDelete(vm *Thread, hashMap *value.HashMap, key value.Value) (bool, value.Value)
- func HashMapEqual(vm *Thread, x *value.HashMap, y *value.HashMap) (bool, value.Value)
- func HashMapGet(vm *Thread, hashMap *value.HashMap, key value.Value) (value.Value, value.Value)
- func HashMapGrow(vm *Thread, hashMap *value.HashMap, newSlots int) value.Value
- func HashMapIndex(vm *Thread, hashMap *value.HashMap, key value.Value) (int, value.Value)
- func HashMapLaxEqual(vm *Thread, x *value.HashMap, y *value.HashMap) (bool, value.Value)
- func HashMapSet(vm *Thread, hashMap *value.HashMap, key, val value.Value) value.Value
- func HashMapSetCapacity(vm *Thread, hashMap *value.HashMap, capacity int) value.Value
- func HashMapSetWithMaxLoad(vm *Thread, hashMap *value.HashMap, key, val value.Value, maxLoad float64) value.Value
- func HashRecordConcat(vm *Thread, x *value.HashRecord, y *value.HashRecord) (*value.HashMap, value.Value)
- func HashRecordContains(vm *Thread, hrec *value.HashRecord, pair *value.Pair) (bool, value.Value)
- func HashRecordContainsKey(vm *Thread, hrec *value.HashRecord, key value.Value) (bool, value.Value)
- func HashRecordContainsValue(vm *Thread, hrec *value.HashRecord, val value.Value) (bool, value.Value)
- func HashRecordCopy(vm *Thread, target *value.HashRecord, source *value.HashRecord) value.Value
- func HashRecordCopyTable(vm *Thread, target *value.HashRecord, source []value.Pair) value.Value
- func HashRecordDelete(vm *Thread, hashRecord *value.HashRecord, key value.Value) (bool, value.Value)
- func HashRecordEqual(vm *Thread, x *value.HashRecord, y *value.HashRecord) (bool, value.Value)
- func HashRecordGet(vm *Thread, hashRecord *value.HashRecord, key value.Value) (value.Value, value.Value)
- func HashRecordGrow(vm *Thread, hashRecord *value.HashRecord, newSlots int) value.Value
- func HashRecordLaxEqual(vm *Thread, x *value.HashRecord, y *value.HashRecord) (bool, value.Value)
- func HashRecordSet(vm *Thread, hashRecord *value.HashRecord, key, val value.Value) value.Value
- func HashRecordSetCapacity(vm *Thread, hashRecord *value.HashRecord, capacity int) value.Value
- func HashRecordSetWithMaxLoad(vm *Thread, hashRecord *value.HashRecord, key, val value.Value, ...) value.Value
- func HashSetAppend(vm *Thread, set *value.HashSet, val value.Value) value.Value
- func HashSetAppendWithMaxLoad(vm *Thread, set *value.HashSet, val value.Value, maxLoad float64) value.Value
- func HashSetContains(vm *Thread, set *value.HashSet, val value.Value) (bool, value.Value)
- func HashSetCopy(vm *Thread, target *value.HashSet, source *value.HashSet) value.Value
- func HashSetCopyTable(vm *Thread, target *value.HashSet, source []value.Value) value.Value
- func HashSetDelete(vm *Thread, hashSet *value.HashSet, val value.Value) (bool, value.Value)
- func HashSetEqual(vm *Thread, x *value.HashSet, y *value.HashSet) (bool, value.Value)
- func HashSetGrow(vm *Thread, set *value.HashSet, newSlots int) value.Value
- func HashSetIndex(vm *Thread, set *value.HashSet, val value.Value) (int, value.Value)
- func HashSetIntersection(vm *Thread, x *value.HashSet, y *value.HashSet) (*value.HashSet, value.Value)
- func HashSetSetCapacity(vm *Thread, set *value.HashSet, capacity int) value.Value
- func HashSetUnion(vm *Thread, x *value.HashSet, y *value.HashSet) (*value.HashSet, value.Value)
- func Increment(vm *Thread, val value.Value) (value.Value, value.Value)
- func InitGlobalEnvironment()
- func Inspect(vm *Thread, val value.Value) (value.Value, value.Value)
- func InspectWithColor(vm *Thread, val value.Value) (string, value.Value)
- func Iterate(vm *Thread, collectionValue value.Value) iter.Seq2[value.Value, value.Value]
- func LaxEqual(vm *Thread, left, right value.Value) (value.Value, value.Value)
- func LeftOpenRangeContains(vm *Thread, r *value.LeftOpenRange, val value.Value) (bool, value.Value)
- func LeftOpenRangeEqual(vm *Thread, x, y *value.LeftOpenRange) (bool, value.Value)
- func LeftOpenRangeIteratorNext(vm *Thread, i *value.LeftOpenRangeIterator) (value.Value, value.Value)
- func LessThan(vm *Thread, left, right value.Value) (value.Value, value.Value)
- func LessThanEqual(vm *Thread, left, right value.Value) (value.Value, value.Value)
- func MustNewHashMapWithCapacityAndElements(vm *Thread, capacity int, elements ...value.Pair) *value.HashMap
- func MustNewHashMapWithElements(vm *Thread, elements ...value.Pair) *value.HashMap
- func MustNewHashRecordWithCapacityAndElements(vm *Thread, capacity int, elements ...value.Pair) *value.HashRecord
- func MustNewHashRecordWithElements(vm *Thread, elements ...value.Pair) *value.HashRecord
- func MustNewHashSetWithCapacityAndElements(vm *Thread, capacity int, elements ...value.Value) *value.HashSet
- func MustNewHashSetWithCapacityAndElementsMaxLoad(vm *Thread, capacity int, maxLoad float64, elements ...value.Value) *value.HashSet
- func MustNewHashSetWithElements(vm *Thread, elements ...value.Value) *value.HashSet
- func NewHashMapComparer(opts *cmp.Options) cmp.Option
- func NewHashMapWithCapacityAndElements(vm *Thread, capacity int, elements ...value.Pair) (*value.HashMap, value.Value)
- func NewHashMapWithElements(vm *Thread, elements ...value.Pair) (*value.HashMap, value.Value)
- func NewHashRecordComparer(opts *cmp.Options) cmp.Option
- func NewHashRecordWithCapacityAndElements(vm *Thread, capacity int, elements ...value.Pair) (*value.HashRecord, value.Value)
- func NewHashRecordWithElements(vm *Thread, elements ...value.Pair) (*value.HashRecord, value.Value)
- func NewHashSetComparer(opts *cmp.Options) cmp.Option
- func NewHashSetWithCapacityAndElements(vm *Thread, capacity int, elements ...value.Value) (*value.HashSet, value.Value)
- func NewHashSetWithCapacityAndElementsMaxLoad(vm *Thread, capacity int, maxLoad float64, elements ...value.Value) (*value.HashSet, value.Value)
- func NewHashSetWithElements(vm *Thread, elements ...value.Value) (*value.HashSet, value.Value)
- func NewNativeMethodComparer() cmp.Option
- func NextBuiltin(vm *Thread, val value.Value) (result, err value.Value)
- func ObjectHash(val value.Value) value.UInt64
- func OnceDo(vm *Thread, once *value.Once, fn value.Value) (err value.Value)
- func OpenRangeContains(vm *Thread, r *value.OpenRange, val value.Value) (bool, value.Value)
- func OpenRangeEqual(vm *Thread, x *value.OpenRange, y *value.OpenRange) (bool, value.Value)
- func OpenRangeIteratorNext(vm *Thread, i *value.OpenRangeIterator) (value.Value, value.Value)
- func PairEqual(vm *Thread, x *value.Pair, y *value.Pair) (bool, value.Value)
- func PrintError(stderr io.Writer, stackTrace *value.StackTrace, err value.Value)
- func RightOpenRangeContains(vm *Thread, r *value.RightOpenRange, val value.Value) (bool, value.Value)
- func RightOpenRangeEqual(vm *Thread, x, y *value.RightOpenRange) (bool, value.Value)
- func RightOpenRangeIteratorNext(vm *Thread, i *value.RightOpenRangeIterator) (value.Value, value.Value)
- func Setter(container *value.MethodContainer, attrName string)
- func SubscriptBuiltin(vm *Thread, collection, key value.Value) (result, err value.Value)
- func SubscriptSetBuiltin(vm *Thread, collection, key, val value.Value) (err value.Value)
- type BytecodeFunction
- func NewBytecodeFunction(name value.Symbol, instruct []byte, loc *position.Location, ...) *BytecodeFunction
- func NewBytecodeFunctionNoParams(name value.Symbol, instruct []byte, loc *position.Location, ...) *BytecodeFunction
- func NewBytecodeFunctionSimple(name value.Symbol, instruct []byte, loc *position.Location) *BytecodeFunction
- func NewBytecodeFunctionWithCatchEntries(name value.Symbol, instruct []byte, loc *position.Location, ...) *BytecodeFunction
- func NewBytecodeFunctionWithOptions(opts ...BytecodeFunctionOption) *BytecodeFunction
- func NewBytecodeFunctionWithUpvalues(name value.Symbol, instruct []byte, loc *position.Location, ...) *BytecodeFunction
- func (f *BytecodeFunction) AddBytes(bytes ...byte)
- func (f *BytecodeFunction) AddInstruction(lineNumber int, op bytecode.OpCode, bytes ...byte)
- func (f *BytecodeFunction) AddParameter()
- func (f *BytecodeFunction) AddValue(obj value.Value) (int, IntSize)
- func (f *BytecodeFunction) AppendUint16(n uint16)
- func (f *BytecodeFunction) AppendUint32(n uint32)
- func (*BytecodeFunction) Class() *value.Class
- func (b *BytecodeFunction) Copy() value.Reference
- func (*BytecodeFunction) DirectClass() *value.Class
- func (f *BytecodeFunction) Disassemble(output io.Writer) error
- func (f *BytecodeFunction) DisassembleInstruction(output io.Writer, offset int) (int, error)
- func (f *BytecodeFunction) DisassembleStdout()
- func (f *BytecodeFunction) DisassembleString() (string, error)
- func (b *BytecodeFunction) Error() string
- func (b *BytecodeFunction) FileName() string
- func (b *BytecodeFunction) GetLineNumber(ip int) int
- func (b *BytecodeFunction) IncrementOptionalParameterCount()
- func (b *BytecodeFunction) Inspect() string
- func (*BytecodeFunction) InstanceVariables() *value.InstanceVariables
- func (b *BytecodeFunction) Name() value.Symbol
- func (b *BytecodeFunction) OptionalParameterCount() int
- func (b *BytecodeFunction) ParameterCount() int
- func (f *BytecodeFunction) RemoveByte()
- func (b *BytecodeFunction) SetOptionalParameterCount(optParamCount int)
- func (b *BytecodeFunction) SetParameterCount(paramCount int)
- func (*BytecodeFunction) SingletonClass() *value.Class
- type BytecodeFunctionOption
- func BytecodeFunctionWithInstructions(instructs []byte) BytecodeFunctionOption
- func BytecodeFunctionWithLineInfoList(lineInfo bytecode.LineInfoList) BytecodeFunctionOption
- func BytecodeFunctionWithLocation(loc *position.Location) BytecodeFunctionOption
- func BytecodeFunctionWithName(name value.Symbol) BytecodeFunctionOption
- func BytecodeFunctionWithOptionalParameters(optParams int) BytecodeFunctionOption
- func BytecodeFunctionWithParameters(params int) BytecodeFunctionOption
- func BytecodeFunctionWithStringName(name string) BytecodeFunctionOption
- type CallFrame
- type CatchEntry
- type Closure
- func (*Closure) Class() *value.Class
- func (c *Closure) Copy() value.Reference
- func (*Closure) DirectClass() *value.Class
- func (c *Closure) Error() string
- func (c *Closure) HasOpenUpvalues() bool
- func (c *Closure) Inspect() string
- func (*Closure) InstanceVariables() *value.InstanceVariables
- func (*Closure) SingletonClass() *value.Class
- type Colorizer
- type DefOption
- type DeletedHashSetValueType
- func (DeletedHashSetValueType) Class() *value.Class
- func (e DeletedHashSetValueType) Copy() value.Reference
- func (DeletedHashSetValueType) DirectClass() *value.Class
- func (e DeletedHashSetValueType) Error() string
- func (DeletedHashSetValueType) Inspect() string
- func (DeletedHashSetValueType) InstanceVariables() *value.InstanceVariables
- func (DeletedHashSetValueType) SingletonClass() *value.Class
- type Generator
- func (*Generator) Class() *value.Class
- func (c *Generator) Copy() value.Reference
- func (*Generator) DirectClass() *value.Class
- func (c *Generator) Error() string
- func (c *Generator) Inspect() string
- func (*Generator) InstanceVariables() *value.InstanceVariables
- func (*Generator) SingletonClass() *value.Class
- type GetterMethod
- func (g *GetterMethod) Call(self value.Value) (value.Value, value.Value)
- func (*GetterMethod) Class() *value.Class
- func (g *GetterMethod) Copy() value.Reference
- func (*GetterMethod) DirectClass() *value.Class
- func (g *GetterMethod) Error() string
- func (g *GetterMethod) Inspect() string
- func (*GetterMethod) InstanceVariables() *value.InstanceVariables
- func (g *GetterMethod) Name() value.Symbol
- func (*GetterMethod) NamedRestParameter() bool
- func (*GetterMethod) OptionalParameterCount() int
- func (*GetterMethod) ParameterCount() int
- func (*GetterMethod) Parameters() []value.Symbol
- func (*GetterMethod) PostRestParameterCount() int
- func (*GetterMethod) SingletonClass() *value.Class
- type IntSize
- type LocalBox
- func (*LocalBox) Class() *value.Class
- func (l *LocalBox) Close()
- func (v *LocalBox) Copy() value.Reference
- func (*LocalBox) DirectClass() *value.Class
- func (l *LocalBox) Error() string
- func (l *LocalBox) Get() value.Value
- func (l *LocalBox) Inspect() string
- func (*LocalBox) InstanceVariables() *value.InstanceVariables
- func (l *LocalBox) IsClosed() bool
- func (l *LocalBox) IsOpen() bool
- func (l *LocalBox) LocalAddress() uintptr
- func (l *LocalBox) Next(step int) *value.Box
- func (l *LocalBox) NextImmutableBox(step int) *value.ImmutableBox
- func (l *LocalBox) Prev(step int) *value.Box
- func (l *LocalBox) PrevImmutableBox(step int) *value.ImmutableBox
- func (l *LocalBox) Set(v value.Value)
- func (*LocalBox) SingletonClass() *value.Class
- func (l *LocalBox) ToBox() *value.Box
- func (l *LocalBox) ToImmutableBox() *value.ImmutableBox
- type NativeFunction
- type NativeMethod
- func (*NativeMethod) Class() *value.Class
- func (n *NativeMethod) Copy() value.Reference
- func (*NativeMethod) DirectClass() *value.Class
- func (n *NativeMethod) Error() string
- func (n *NativeMethod) Inspect() string
- func (*NativeMethod) InstanceVariables() *value.InstanceVariables
- func (n *NativeMethod) Name() value.Symbol
- func (n *NativeMethod) OptionalParameterCount() int
- func (n *NativeMethod) ParameterCount() int
- func (*NativeMethod) SingletonClass() *value.Class
- type NativePromiseBody
- type Option
- type Promise
- func NewBytecodePromise(threadPool *ThreadPool, bytecode *BytecodeFunction, args ...value.Value) *Promise
- func NewExternalPromise(threadPool *ThreadPool) *Promise
- func NewNativePromise(threadPool *ThreadPool, fn NativeFunction, args ...value.Value) *Promise
- func NewPromise(threadPool *ThreadPool, generator *Generator) *Promise
- func NewRejectedPromise(err value.Value) *Promise
- func NewResolvedPromise(result value.Value) *Promise
- func (p *Promise) AwaitSync() (value.Value, *value.StackTrace, value.Value)
- func (*Promise) Class() *value.Class
- func (p *Promise) Copy() value.Reference
- func (*Promise) DirectClass() *value.Class
- func (p *Promise) Error() string
- func (p *Promise) Inspect() string
- func (*Promise) InstanceVariables() *value.InstanceVariables
- func (p *Promise) IsResolved() bool
- func (p *Promise) RegisterContinuation(continuation *Promise)
- func (p *Promise) RegisterContinuationUnsafe(continuation *Promise)
- func (p *Promise) Reject(err value.Value, stackTrace *value.StackTrace)
- func (p *Promise) Resolve(result value.Value)
- func (p *Promise) ResolveReject(result, err value.Value)
- func (*Promise) SingletonClass() *value.Class
- type PromiseBody
- type SetterMethod
- func (s *SetterMethod) Call(self value.Value, val value.Value) (value.Value, value.Value)
- func (*SetterMethod) Class() *value.Class
- func (s *SetterMethod) Copy() value.Reference
- func (*SetterMethod) DirectClass() *value.Class
- func (s *SetterMethod) Error() string
- func (s *SetterMethod) Inspect() string
- func (*SetterMethod) InstanceVariables() *value.InstanceVariables
- func (s *SetterMethod) Name() value.Symbol
- func (*SetterMethod) NamedRestParameter() bool
- func (*SetterMethod) OptionalParameterCount() int
- func (*SetterMethod) ParameterCount() int
- func (*SetterMethod) Parameters() []value.Symbol
- func (*SetterMethod) PostRestParameterCount() int
- func (*SetterMethod) SingletonClass() *value.Class
- type Thread
- func (vm *Thread) AddCallFrame(cf CallFrame)
- func (vm *Thread) BuildStackTrace() *value.StackTrace
- func (vm *Thread) BuildStackTracePrepend(base *value.StackTrace) *value.StackTrace
- func (vm *Thread) CallCallable(args ...value.Value) (value.Value, value.Value)
- func (vm *Thread) CallClosure(closure *Closure, args ...value.Value) (value.Value, value.Value)
- func (vm *Thread) CallGeneratorNext(generator *Generator) (value.Value, value.Value)
- func (vm *Thread) CallMethod(method value.Method, args ...value.Value) (value.Value, value.Value)
- func (vm *Thread) CallMethodByName(name value.Symbol, args ...value.Value) (value.Value, value.Value)
- func (vm *Thread) CallMethodByNameWithCache(name value.Symbol, cc **value.CallCache, args ...value.Value) (value.Value, value.Value)
- func (*Thread) Class() *value.Class
- func (vm *Thread) ClearStackFrames()
- func (vm *Thread) Copy() value.Reference
- func (*Thread) DirectClass() *value.Class
- func (vm *Thread) Err() value.Value
- func (vm *Thread) ErrStackTrace() *value.StackTrace
- func (vm *Thread) Error() string
- func (vm *Thread) GetStackTrace() *value.StackTrace
- func (vm *Thread) Inspect() string
- func (vm *Thread) InspectCallStack()
- func (vm *Thread) InspectValueStack()
- func (vm *Thread) InstanceVariables() *value.InstanceVariables
- func (vm *Thread) InterpretREPL(fn *BytecodeFunction) (value.Value, value.Value)
- func (vm *Thread) InterpretTopLevel(fn *BytecodeFunction) (value.Value, value.Value)
- func (vm *Thread) Panic(err value.Value)
- func (vm *Thread) PopCallFrame()
- func (vm *Thread) PrintError()
- func (vm *Thread) PrintErrorValue(err value.Value)
- func (vm *Thread) ResetError()
- func (*Thread) SingletonClass() *value.Class
- func (vm *Thread) StackTop() value.Value
- func (vm *Thread) StateSymbol() value.Symbol
- func (vm *Thread) ValueStack() []value.Value
- type ThreadPool
- func (t *ThreadPool) AddTask(promise *Promise)
- func (*ThreadPool) Class() *value.Class
- func (t *ThreadPool) Close()
- func (t *ThreadPool) Copy() value.Reference
- func (*ThreadPool) DirectClass() *value.Class
- func (t *ThreadPool) Error() string
- func (t *ThreadPool) Inspect() string
- func (*ThreadPool) InstanceVariables() *value.InstanceVariables
- func (*ThreadPool) SingletonClass() *value.Class
- func (t *ThreadPool) TaskQueueSize() int
- func (t *ThreadPool) ThreadCount() int
- type Upvalue
- func (*Upvalue) Class() *value.Class
- func (u *Upvalue) Close()
- func (u *Upvalue) Copy() value.Reference
- func (*Upvalue) DirectClass() *value.Class
- func (u *Upvalue) Error() string
- func (u *Upvalue) Get() value.Value
- func (*Upvalue) Inspect() string
- func (*Upvalue) InstanceVariables() *value.InstanceVariables
- func (u *Upvalue) IsClosed() bool
- func (u *Upvalue) IsOpen() bool
- func (u *Upvalue) Set(v value.Value)
- func (*Upvalue) SingletonClass() *value.Class
Constants ¶
const ( UpvalueLongIndexFlag bitfield.BitFlag8 = 1 << iota UpvalueLocalFlag )
const CallFrameSize = unsafe.Sizeof(CallFrame{})
const ClosureTerminatorFlag byte = 0xff
Variables ¶
var CALL_STACK_SIZE int
var DEFAULT_THREAD_POOL_QUEUE_SIZE int
var DEFAULT_THREAD_POOL_SIZE int
var DefaultThreadPool = &ThreadPool{}
var DeletedHashSetValue value.Value = value.Ref(DeletedHashSetValueType{})
var INIT_VALUE_STACK_SIZE int
var MAX_VALUE_STACK_SIZE int
Functions ¶
func Accessor ¶
func Accessor( container *value.MethodContainer, attrName string, )
Utility method that creates a new setter and getter method and attaches them as methods to the given container. Panics when the methods cannot be defined.
func Alias ¶
func Alias(container *value.MethodContainer, newName, oldName string)
Utility method that defines an alternative name for an existing method.
func ArrayListContains ¶
func ArrayTupleContains ¶
func ArrayTupleEqual ¶
func BeginlessClosedRangeContains ¶
func BeginlessClosedRangeContains(vm *Thread, r *value.BeginlessClosedRange, val value.Value) (bool, value.Value)
Checks whether a value is contained in the beginless closed range
func BeginlessClosedRangeEqual ¶
Checks whether two beginless closed ranges are equal
func BeginlessOpenRangeContains ¶
func BeginlessOpenRangeContains(vm *Thread, r *value.BeginlessOpenRange, val value.Value) (bool, value.Value)
Checks whether a value is contained in the open range
func BeginlessOpenRangeEqual ¶
Checks whether two open ranges are equal
func ClosedRangeContains ¶
Checks whether a value is contained in the closed range
func ClosedRangeEqual ¶
func ClosedRangeEqual(vm *Thread, x *value.ClosedRange, y *value.ClosedRange) (bool, value.Value)
Checks whether two closed ranges are equal
func ClosedRangeIteratorNext ¶
Get the next element of the range
func Def ¶
func Def( container *value.MethodContainer, name string, function NativeFunction, opts ...DefOption, )
Utility method that creates a new native method and attaches it to the given container.
Panics when the method cannot be defined.
func DefineAccessor ¶
func DefineAccessor( container *value.MethodContainer, attrName value.Symbol, index int, )
Utility method that creates a new setter and getter method and attaches them as methods to the given method map.
func DefineGetter ¶
func DefineGetter( container *value.MethodContainer, name value.Symbol, index int, )
Creates a getter method and attaches it to the given container.
func DefineNativeMethod ¶
func DefineNativeMethod( container *value.MethodContainer, name value.Symbol, params int, optParams int, function NativeFunction, ) (err value.Value)
Define a native method in the given container. Returns an error when the method couldn't be defined.
func DefineSetter ¶
func DefineSetter( container *value.MethodContainer, attrName value.Symbol, index int, )
Creates a setter method and attaches it to the given container.
func EndlessClosedRangeContains ¶
func EndlessClosedRangeContains(vm *Thread, r *value.EndlessClosedRange, val value.Value) (bool, value.Value)
Checks whether a value is contained in the closed range
func EndlessClosedRangeEqual ¶
func EndlessClosedRangeEqual(vm *Thread, x *value.EndlessClosedRange, y *value.EndlessClosedRange) (bool, value.Value)
Checks whether two closed ranges are equal
func EndlessClosedRangeIteratorNext ¶
func EndlessClosedRangeIteratorNext(vm *Thread, i *value.EndlessClosedRangeIterator) (value.Value, value.Value)
Get the next element of the range
func EndlessOpenRangeContains ¶
func EndlessOpenRangeContains(vm *Thread, r *value.EndlessOpenRange, val value.Value) (bool, value.Value)
Checks whether a value is contained in the endless open range
func EndlessOpenRangeEqual ¶
Checks whether two Endless open ranges are equal
func EndlessOpenRangeIteratorNext ¶
func EndlessOpenRangeIteratorNext(vm *Thread, i *value.EndlessOpenRangeIterator) (value.Value, value.Value)
Get the next element of the range
func Getter ¶
func Getter( container *value.MethodContainer, name string, )
Utility method that creates a new getter method and attaches it as a method to the given container. It panics when the method cannot be defined.
func GreaterThan ¶
Check whether the left value is greater than the right
func GreaterThanEqual ¶
Check whether the left value is greater than or equal to the right
func HashMapConcat ¶
Create a new map containing the pairs of both maps.
func HashMapContains ¶
Check if the given pair is present in the map
func HashMapContainsKey ¶
Check if the given key is present in the map
func HashMapContainsValue ¶
Check if the given value is present in the map
func HashMapCopy ¶
Copy the pairs of one hashmap to the other.
func HashMapCopyTable ¶
func HashMapDelete ¶
Delete the given key from the hashMap
func HashMapEqual ¶
Checks whether two hash maps are equal
func HashMapGet ¶
Get the element under the given key. Returns (value, undefined) when the value has been found. Returns (undefined, undefined) when the key is not present. Returns (undefined, err) when there was an error.
func HashMapGrow ¶
Add additional n empty slots for new elements.
func HashMapIndex ¶
Get the index that the key should be inserted into. Returns (nil, err) when an error has been encountered. Returns (-1, nil) when there's no room for new values.
func HashMapLaxEqual ¶
Checks whether two hash maps are equal (lax)
func HashMapSet ¶
Set a value under the given key.
func HashMapSetCapacity ¶
Resize the given hashmap to the desired capacity.
func HashMapSetWithMaxLoad ¶
func HashRecordConcat ¶
func HashRecordConcat(vm *Thread, x *value.HashRecord, y *value.HashRecord) (*value.HashMap, value.Value)
Create a new map containing the pairs of both maps.
func HashRecordContains ¶
Check if the given pair is present in the record
func HashRecordContainsKey ¶
Check if the given key is present in the record
func HashRecordContainsValue ¶
func HashRecordContainsValue(vm *Thread, hrec *value.HashRecord, val value.Value) (bool, value.Value)
Check if the given value is present in the record
func HashRecordCopy ¶
func HashRecordCopy(vm *Thread, target *value.HashRecord, source *value.HashRecord) value.Value
Copy the pairs of one hash record to the other.
func HashRecordCopyTable ¶
func HashRecordDelete ¶
func HashRecordDelete(vm *Thread, hashRecord *value.HashRecord, key value.Value) (bool, value.Value)
Delete the given key from the hashMap
func HashRecordEqual ¶
func HashRecordEqual(vm *Thread, x *value.HashRecord, y *value.HashRecord) (bool, value.Value)
Checks whether two hash records are equal
func HashRecordGet ¶
func HashRecordGet(vm *Thread, hashRecord *value.HashRecord, key value.Value) (value.Value, value.Value)
Get the element under the given key.
func HashRecordGrow ¶
Add additional n empty slots for new elements.
func HashRecordLaxEqual ¶
func HashRecordLaxEqual(vm *Thread, x *value.HashRecord, y *value.HashRecord) (bool, value.Value)
Checks whether two hash records are equal (lax)
func HashRecordSet ¶
Set a value under the given key.
func HashRecordSetCapacity ¶
Resize the given hash record to the desired capacity.
func HashSetAppend ¶
Set a value under the given key.
func HashSetContains ¶
Check whether the given value is contained within the set.
func HashSetCopy ¶
Copy the pairs of one hashmap to the other.
func HashSetCopyTable ¶
func HashSetDelete ¶
Delete the given value from the hash set
func HashSetEqual ¶
Checks whether two hash sets are equal
func HashSetGrow ¶
Add additional n empty slots for new elements.
func HashSetIndex ¶
Get the index that the value should be inserted into. Returns (0, err) when an error has been encountered. Returns (-1, undefined) when there's no room for new values.
func HashSetIntersection ¶
func HashSetIntersection(vm *Thread, x *value.HashSet, y *value.HashSet) (*value.HashSet, value.Value)
Create a new set that is the intersection of the given two sets
func HashSetSetCapacity ¶
Resize the given set to the desired capacity.
func HashSetUnion ¶
Create a new set that is the union of the given two sets
func InitGlobalEnvironment ¶
func InitGlobalEnvironment()
func InspectWithColor ¶
Return the string representation of a value for debugging
func LeftOpenRangeContains ¶
Checks whether a value is contained in the left open range
func LeftOpenRangeEqual ¶
Checks whether two left open ranges are equal
func LeftOpenRangeIteratorNext ¶
func LeftOpenRangeIteratorNext(vm *Thread, i *value.LeftOpenRangeIterator) (value.Value, value.Value)
Get the next element of the range
func LessThanEqual ¶
Check whether the left value is less than or equal to the right
func MustNewHashMapWithElements ¶
Create a new hashmap with the given entries.
func MustNewHashRecordWithElements ¶
func MustNewHashRecordWithElements(vm *Thread, elements ...value.Pair) *value.HashRecord
Create a new hash record with the given entries.
func MustNewHashSetWithElements ¶
Create a new hash set with the given entries.
func NewHashMapWithElements ¶
Create a new hashmap with the given entries.
func NewHashRecordWithElements ¶
Create a new hash record with the given entries.
func NewHashSetWithElements ¶
Create a new hash set with the given entries.
func NewNativeMethodComparer ¶
func NextBuiltin ¶
Call `next`
func OpenRangeContains ¶
Checks whether a value is contained in the open range
func OpenRangeEqual ¶
Checks whether two open ranges are equal
func OpenRangeIteratorNext ¶
Get the next element of the range
func PrintError ¶
func RightOpenRangeContains ¶
func RightOpenRangeContains(vm *Thread, r *value.RightOpenRange, val value.Value) (bool, value.Value)
Checks whether a value is contained in the range
func RightOpenRangeEqual ¶
Checks whether two right open ranges are equal
func RightOpenRangeIteratorNext ¶
func RightOpenRangeIteratorNext(vm *Thread, i *value.RightOpenRangeIterator) (value.Value, value.Value)
Get the next element of the range
func Setter ¶
func Setter( container *value.MethodContainer, attrName string, )
Utility method that creates a new setter method and attaches it as a method to the given container. Panics when the method cannot be defined.
func SubscriptBuiltin ¶
Types ¶
type BytecodeFunction ¶
type BytecodeFunction struct {
Instructions []byte
Values []value.Value // The value pool
LineInfoList bytecode.LineInfoList
Location *position.Location
Doc value.Value
CatchEntries []*CatchEntry
UpvalueCount int
// contains filtered or unexported fields
}
A single unit of Elk bytecode.
func NewBytecodeFunction ¶
func NewBytecodeFunction( name value.Symbol, instruct []byte, loc *position.Location, lineInfo bytecode.LineInfoList, paramCount int, optParamCount int, values []value.Value, ) *BytecodeFunction
Create a new bytecode method.
func NewBytecodeFunctionNoParams ¶
func NewBytecodeFunctionNoParams( name value.Symbol, instruct []byte, loc *position.Location, lineInfo bytecode.LineInfoList, values []value.Value, ) *BytecodeFunction
Create a new bytecode method.
func NewBytecodeFunctionSimple ¶
func NewBytecodeFunctionSimple(name value.Symbol, instruct []byte, loc *position.Location) *BytecodeFunction
Create a new bytecode method.
func NewBytecodeFunctionWithCatchEntries ¶
func NewBytecodeFunctionWithCatchEntries( name value.Symbol, instruct []byte, loc *position.Location, lineInfo bytecode.LineInfoList, params int, optParamCount int, values []value.Value, catchEntries []*CatchEntry, ) *BytecodeFunction
Create a new bytecode method.
func NewBytecodeFunctionWithOptions ¶
func NewBytecodeFunctionWithOptions(opts ...BytecodeFunctionOption) *BytecodeFunction
Create a new bytecode method with options.
func NewBytecodeFunctionWithUpvalues ¶
func NewBytecodeFunctionWithUpvalues( name value.Symbol, instruct []byte, loc *position.Location, lineInfo bytecode.LineInfoList, params int, optParamCount int, values []value.Value, upvalueCount int, ) *BytecodeFunction
Create a new bytecode method.
func (*BytecodeFunction) AddBytes ¶
func (f *BytecodeFunction) AddBytes(bytes ...byte)
Add bytes to the bytecode chunk.
func (*BytecodeFunction) AddInstruction ¶
func (f *BytecodeFunction) AddInstruction(lineNumber int, op bytecode.OpCode, bytes ...byte)
Add an instruction to the bytecode chunk.
func (*BytecodeFunction) AddParameter ¶
func (f *BytecodeFunction) AddParameter()
Add a parameter to the method.
func (*BytecodeFunction) AddValue ¶
func (f *BytecodeFunction) AddValue(obj value.Value) (int, IntSize)
Add a value to the value pool. Returns the index of the constant.
func (*BytecodeFunction) AppendUint16 ¶
func (f *BytecodeFunction) AppendUint16(n uint16)
Append two bytes to the bytecode chunk.
func (*BytecodeFunction) AppendUint32 ¶
func (f *BytecodeFunction) AppendUint32(n uint32)
Append four bytes to the bytecode chunk.
func (*BytecodeFunction) Class ¶
func (*BytecodeFunction) Class() *value.Class
func (*BytecodeFunction) Copy ¶
func (b *BytecodeFunction) Copy() value.Reference
func (*BytecodeFunction) DirectClass ¶
func (*BytecodeFunction) DirectClass() *value.Class
func (*BytecodeFunction) Disassemble ¶
func (f *BytecodeFunction) Disassemble(output io.Writer) error
Disassemble the bytecode chunk and write the output to a writer.
func (*BytecodeFunction) DisassembleInstruction ¶
func (*BytecodeFunction) DisassembleStdout ¶
func (f *BytecodeFunction) DisassembleStdout()
Disassemble the bytecode chunk and write the output to stdout.
func (*BytecodeFunction) DisassembleString ¶
func (f *BytecodeFunction) DisassembleString() (string, error)
Disassemble the bytecode chunk and return a string containing the result.
func (*BytecodeFunction) Error ¶
func (b *BytecodeFunction) Error() string
func (*BytecodeFunction) FileName ¶
func (b *BytecodeFunction) FileName() string
func (*BytecodeFunction) GetLineNumber ¶
func (b *BytecodeFunction) GetLineNumber(ip int) int
func (*BytecodeFunction) IncrementOptionalParameterCount ¶
func (b *BytecodeFunction) IncrementOptionalParameterCount()
func (*BytecodeFunction) Inspect ¶
func (b *BytecodeFunction) Inspect() string
func (*BytecodeFunction) InstanceVariables ¶
func (*BytecodeFunction) InstanceVariables() *value.InstanceVariables
func (*BytecodeFunction) Name ¶
func (b *BytecodeFunction) Name() value.Symbol
func (*BytecodeFunction) OptionalParameterCount ¶
func (b *BytecodeFunction) OptionalParameterCount() int
func (*BytecodeFunction) ParameterCount ¶
func (b *BytecodeFunction) ParameterCount() int
func (*BytecodeFunction) RemoveByte ¶
func (f *BytecodeFunction) RemoveByte()
Add an instruction to the bytecode chunk.
func (*BytecodeFunction) SetOptionalParameterCount ¶
func (b *BytecodeFunction) SetOptionalParameterCount(optParamCount int)
func (*BytecodeFunction) SetParameterCount ¶
func (b *BytecodeFunction) SetParameterCount(paramCount int)
func (*BytecodeFunction) SingletonClass ¶
func (*BytecodeFunction) SingletonClass() *value.Class
type BytecodeFunctionOption ¶
type BytecodeFunctionOption func(*BytecodeFunction)
func BytecodeFunctionWithInstructions ¶
func BytecodeFunctionWithInstructions(instructs []byte) BytecodeFunctionOption
func BytecodeFunctionWithLineInfoList ¶
func BytecodeFunctionWithLineInfoList(lineInfo bytecode.LineInfoList) BytecodeFunctionOption
func BytecodeFunctionWithLocation ¶
func BytecodeFunctionWithLocation(loc *position.Location) BytecodeFunctionOption
func BytecodeFunctionWithName ¶
func BytecodeFunctionWithName(name value.Symbol) BytecodeFunctionOption
func BytecodeFunctionWithOptionalParameters ¶
func BytecodeFunctionWithOptionalParameters(optParams int) BytecodeFunctionOption
func BytecodeFunctionWithParameters ¶
func BytecodeFunctionWithParameters(params int) BytecodeFunctionOption
func BytecodeFunctionWithStringName ¶
func BytecodeFunctionWithStringName(name string) BytecodeFunctionOption
type CallFrame ¶
type CallFrame struct {
// contains filtered or unexported fields
}
Contains the data of a single function call.
func (*CallFrame) LineNumber ¶
func (*CallFrame) ToCallFrameObject ¶
type CatchEntry ¶
type CatchEntry struct {
From int // index of the first instruction that can be handled by this catch
To int // index of the last instruction that can be handled by this catch
JumpAddress int // index of the byte that the VM should jump to
Finally bool // whether this entry is for a finally clause
}
func NewCatchEntry ¶
func NewCatchEntry(from, to, jumpAddress int, finally bool) *CatchEntry
func (*CatchEntry) ByteRange ¶
func (c *CatchEntry) ByteRange() int
Number of bytes this catch covers
type Closure ¶
type Closure struct {
VMID int64 // ID of the VM that created this closure, should be -1 if it was not created through a VM
Bytecode *BytecodeFunction
Self value.Value
Upvalues []*Upvalue
}
Wraps a bytecode function with associated local variables from the outer context
func NewClosure ¶
func NewClosure(vmID int64, bytecode *BytecodeFunction, self value.Value) *Closure
Create a new closure
func NewNativeClosure ¶
func NewNativeClosure(bytecode *BytecodeFunction, self value.Value) *Closure
Create a new native closure (created without a VM)
func (*Closure) DirectClass ¶
func (*Closure) HasOpenUpvalues ¶
func (*Closure) InstanceVariables ¶
func (*Closure) InstanceVariables() *value.InstanceVariables
func (*Closure) SingletonClass ¶
type DefOption ¶
type DefOption func(*NativeMethod)
func DefWithOptionalParameters ¶
Define how many parameters are optional (have default values). Optional arguments will be populated with `undefined` when no value was given in the call.
func DefWithParameters ¶
Define parameters used by the method
type DeletedHashSetValueType ¶
type DeletedHashSetValueType struct{}
func (DeletedHashSetValueType) Class ¶
func (DeletedHashSetValueType) Class() *value.Class
func (DeletedHashSetValueType) Copy ¶
func (e DeletedHashSetValueType) Copy() value.Reference
func (DeletedHashSetValueType) DirectClass ¶
func (DeletedHashSetValueType) DirectClass() *value.Class
func (DeletedHashSetValueType) Error ¶
func (e DeletedHashSetValueType) Error() string
func (DeletedHashSetValueType) Inspect ¶
func (DeletedHashSetValueType) Inspect() string
func (DeletedHashSetValueType) InstanceVariables ¶
func (DeletedHashSetValueType) InstanceVariables() *value.InstanceVariables
func (DeletedHashSetValueType) SingletonClass ¶
func (DeletedHashSetValueType) SingletonClass() *value.Class
type Generator ¶
type Generator struct {
Bytecode *BytecodeFunction
// contains filtered or unexported fields
}
Wraps a bytecode function with state that is necessary for pausing and resuming execution
func NewGeneratorForBytecode ¶
func NewGeneratorForBytecode(bytecode *BytecodeFunction, args ...value.Value) *Generator
Create a new generator that executes the given piece of bytecode.
func (*Generator) DirectClass ¶
func (*Generator) InstanceVariables ¶
func (*Generator) InstanceVariables() *value.InstanceVariables
func (*Generator) SingletonClass ¶
type GetterMethod ¶
A simple getter method.
func NewGetterMethod ¶
func NewGetterMethod(attrName value.Symbol, index int) *GetterMethod
Create a new getter method.
func (*GetterMethod) Class ¶
func (*GetterMethod) Class() *value.Class
func (*GetterMethod) Copy ¶
func (g *GetterMethod) Copy() value.Reference
func (*GetterMethod) DirectClass ¶
func (*GetterMethod) DirectClass() *value.Class
func (*GetterMethod) Error ¶
func (g *GetterMethod) Error() string
func (*GetterMethod) Inspect ¶
func (g *GetterMethod) Inspect() string
func (*GetterMethod) InstanceVariables ¶
func (*GetterMethod) InstanceVariables() *value.InstanceVariables
func (*GetterMethod) Name ¶
func (g *GetterMethod) Name() value.Symbol
func (*GetterMethod) NamedRestParameter ¶
func (*GetterMethod) NamedRestParameter() bool
func (*GetterMethod) OptionalParameterCount ¶
func (*GetterMethod) OptionalParameterCount() int
func (*GetterMethod) ParameterCount ¶
func (*GetterMethod) ParameterCount() int
func (*GetterMethod) Parameters ¶
func (*GetterMethod) Parameters() []value.Symbol
func (*GetterMethod) PostRestParameterCount ¶
func (*GetterMethod) PostRestParameterCount() int
func (*GetterMethod) SingletonClass ¶
func (*GetterMethod) SingletonClass() *value.Class
type LocalBox ¶
type LocalBox Upvalue
Represents a pointer to a local variable/value
func (*LocalBox) DirectClass ¶
func (*LocalBox) InstanceVariables ¶
func (*LocalBox) InstanceVariables() *value.InstanceVariables
func (*LocalBox) LocalAddress ¶
func (*LocalBox) NextImmutableBox ¶
func (l *LocalBox) NextImmutableBox(step int) *value.ImmutableBox
func (*LocalBox) PrevImmutableBox ¶
func (l *LocalBox) PrevImmutableBox(step int) *value.ImmutableBox
func (*LocalBox) SingletonClass ¶
func (*LocalBox) ToImmutableBox ¶
func (l *LocalBox) ToImmutableBox() *value.ImmutableBox
type NativeFunction ¶
An implementation of a native Elk method.
type NativeMethod ¶
type NativeMethod struct {
Function NativeFunction
Doc value.Value
// contains filtered or unexported fields
}
A native Elk method
func NewNativeMethod ¶
func NewNativeMethod( name value.Symbol, params int, optParams int, function NativeFunction, ) *NativeMethod
Create a new native method.
func (*NativeMethod) Class ¶
func (*NativeMethod) Class() *value.Class
func (*NativeMethod) Copy ¶
func (n *NativeMethod) Copy() value.Reference
func (*NativeMethod) DirectClass ¶
func (*NativeMethod) DirectClass() *value.Class
func (*NativeMethod) Error ¶
func (n *NativeMethod) Error() string
func (*NativeMethod) Inspect ¶
func (n *NativeMethod) Inspect() string
func (*NativeMethod) InstanceVariables ¶
func (*NativeMethod) InstanceVariables() *value.InstanceVariables
func (*NativeMethod) Name ¶
func (n *NativeMethod) Name() value.Symbol
func (*NativeMethod) OptionalParameterCount ¶
func (n *NativeMethod) OptionalParameterCount() int
func (*NativeMethod) ParameterCount ¶
func (n *NativeMethod) ParameterCount() int
func (*NativeMethod) SingletonClass ¶
func (*NativeMethod) SingletonClass() *value.Class
type NativePromiseBody ¶
type NativePromiseBody struct {
Function NativeFunction
Args []value.Value
}
func NewNativePromiseBody ¶
func NewNativePromiseBody(fn NativeFunction, args ...value.Value) *NativePromiseBody
type Option ¶
type Option func(*Thread) // constructor option function
func WithStderr ¶
Assign the given io.Writer as the Stderr of the VM.
func WithStdout ¶
Assign the given io.Writer as the Stdout of the VM.
func WithThreadPool ¶
func WithThreadPool(tp *ThreadPool) Option
type Promise ¶
type Promise struct {
Body PromiseBody
ThreadPool *ThreadPool
// contains filtered or unexported fields
}
func NewBytecodePromise ¶
func NewBytecodePromise(threadPool *ThreadPool, bytecode *BytecodeFunction, args ...value.Value) *Promise
Create a new promise for a piece of bytecode executed by the VM
func NewExternalPromise ¶
func NewExternalPromise(threadPool *ThreadPool) *Promise
Returns a new husk promise. It does not contain any code and is supposed to be resolved or rejected externally.
func NewNativePromise ¶
func NewNativePromise(threadPool *ThreadPool, fn NativeFunction, args ...value.Value) *Promise
Create a new native promise.
func NewPromise ¶
func NewPromise(threadPool *ThreadPool, generator *Generator) *Promise
Create a new promise executed by the VM
func NewRejectedPromise ¶
func NewResolvedPromise ¶
func (*Promise) DirectClass ¶
func (*Promise) InstanceVariables ¶
func (*Promise) InstanceVariables() *value.InstanceVariables
func (*Promise) IsResolved ¶
func (*Promise) RegisterContinuation ¶
func (*Promise) RegisterContinuationUnsafe ¶
func (*Promise) ResolveReject ¶
func (*Promise) SingletonClass ¶
type PromiseBody ¶
type PromiseBody interface {
// contains filtered or unexported methods
}
type SetterMethod ¶
type SetterMethod struct {
Doc value.Value
AttributeName value.Symbol
IvarIndex int
// contains filtered or unexported fields
}
A simple setter method.
func NewSetterMethod ¶
func NewSetterMethod(attrName value.Symbol, index int) *SetterMethod
Create a new getter method.
func (*SetterMethod) Class ¶
func (*SetterMethod) Class() *value.Class
func (*SetterMethod) Copy ¶
func (s *SetterMethod) Copy() value.Reference
func (*SetterMethod) DirectClass ¶
func (*SetterMethod) DirectClass() *value.Class
func (*SetterMethod) Error ¶
func (s *SetterMethod) Error() string
func (*SetterMethod) Inspect ¶
func (s *SetterMethod) Inspect() string
func (*SetterMethod) InstanceVariables ¶
func (*SetterMethod) InstanceVariables() *value.InstanceVariables
func (*SetterMethod) Name ¶
func (s *SetterMethod) Name() value.Symbol
func (*SetterMethod) NamedRestParameter ¶
func (*SetterMethod) NamedRestParameter() bool
func (*SetterMethod) OptionalParameterCount ¶
func (*SetterMethod) OptionalParameterCount() int
func (*SetterMethod) ParameterCount ¶
func (*SetterMethod) ParameterCount() int
func (*SetterMethod) Parameters ¶
func (*SetterMethod) Parameters() []value.Symbol
func (*SetterMethod) PostRestParameterCount ¶
func (*SetterMethod) PostRestParameterCount() int
func (*SetterMethod) SingletonClass ¶
func (*SetterMethod) SingletonClass() *value.Class
type Thread ¶
type Thread struct {
ID int64
Stdin io.Reader // standard output used by the VM
Stdout io.Writer // standard input used by the VM
Stderr io.Writer // standard error used by the VM
// contains filtered or unexported fields
}
A single instance of the Elk Virtual Machine.
func (*Thread) AddCallFrame ¶
func (*Thread) BuildStackTrace ¶
func (vm *Thread) BuildStackTrace() *value.StackTrace
func (*Thread) BuildStackTracePrepend ¶
func (vm *Thread) BuildStackTracePrepend(base *value.StackTrace) *value.StackTrace
func (*Thread) CallCallable ¶
Call a callable value from Go code, preserving the state of the VM.
func (*Thread) CallClosure ¶
Call an Elk closure from Go code, preserving the state of the VM.
func (*Thread) CallGeneratorNext ¶
func (*Thread) CallMethod ¶
func (*Thread) CallMethodByName ¶
func (vm *Thread) CallMethodByName(name value.Symbol, args ...value.Value) (value.Value, value.Value)
Call an Elk method from Go code, preserving the state of the VM.
func (*Thread) CallMethodByNameWithCache ¶
func (vm *Thread) CallMethodByNameWithCache(name value.Symbol, cc **value.CallCache, args ...value.Value) (value.Value, value.Value)
Call an Elk method from Go code, preserving the state of the VM.
func (*Thread) ClearStackFrames ¶
func (vm *Thread) ClearStackFrames()
func (*Thread) DirectClass ¶
func (*Thread) ErrStackTrace ¶
func (vm *Thread) ErrStackTrace() *value.StackTrace
Get the stored error stack trace.
func (*Thread) GetStackTrace ¶
func (vm *Thread) GetStackTrace() *value.StackTrace
func (*Thread) InspectCallStack ¶
func (vm *Thread) InspectCallStack()
func (*Thread) InspectValueStack ¶
func (vm *Thread) InspectValueStack()
func (*Thread) InstanceVariables ¶
func (vm *Thread) InstanceVariables() *value.InstanceVariables
func (*Thread) InterpretREPL ¶
Execute the given bytecode chunk.
func (*Thread) InterpretTopLevel ¶
Execute the given bytecode chunk.
func (*Thread) PopCallFrame ¶
func (vm *Thread) PopCallFrame()
func (*Thread) PrintError ¶
func (vm *Thread) PrintError()
func (*Thread) PrintErrorValue ¶
func (*Thread) ResetError ¶
func (vm *Thread) ResetError()
func (*Thread) SingletonClass ¶
func (*Thread) StateSymbol ¶
func (*Thread) ValueStack ¶
type ThreadPool ¶
func NewThreadPool ¶
func NewThreadPool(threadCount, queueSize int, opts ...Option) *ThreadPool
func (*ThreadPool) AddTask ¶
func (t *ThreadPool) AddTask(promise *Promise)
func (*ThreadPool) Class ¶
func (*ThreadPool) Class() *value.Class
func (*ThreadPool) Close ¶
func (t *ThreadPool) Close()
func (*ThreadPool) Copy ¶
func (t *ThreadPool) Copy() value.Reference
func (*ThreadPool) DirectClass ¶
func (*ThreadPool) DirectClass() *value.Class
func (*ThreadPool) Error ¶
func (t *ThreadPool) Error() string
func (*ThreadPool) Inspect ¶
func (t *ThreadPool) Inspect() string
func (*ThreadPool) InstanceVariables ¶
func (*ThreadPool) InstanceVariables() *value.InstanceVariables
func (*ThreadPool) SingletonClass ¶
func (*ThreadPool) SingletonClass() *value.Class
func (*ThreadPool) TaskQueueSize ¶
func (t *ThreadPool) TaskQueueSize() int
func (*ThreadPool) ThreadCount ¶
func (t *ThreadPool) ThreadCount() int
type Upvalue ¶
type Upvalue struct {
// contains filtered or unexported fields
}
Represents a captured variable from an outer context
func NewClosedUpvalue ¶
Create a new upvalue that is already closed
func NewUpvalue ¶
func (*Upvalue) DirectClass ¶
func (*Upvalue) InstanceVariables ¶
func (*Upvalue) InstanceVariables() *value.InstanceVariables
func (*Upvalue) SingletonClass ¶
Source Files
¶
- alias.go
- array_list.go
- array_tuple.go
- beginless_closed_range.go
- beginless_open_range.go
- big_float.go
- box.go
- bytecode_function.go
- call_frame.go
- catch_entry.go
- channel.go
- char.go
- class.go
- closed_range.go
- closure.go
- collection.go
- colorizer.go
- comparable.go
- date.go
- date_span.go
- datetime.go
- datetime_span.go
- debug.go
- endless_closed_range.go
- endless_open_range.go
- error.go
- float.go
- float32.go
- float64.go
- generator.go
- getter_method.go
- hash_map.go
- hash_record.go
- hash_set.go
- immutable_box.go
- immutable_collection.go
- init.go
- int.go
- int16.go
- int32.go
- int64.go
- int8.go
- interface.go
- iterable.go
- iterator.go
- kernel.go
- left_open_range.go
- local_box.go
- location.go
- method.go
- mixin.go
- module.go
- mutex.go
- native_method.go
- nil.go
- once.go
- open_range.go
- pair.go
- path.go
- position.go
- promise.go
- regex.go
- result.go
- right_open_range.go
- romutex.go
- runtime.go
- rwmutex.go
- setter_method.go
- span.go
- stack_trace.go
- state.go
- string.go
- symbol.go
- thread.go
- thread_pool.go
- time.go
- time_span.go
- timezone.go
- token.go
- tuple.go
- uint.go
- uint16.go
- uint32.go
- uint64.go
- uint8.go
- upvalue.go
- value.go
- vm.go
- vm_bytecode.go
- vm_not_debug.go
- wait_group.go
- weak.go