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

Commit 5f0a572

Browse files
author
Silas Davis
committed
Expose access to Ops to avoid stringly typing downstream
Signed-off-by: Silas Davis <[email protected]>
1 parent 01d3d33 commit 5f0a572

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

wasm/operators/op.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,7 @@ func New(code byte) (Op, error) {
8585
}
8686
return op, nil
8787
}
88+
89+
func Get(opcode byte) Op {
90+
return ops[opcode]
91+
}

wasm/operators/op_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,10 @@ func TestNew(t *testing.T) {
2828
t.Fatalf("0xff: operator %v is valid (should be invalid)", op2)
2929
}
3030
}
31+
32+
func TestGet(t *testing.T) {
33+
op := Get(CurrentMemory)
34+
if len(op.Name) == 0 {
35+
t.Fatalf("Expected non-empty name for CurrentMemory op")
36+
}
37+
}

0 commit comments

Comments
 (0)