about summary refs log tree commit diff
path: root/pkg/lang/vm/code/marker.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/lang/vm/code/marker.go')
-rw-r--r--pkg/lang/vm/code/marker.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/lang/vm/code/marker.go b/pkg/lang/vm/code/marker.go
new file mode 100644
index 0000000..18b4157
--- /dev/null
+++ b/pkg/lang/vm/code/marker.go
@@ -0,0 +1,23 @@
+package code
+
+import "fmt"
+
+type Marker string
+
+func (m Marker) SubUnit(name string) Marker {
+	return Marker(fmt.Sprintf("%v:%s", m, name))
+}
+
+func (m Marker) SubMarker(format string, args ...any) Marker {
+	part := fmt.Sprintf(format, args...)
+
+	return Marker(fmt.Sprintf("%v_%s", m, part))
+}
+
+func (m Marker) String() string {
+	return string(m)
+}
+
+func (m Marker) IsEmpty() bool {
+	return string(m) == ""
+}