about summary refs log tree commit diff stats
path: root/apps/tile/gap-buffer.mu
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tile/gap-buffer.mu')
-rw-r--r--apps/tile/gap-buffer.mu8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/tile/gap-buffer.mu b/apps/tile/gap-buffer.mu
index 96e39aed..8a57fc5b 100644
--- a/apps/tile/gap-buffer.mu
+++ b/apps/tile/gap-buffer.mu
@@ -139,7 +139,6 @@ $gap-right:body: {
   }
   {
     var left/ecx: (addr grapheme-stack) <- get self, left
-    # HERE: can't use 'result' here: "unknown variable 'result'"
     push-grapheme-stack left, g
   }
 }
@@ -163,6 +162,13 @@ $gap-left:body: {
 }
 }
 
+fn gap-index _self: (addr gap-buffer) -> result/eax: int {
+  var self/eax: (addr gap-buffer) <- copy _self
+  var left/eax: (addr grapheme-stack) <- get self, left
+  var top-addr/eax: (addr int) <- get left, top
+  result <- copy *top-addr
+}
+
 fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> result/eax: boolean {
 $gap-buffer-equal?:body: {
   var self/esi: (addr gap-buffer) <- copy _self