aboutsummaryrefslogtreecommitdiff
path: root/object
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-03-01 20:35:25 +0000
committerBobby <[email protected]>2024-03-01 20:35:25 +0000
commitf793e4bac77ff15949e510b135cf917a303698f4 (patch)
treef85029edef6cd0734a5968ffbba51d220a4eaade /object
parent8e6447a42c363cf567ec3146bb588c7ed7ce7260 (diff)
downloadmana-f793e4bac77ff15949e510b135cf917a303698f4.tar.xz
mana-f793e4bac77ff15949e510b135cf917a303698f4.zip
Evaluate `return` Statement
Diffstat (limited to 'object')
-rw-r--r--object/object.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/object/object.go b/object/object.go
index cac36ac..fbecf88 100644
--- a/object/object.go
+++ b/object/object.go
@@ -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 {
@@ -25,6 +26,10 @@ type Boolean struct {
type Null struct{}
+type ReturnValue struct {
+ Value Object
+}
+
func (i *Integer) Type() ObjectType {
return INTEGER_OBJ
}
@@ -49,4 +54,10 @@ func (n *Null) Inspect() string {
return "null"
}
+func (rv *ReturnValue) Type() ObjectType {
+ return RETURN_VALUE_OBJ
+}
+func (rv *ReturnValue) Inspect() string {
+ return rv.Value.Inspect()
+}