Fix VM memory allocation optimizations by reducing what we allocate on the heap
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user