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

Commit 1e64ad3

Browse files
twitchyliquid64sbinet
authored andcommitted
validate: refactor validate module to use spec-defined algorithm
Fixes #143.
1 parent 4176795 commit 1e64ad3

File tree

3 files changed

+290
-210
lines changed

3 files changed

+290
-210
lines changed

validate/operand.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ import (
88
"github.com/go-interpreter/wagon/wasm"
99
)
1010

11+
const (
12+
noReturn = wasm.ValueType(wasm.BlockTypeEmpty)
13+
unknownType = wasm.ValueType(0)
14+
)
15+
1116
type operand struct {
1217
Type wasm.ValueType
1318
}
19+
20+
// Equal returns true if the operand and given type are equivalent
21+
// for typechecking purposes.
22+
func (p operand) Equal(t wasm.ValueType) bool {
23+
if p.Type == unknownType || t == unknownType {
24+
return true
25+
}
26+
return p.Type == t
27+
}

0 commit comments

Comments
 (0)