remove Div for ast.rs
This commit is contained in:
@@ -3,6 +3,7 @@ use prolog::ast::*;
|
|||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct Frame {
|
pub struct Frame {
|
||||||
pub global_index: usize,
|
pub global_index: usize,
|
||||||
pub b0: usize,
|
pub b0: usize,
|
||||||
@@ -12,13 +13,13 @@ pub struct Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl 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 {
|
Frame {
|
||||||
global_index: global_index,
|
global_index,
|
||||||
b0: 0,
|
b0: 0,
|
||||||
e: e,
|
e: e,
|
||||||
cp: cp,
|
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) {
|
pub fn clear(&mut self) {
|
||||||
self.0.clear()
|
self.0.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn pop(&mut self) {
|
||||||
|
self.0.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Index<usize> for AndStack {
|
impl Index<usize> for AndStack {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use std::collections::{HashMap, VecDeque};
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io::Error as IOError;
|
use std::io::Error as IOError;
|
||||||
use std::num::{ParseFloatError};
|
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::str::Utf8Error;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
|
|||||||
@@ -1511,9 +1511,10 @@ impl MachineState {
|
|||||||
match instr {
|
match instr {
|
||||||
&ControlInstruction::Allocate(num_cells) => {
|
&ControlInstruction::Allocate(num_cells) => {
|
||||||
let num_frames = self.num_frames();
|
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.e = self.and_stack.len() - 1;
|
||||||
|
|
||||||
self.p += 1;
|
self.p += 1;
|
||||||
},
|
},
|
||||||
&ControlInstruction::Call(ref name, arity, _) =>
|
&ControlInstruction::Call(ref name, arity, _) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user