clean up codegen.rs
This commit is contained in:
@@ -8,7 +8,6 @@ use prolog::targets::*;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::collections::HashMap;
|
||||
use std::mem::swap;
|
||||
use std::vec::Vec;
|
||||
|
||||
pub struct CodeGenerator<'a, TermMarker> {
|
||||
@@ -286,11 +285,8 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<'a, TermMarker>
|
||||
let mut dealloc_index = code.len() - 1;
|
||||
|
||||
match code.last_mut() {
|
||||
Some(&mut Line::Control(ref mut ctrl)) => {
|
||||
let mut instr = ControlInstruction::Proceed;
|
||||
swap(ctrl, &mut instr);
|
||||
|
||||
match instr {
|
||||
Some(&mut Line::Control(ref mut ctrl)) =>
|
||||
match ctrl.clone() {
|
||||
ControlInstruction::ArgCall =>
|
||||
*ctrl = ControlInstruction::ArgExecute,
|
||||
ControlInstruction::Call(name, arity, _) =>
|
||||
@@ -313,8 +309,7 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<'a, TermMarker>
|
||||
*ctrl = ControlInstruction::IsExecute(r, at),
|
||||
ControlInstruction::Proceed => {},
|
||||
_ => dealloc_index += 1 // = code.len()
|
||||
}
|
||||
},
|
||||
},
|
||||
Some(&mut Line::Cut(CutInstruction::Cut)) =>
|
||||
dealloc_index += 1,
|
||||
_ => {}
|
||||
|
||||
Reference in New Issue
Block a user