internal/ops: remove Data, Version, Refs methods from Ops

They're only used internally.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-10-12 14:24:57 +02:00
parent 05f0f5c20f
commit 87d050bcc7
3 changed files with 4 additions and 35 deletions
-12
View File
@@ -141,18 +141,6 @@ func (o *Ops) Reset() {
o.version++
}
func (o *Ops) Data() []byte {
return o.data
}
func (o *Ops) Refs() []interface{} {
return o.refs
}
func (o *Ops) Version() int {
return o.version
}
func (o *Ops) Write(n int) []byte {
o.data = append(o.data, make([]byte, n)...)
return o.data[len(o.data)-n:]
+4 -4
View File
@@ -81,9 +81,9 @@ func (r *Reader) Decode() (EncodedOp, bool) {
continue
}
}
data := r.ops.Data()
data := r.ops.data
data = data[r.pc.data:]
refs := r.ops.Refs()
refs := r.ops.refs
if len(data) == 0 {
if r.deferDone {
return EncodedOp{}, false
@@ -94,7 +94,7 @@ func (r *Reader) Decode() (EncodedOp, bool) {
r.pc = PC{}
continue
}
key := Key{ops: r.ops, pc: r.pc.data, version: r.ops.Version()}
key := Key{ops: r.ops, pc: r.pc.data, version: r.ops.version}
t := OpType(data[0])
n := t.Size()
nrefs := t.NumRefs()
@@ -128,7 +128,7 @@ func (r *Reader) Decode() (EncodedOp, bool) {
}
var op macroOp
op.decode(data, refs)
macroData := op.ops.Data()[op.pc.data:]
macroData := op.ops.data[op.pc.data:]
if OpType(macroData[0]) != TypeMacro {
panic("invalid macro reference")
}