about summary refs log tree commit diff
path: root/pkg/lang/vm/text
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-06-07 10:18:32 +0000
committerGitHub <noreply@github.com>2022-06-07 10:18:32 +0000
commitbc35c4f5cb981405050957833ff6d87733032d5c (patch)
tree067ba06ca67100f483bd1054bcd7a7904c61ef3f /pkg/lang/vm/text
parent144f49d64e3fc11d334900e90d30c8620ca2991b (diff)
downloadjinx-bc35c4f5cb981405050957833ff6d87733032d5c.tar.zst
jinx-bc35c4f5cb981405050957833ff6d87733032d5c.zip
Marginally better bytecode builder line API
Diffstat (limited to 'pkg/lang/vm/text')
-rw-r--r--pkg/lang/vm/text/compiler.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/pkg/lang/vm/text/compiler.go b/pkg/lang/vm/text/compiler.go
index 68889eb..28bc9a7 100644
--- a/pkg/lang/vm/text/compiler.go
+++ b/pkg/lang/vm/text/compiler.go
@@ -47,11 +47,9 @@ func (cpl *Compiler) Compile() (code.Code, error) {
 
 		cpl.codePos += len(line)
 
+		builder.StartLine(cpl.src.Loc().Row - 1)
 		builder.AppendRaw(line)
-
-		if len(line) > 0 {
-			builder.AppendLine(cpl.src.Loc().Row - 1)
-		}
+		builder.EndLine()
 	}
 
 	if err := cpl.linkLabels(&builder); err != nil {