Remove a hack in parser.

This commit is contained in:
losfair 2019-02-21 21:12:58 +08:00
parent aaabbf169c
commit 6f97ebd5f7

View File

@ -288,18 +288,10 @@ pub fn read_module<
fcg.feed_local(ty, count as usize)?; fcg.feed_local(ty, count as usize)?;
} }
fcg.begin_body()?; fcg.begin_body()?;
let mut last_is_return = false;
for op in item.get_operators_reader()? { for op in item.get_operators_reader()? {
let op = op?; let op = op?;
last_is_return = match op {
Operator::Return => true,
_ => false,
};
fcg.feed_opcode(op)?; fcg.feed_opcode(op)?;
} }
if !last_is_return {
fcg.feed_opcode(Operator::Return)?;
}
fcg.finalize()?; fcg.finalize()?;
} }
} }