all: remove exported Decode methods on operations

Add decode functions to the packages that need them instead. For
TransformOp that is used in multiple packages, add the decode
function to the internal ops package.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-08-07 15:52:22 +02:00
parent 4d66669a9e
commit 6e26c92c75
10 changed files with 141 additions and 136 deletions
-19
View File
@@ -115,16 +115,6 @@ func (h HandlerOp) Add(o *ui.Ops) {
o.Write(data, h.Key)
}
func (h *HandlerOp) Decode(d []byte, refs []interface{}) {
if opconst.OpType(d[0]) != opconst.TypePointerHandler {
panic("invalid op")
}
*h = HandlerOp{
Grab: d[1] != 0,
Key: refs[0].(input.Key),
}
}
func (op PassOp) Add(o *ui.Ops) {
data := make([]byte, opconst.TypePassLen)
data[0] = byte(opconst.TypePass)
@@ -134,15 +124,6 @@ func (op PassOp) Add(o *ui.Ops) {
o.Write(data)
}
func (op *PassOp) Decode(d []byte) {
if opconst.OpType(d[0]) != opconst.TypePass {
panic("invalid op")
}
*op = PassOp{
Pass: d[1] != 0,
}
}
func (t Type) String() string {
switch t {
case Press: