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

Commit

Permalink
validate: refactor validate module to use spec-defined algorithm
Browse files Browse the repository at this point in the history
Fixes #143.
  • Loading branch information
twitchyliquid64 authored and sbinet committed Sep 3, 2019
1 parent 4176795 commit 1e64ad3
Show file tree
Hide file tree
Showing 3 changed files with 290 additions and 210 deletions.
14 changes: 14 additions & 0 deletions validate/operand.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ import (
"github.com/go-interpreter/wagon/wasm"
)

const (
noReturn = wasm.ValueType(wasm.BlockTypeEmpty)
unknownType = wasm.ValueType(0)
)

type operand struct {
Type wasm.ValueType
}

// Equal returns true if the operand and given type are equivalent
// for typechecking purposes.
func (p operand) Equal(t wasm.ValueType) bool {
if p.Type == unknownType || t == unknownType {
return true
}
return p.Type == t
}
Loading

0 comments on commit 1e64ad3

Please sign in to comment.