Expanded instruction integrity checking in the verifier, now verifying result types and entity references.

This commit is contained in:
Angus Holder
2017-03-13 21:51:16 +00:00
committed by Jakob Stoklund Olesen
parent d3df198747
commit 477fb4d5da
3 changed files with 152 additions and 3 deletions

View File

@@ -233,6 +233,12 @@ impl<T: EntityRef> EntityList<T> {
pool.len_of(self).unwrap_or(0)
}
/// Returns `true` if the list is valid
pub fn is_valid(&self, pool: &ListPool<T>) -> bool {
// We consider an empty list to be valid
self.is_empty() || pool.len_of(self) != None
}
/// Get the list as a slice.
pub fn as_slice<'a>(&'a self, pool: &'a ListPool<T>) -> &'a [T] {
let idx = self.index as usize;