Skip to content

Commit

Permalink
compiler: use std/slices for buffer insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Oct 7, 2024
1 parent 3e0c3e8 commit f7ad248
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/julec/obj/cxx/object.jule
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use "std/jule/sema"
use "std/jule/token"
use "std/jule/types"
use "std/os/filepath"
use "std/slices"
use "std/strings"
use "std/time"
use "std/unsafe"
Expand Down Expand Up @@ -1309,11 +1310,9 @@ impl ObjectCoder {

fn insertBuf(mut &self, mut &buf: strings::Builder, pos: int) {
if buf.Len() > 0 {
mut head := make([]byte, 0, self.Buf.Len()+buf.Len())
head = append(head, unsafe { self.Buf.Buf() }[:pos]...)
head = append(head, unsafe { buf.Buf() }...)
head = append(head, unsafe { self.Buf.Buf() }[pos:]...)
unsafe { self.Buf.SetBuf(head) }
mut ibuf := unsafe { self.Buf.Buf() }
ibuf = slices::Insert(ibuf, pos, unsafe { buf.Buf()... })
unsafe { self.Buf.SetBuf(ibuf) }
}
}

Expand Down

0 comments on commit f7ad248

Please sign in to comment.