about summary refs log tree commit diff
path: root/pkg/lang/vm/value
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/lang/vm/value')
-rw-r--r--pkg/lang/vm/value/type.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/lang/vm/value/type.go b/pkg/lang/vm/value/type.go
index 1aec251..cd518d9 100644
--- a/pkg/lang/vm/value/type.go
+++ b/pkg/lang/vm/value/type.go
@@ -17,3 +17,26 @@ const (
 type Type struct {
 	Kind TypeKind
 }
+
+func (t Type) String() string {
+	switch t.Kind {
+	case IntType:
+		return "int"
+	case FloatType:
+		return "float"
+	case StringType:
+		return "string"
+	case BoolType:
+		return "bool"
+	case ArrayType:
+		return "array"
+	case NullType:
+		return "null"
+	case FunctionType:
+		return "function"
+	case ObjectType:
+		return "object"
+	}
+
+	panic("invalid type kind")
+}