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

Commit

Permalink
Respond to review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
eqrion committed May 5, 2020
1 parent 00cb3bd commit d7bff68
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions crates/wast/src/ast/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ impl<'a> Parse<'a> for ValType<'a> {
} else if l.peek::<kw::anyfunc>() {
parser.parse::<kw::anyfunc>()?;
Ok(ValType::Ref(RefType::Func))
} else if l.peek::<kw::r#externref>() {
parser.parse::<kw::r#externref>()?;
} else if l.peek::<kw::externref>() {
parser.parse::<kw::externref>()?;
Ok(ValType::Ref(RefType::Extern))
} else if l.peek::<kw::anyref>() {
// Parse `anyref` as an alias of `externref` until all tests are
Expand Down Expand Up @@ -89,12 +89,21 @@ impl<'a> Parse<'a> for ValType<'a> {
#[allow(missing_docs)]
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)]
pub enum RefType<'a> {
/// An untyped function reference: funcref.
Func,
/// A reference to any host value: externref. This was originally known as
/// anyref when it was the supertype of all reference value types.
Extern,
/// A reference to an exception: exnref.
Exn,
/// A reference that has an identity that can be compared: eqref.
Eq,
/// An unboxed 31-bit integer: i31ref. This may be going away if there is no common
/// supertype of all reference types.
I31,
/// A reference to a function, struct, or array: ref T.
Type(ast::Index<'a>),
/// A nullable reference to a function, struct, or array: optref T.
OptType(ast::Index<'a>),
}

Expand All @@ -117,9 +126,6 @@ impl<'a> Parse<'a> for RefType<'a> {
} else if l.peek::<kw::r#extern>() {
parser.parse::<kw::r#extern>()?;
Ok(RefType::Extern)
} else if l.peek::<kw::any>() {
parser.parse::<kw::any>()?;
Ok(RefType::Extern)
} else if l.peek::<kw::exn>() {
parser.parse::<kw::exn>()?;
Ok(RefType::Exn)
Expand Down

0 comments on commit d7bff68

Please sign in to comment.