Fix VM memory allocation optimizations by reducing what we allocate on the heap
Some checks failed
Build / build (push) Successful in 10m25s
Publish Image / publish (push) Failing after 39s
Test / build (push) Successful in 11m19s

This commit is contained in:
Charles Smith
2024-03-31 20:44:50 -04:00
parent a85dc73954
commit aebbe43999
61 changed files with 383 additions and 370 deletions

View File

@@ -12,15 +12,15 @@ type Function struct {
Env *Environment
}
func (f *Function) Bool() bool {
func (f Function) Bool() bool {
return false
}
func (f *Function) Type() Type {
func (f Function) Type() Type {
return FunctionType
}
func (f *Function) Inspect() string {
func (f Function) Inspect() string {
var out bytes.Buffer
params := []string{}
@@ -38,7 +38,7 @@ func (f *Function) Inspect() string {
return out.String()
}
func (f *Function) String() string {
func (f Function) String() string {
return f.Inspect()
}
@@ -46,18 +46,18 @@ type ReturnValue struct {
Value Object
}
func (rv *ReturnValue) Bool() bool {
func (rv ReturnValue) Bool() bool {
return true
}
func (rv *ReturnValue) Type() Type {
func (rv ReturnValue) Type() Type {
return ReturnType
}
func (rv *ReturnValue) Inspect() string {
func (rv ReturnValue) Inspect() string {
return rv.Value.Inspect()
}
func (rv *ReturnValue) String() string {
func (rv ReturnValue) String() string {
return rv.Inspect()
}