Skip to content

Commit

Permalink
Parse memory owners for data segments
Browse files Browse the repository at this point in the history
This is new syntax introduced by the most recent proposal for bulk memory
  • Loading branch information
alexcrichton committed Dec 17, 2019
1 parent 1dee27f commit 90cd0e1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/wast/src/ast/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,14 @@ impl<'a> Parse<'a> for Data<'a> {
// ... and otherwise we must be attached to a particular memory as well
// as having an initialization offset.
} else {
let memory = parser.parse::<Option<ast::Index>>()?;
let memory = if parser.peek2::<kw::memory>() {
Some(parser.parens(|p| {
p.parse::<kw::memory>()?;
p.parse()
})?)
} else {
parser.parse()?
};
let offset = parser.parens(|parser| {
if parser.peek::<kw::offset>() {
parser.parse::<kw::offset>()?;
Expand Down

0 comments on commit 90cd0e1

Please sign in to comment.