Strings
This commit is contained in:
@@ -16,6 +16,7 @@ const (
|
||||
RETURN_VALUE_OBJ = "RETURN_VALUE"
|
||||
ERROR_OBJ = "ERROR"
|
||||
FUNCTION_OBJ = "FUNCTION"
|
||||
STRING_OBJ = "STRING"
|
||||
)
|
||||
|
||||
type Object interface {
|
||||
@@ -85,11 +86,11 @@ type Function struct {
|
||||
Env *Environment
|
||||
}
|
||||
|
||||
func (f Function) Type() ObjectType {
|
||||
func (f *Function) Type() ObjectType {
|
||||
return FUNCTION_OBJ
|
||||
}
|
||||
|
||||
func (f Function) Inspect() string {
|
||||
func (f *Function) Inspect() string {
|
||||
var out bytes.Buffer
|
||||
|
||||
params := []string{}
|
||||
@@ -106,3 +107,15 @@ func (f Function) Inspect() string {
|
||||
|
||||
return out.String()
|
||||
}
|
||||
|
||||
type String struct {
|
||||
Value string
|
||||
}
|
||||
|
||||
func (s *String) Type() ObjectType {
|
||||
return STRING_OBJ
|
||||
}
|
||||
|
||||
func (s *String) Inspect() string {
|
||||
return s.Value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user