about summary refs log tree commit diff
path: root/pkg/lang/vm/value/cells.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/lang/vm/value/cells.go')
-rw-r--r--pkg/lang/vm/value/cells.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/lang/vm/value/cells.go b/pkg/lang/vm/value/cells.go
index 116fa5a..146402d 100644
--- a/pkg/lang/vm/value/cells.go
+++ b/pkg/lang/vm/value/cells.go
@@ -31,6 +31,29 @@ func (s StringCell) Get() string {
 	return string(s)
 }
 
+type TypeCell Type
+
+func (t TypeCell) DropCell(m mem.Mem) {
+	typ := t.Get()
+	for _, f := range typ.Methods {
+		// Wrap data in a Value to drop it.
+		val := NewFunction(0).WithData(f)
+		val.Drop(m)
+	}
+
+	for _, v := range typ.Statics {
+		v.Drop(m)
+	}
+}
+
+func (t TypeCell) MatchingCellKind() mem.CellKind {
+	return mem.CellKindType
+}
+
+func (t TypeCell) Get() Type {
+	return Type(t)
+}
+
 type OutletCell Value
 
 func (o OutletCell) DropCell(m mem.Mem) {