Return statements
This commit is contained in:
@@ -5,9 +5,10 @@ import "fmt"
|
||||
type ObjectType string
|
||||
|
||||
const (
|
||||
INTEGER_OBJ = "INTEGER"
|
||||
BOOLEAN_OBJ = "BOOLEAN"
|
||||
NULL_OBJ = "NULL"
|
||||
INTEGER_OBJ = "INTEGER"
|
||||
BOOLEAN_OBJ = "BOOLEAN"
|
||||
NULL_OBJ = "NULL"
|
||||
RETURN_VALUE_OBJ = "RETURN_VALUE"
|
||||
)
|
||||
|
||||
type Object interface {
|
||||
@@ -46,3 +47,15 @@ func (n *Null) Type() ObjectType {
|
||||
func (n *Null) Inspect() string {
|
||||
return "null"
|
||||
}
|
||||
|
||||
type ReturnValue struct {
|
||||
Value Object
|
||||
}
|
||||
|
||||
func (rv ReturnValue) Type() ObjectType {
|
||||
return RETURN_VALUE_OBJ
|
||||
}
|
||||
|
||||
func (rv ReturnValue) Inspect() string {
|
||||
return rv.Value.Inspect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user