diff options
| author | Bobby <[email protected]> | 2024-03-01 20:35:25 +0000 |
|---|---|---|
| committer | Bobby <[email protected]> | 2024-03-01 20:35:25 +0000 |
| commit | f793e4bac77ff15949e510b135cf917a303698f4 (patch) | |
| tree | f85029edef6cd0734a5968ffbba51d220a4eaade /object | |
| parent | 8e6447a42c363cf567ec3146bb588c7ed7ce7260 (diff) | |
| download | mana-f793e4bac77ff15949e510b135cf917a303698f4.tar.xz mana-f793e4bac77ff15949e510b135cf917a303698f4.zip | |
Evaluate `return` Statement
Diffstat (limited to 'object')
| -rw-r--r-- | object/object.go | 17 |
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() +} |
