Skip to content
This repository was archived by the owner on May 11, 2020. It is now read-only.

Expose access to Ops to avoid stringly typing downstream #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wasm/operators/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,7 @@ func New(code byte) (Op, error) {
}
return op, nil
}

func Get(opcode byte) Op {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a doc string for this?

return ops[opcode]
}
7 changes: 7 additions & 0 deletions wasm/operators/op_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@ func TestNew(t *testing.T) {
t.Fatalf("0xff: operator %v is valid (should be invalid)", op2)
}
}

func TestGet(t *testing.T) {
op := Get(CurrentMemory)
if len(op.Name) == 0 {
t.Fatalf("Expected non-empty name for CurrentMemory op")
}
}