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

Commit c5ef489

Browse files
committed
Respond to review feedback
1 parent 00cb3bd commit c5ef489

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

crates/wast/src/ast/types.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ impl<'a> Parse<'a> for ValType<'a> {
4646
} else if l.peek::<kw::anyfunc>() {
4747
parser.parse::<kw::anyfunc>()?;
4848
Ok(ValType::Ref(RefType::Func))
49-
} else if l.peek::<kw::r#externref>() {
50-
parser.parse::<kw::r#externref>()?;
49+
} else if l.peek::<kw::externref>() {
50+
parser.parse::<kw::externref>()?;
5151
Ok(ValType::Ref(RefType::Extern))
5252
} else if l.peek::<kw::anyref>() {
5353
// Parse `anyref` as an alias of `externref` until all tests are
@@ -89,12 +89,27 @@ impl<'a> Parse<'a> for ValType<'a> {
8989
#[allow(missing_docs)]
9090
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)]
9191
pub enum RefType<'a> {
92+
/// An untyped function reference: funcref. This is part of the reference
93+
/// types proposal.
9294
Func,
95+
/// A reference to any host value: externref. This was originally known as
96+
/// anyref when it was the supertype of all reference value types. This is
97+
/// part of the reference types proposal.
9398
Extern,
99+
/// A reference to an exception: exnref. This is part of the exception
100+
/// handling proposal.
94101
Exn,
102+
/// A reference that has an identity that can be compared: eqref. This is
103+
/// part of the GC proposal.
95104
Eq,
105+
/// An unboxed 31-bit integer: i31ref. This may be going away if there is no common
106+
/// supertype of all reference types. Part of the GC proposal.
96107
I31,
108+
/// A reference to a function, struct, or array: ref T. This is part of the
109+
/// GC proposal.
97110
Type(ast::Index<'a>),
111+
/// A nullable reference to a function, struct, or array: optref T. This is
112+
/// part of the GC proposal.
98113
OptType(ast::Index<'a>),
99114
}
100115

@@ -117,9 +132,6 @@ impl<'a> Parse<'a> for RefType<'a> {
117132
} else if l.peek::<kw::r#extern>() {
118133
parser.parse::<kw::r#extern>()?;
119134
Ok(RefType::Extern)
120-
} else if l.peek::<kw::any>() {
121-
parser.parse::<kw::any>()?;
122-
Ok(RefType::Extern)
123135
} else if l.peek::<kw::exn>() {
124136
parser.parse::<kw::exn>()?;
125137
Ok(RefType::Exn)

0 commit comments

Comments
 (0)