]> Repositorios git - scryer-prolog.git/commitdiff
use slightly better names in indexing functions
authorMark Thom <[email protected]>
Fri, 1 May 2020 00:20:42 +0000 (18:20 -0600)
committerMark Thom <[email protected]>
Fri, 1 May 2020 00:20:42 +0000 (18:20 -0600)
src/prolog/indexing.rs
src/prolog/machine/machine_indices.rs
src/prolog/machine/machine_state_impl.rs

index 4873fc03251824a7c2714dca2a008b93574ee22a..75a4773698c11f883a80b7b0c163aea399a76559 100644 (file)
@@ -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())
index fe885bb948d1854f739297fbb7e0c37dfe289dfc..3c585d76638d368a87b4390cdbda7ad612e09883 100644 (file)
@@ -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()))
index 14e4679b4e2a54e936a486cea66168ff5d963b62..42e45b4d0b8b38a3caa5d45fa70e7c841a2ce352 100644 (file)
@@ -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,