type checking and error handling for builtins improved.
Some checks failed
Build / build (push) Successful in 11m16s
Test / build (push) Failing after 17m0s

This commit is contained in:
Chuck Smith
2024-03-25 16:18:08 -04:00
parent 1c99d2198b
commit 6d234099d1
52 changed files with 650 additions and 433 deletions

View File

@@ -12,9 +12,14 @@ type Function struct {
Env *Environment
}
func (f *Function) Bool() bool {
return false
}
func (f *Function) Type() ObjectType {
return FUNCTION_OBJ
}
func (f *Function) Inspect() string {
var out bytes.Buffer
@@ -32,6 +37,7 @@ func (f *Function) Inspect() string {
return out.String()
}
func (f *Function) String() string {
return f.Inspect()
}
@@ -40,12 +46,18 @@ type ReturnValue struct {
Value Object
}
func (rv *ReturnValue) Bool() bool {
return true
}
func (rv *ReturnValue) Type() ObjectType {
return RETURN_VALUE_OBJ
}
func (rv *ReturnValue) Inspect() string {
return rv.Value.Inspect()
}
func (rv *ReturnValue) String() string {
return rv.Inspect()
}