use slightly better names in indexing functions
This commit is contained in:
@@ -54,7 +54,7 @@ impl CodeOffsets {
|
||||
}
|
||||
}
|
||||
|
||||
fn intercept_constant(&mut self, constant: &Constant, index: usize) {
|
||||
fn intercept_overlapping_constant(&mut self, constant: &Constant, index: usize) {
|
||||
match constant {
|
||||
&Constant::Atom(ref name, ref op) if name.is_char() => {
|
||||
let c = name.as_str().chars().next().unwrap();
|
||||
@@ -162,7 +162,7 @@ impl CodeOffsets {
|
||||
self.lists.push(Self::add_index(is_initial_index, index));
|
||||
}
|
||||
&Term::Constant(_, ref constant) => {
|
||||
self.intercept_constant(constant, index);
|
||||
self.intercept_overlapping_constant(constant, index);
|
||||
|
||||
let code = self.constants
|
||||
.entry(constant.clone())
|
||||
|
||||
@@ -238,7 +238,7 @@ impl Addr {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_constant(&self, machine_st: &MachineState) -> Option<Constant> {
|
||||
pub fn as_constant_index(&self, machine_st: &MachineState) -> Option<Constant> {
|
||||
match self {
|
||||
&Addr::Char(c) => {
|
||||
Some(Constant::Char(c))
|
||||
@@ -249,7 +249,7 @@ impl Addr {
|
||||
&Addr::Con(h) => {
|
||||
match &machine_st.heap[h] {
|
||||
&HeapCellValue::Atom(ref name, ref op) => {
|
||||
Some(Constant::Atom(name.clone(), op.clone()))
|
||||
Some(Constant::Atom(name.clone(), None))
|
||||
}
|
||||
&HeapCellValue::Integer(ref n) => {
|
||||
Some(Constant::Integer(n.clone()))
|
||||
|
||||
@@ -1433,7 +1433,7 @@ impl MachineState {
|
||||
let addr = self.store(self.deref(addr));
|
||||
|
||||
let offset =
|
||||
match addr.as_constant(&self) {
|
||||
match addr.as_constant_index(&self) {
|
||||
Some(c) => {
|
||||
match hm.get(&c) {
|
||||
Some(offset) => *offset,
|
||||
|
||||
Reference in New Issue
Block a user