Remove useless_const optimization

There could be jump depending on the Pop being there, and then it
breaks.
This commit is contained in:
coolreader18 2019-09-15 18:34:48 -05:00 committed by Windel Bouwman
parent b8726f03df
commit bff58fd626
3 changed files with 11 additions and 23 deletions

View file

@ -848,7 +848,9 @@ impl<O: OutputStream> Compiler<O> {
// Emit None at end:
match body.last().map(|s| &s.node) {
Some(ast::StatementType::Return { .. }) => {}
Some(ast::StatementType::Return { .. }) => {
// the last instruction is a ReturnValue already, we don't need to emit it
}
_ => {
self.emit(Instruction::LoadConst {
value: bytecode::Constant::None,