remove Div for ast.rs
This commit is contained in:
@@ -3,6 +3,7 @@ use prolog::ast::*;
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::vec::Vec;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Frame {
|
||||
pub global_index: usize,
|
||||
pub b0: usize,
|
||||
@@ -12,13 +13,13 @@ pub struct Frame {
|
||||
}
|
||||
|
||||
impl Frame {
|
||||
fn new(global_index: usize, sz: usize, e: usize, cp: CodePtr, n: usize) -> Self {
|
||||
fn new(global_index: usize, fr: usize, e: usize, cp: CodePtr, n: usize) -> Self {
|
||||
Frame {
|
||||
global_index: global_index,
|
||||
global_index,
|
||||
b0: 0,
|
||||
e: e,
|
||||
cp: cp,
|
||||
perms: (1 .. n+1).map(|i| Addr::StackCell(sz, i)).collect()
|
||||
perms: (1 .. n+1).map(|i| Addr::StackCell(fr, i)).collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +48,10 @@ impl AndStack {
|
||||
pub fn clear(&mut self) {
|
||||
self.0.clear()
|
||||
}
|
||||
|
||||
pub fn pop(&mut self) {
|
||||
self.0.pop();
|
||||
}
|
||||
}
|
||||
|
||||
impl Index<usize> for AndStack {
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::collections::{HashMap, VecDeque};
|
||||
use std::fmt;
|
||||
use std::io::Error as IOError;
|
||||
use std::num::{ParseFloatError};
|
||||
use std::ops::{Add, AddAssign, Sub, Mul, Div, Neg};
|
||||
use std::ops::{Add, AddAssign, Sub, Mul, Neg};
|
||||
use std::str::Utf8Error;
|
||||
use std::vec::Vec;
|
||||
|
||||
|
||||
@@ -1511,9 +1511,10 @@ impl MachineState {
|
||||
match instr {
|
||||
&ControlInstruction::Allocate(num_cells) => {
|
||||
let num_frames = self.num_frames();
|
||||
self.and_stack.push(num_frames + 1, self.e, self.cp, num_cells);
|
||||
|
||||
self.and_stack.push(num_frames + 1, self.e, self.cp, num_cells);
|
||||
self.e = self.and_stack.len() - 1;
|
||||
|
||||
self.p += 1;
|
||||
},
|
||||
&ControlInstruction::Call(ref name, arity, _) =>
|
||||
@@ -1538,7 +1539,7 @@ impl MachineState {
|
||||
|
||||
self.cp = self.and_stack[e].cp;
|
||||
self.e = self.and_stack[e].e;
|
||||
|
||||
|
||||
self.p += 1;
|
||||
},
|
||||
&ControlInstruction::Execute(ref name, arity) =>
|
||||
|
||||
Reference in New Issue
Block a user