Commits

Carl Friedrich Bolz committed ee7f3b3

kill unused method

Comments (0)

Files changed (2)

prolog/interpreter/shape.py

             newstorage[i] = self.get_storage(i)
         for i in range(obj.size_storage()):
             child = newstorage[i + index] = obj.get_storage(i)
+            # XXX whew, subtle logic here
             if isinstance(child, term.VarInTerm):
                 indicator = child.indicator
                 deref = child.getbinding()
         offset = obj.size_storage() - 1
         for i in range(index + 1, self.size_storage()):
             child = newstorage[i + offset] = self.get_storage(i)
+            # XXX whew, subtle logic here
             if isinstance(child, term.VarInTerm) and child.parent is self:
                 assert isinstance(self, ShapedCallableMutable)
                 indicator = child.indicator
                 return self._replace_child(index, obj, new_shape)
         return None
 
-    @jit.unroll_safe
-    def _fixup_var_in_term(self, obj, index):
-        # XXX whew, subtle logic here
-        newi = index
-        for i in range(obj.size_storage()):
-            old_child = obj.get_storage(i)
-            assert self.get_storage(newi) is old_child
-            if isinstance(old_child, term.VarInTerm):
-                deref = old_child.getbinding()
-                if deref is None:
-                    self = self._make_mutable()
-                    old_child.parent = self
-                    old_child.indicator = term.VarInTermIndex.build(newi)
-                else:
-                    self.set_storage(newi, deref)
-            newi += 1
-        return self
-
     @staticmethod
     @jit.unroll_safe
     def build(shape, storage):

prolog/interpreter/test/test_shape.py

     c1._replace_child(0, c2, newshape)
     assert c1.storage == [b, nil, a]
 
-def test_fixup_var_in_term():
-    from prolog.interpreter.heap import Heap
-    h = Heap()
-    sig = signature.Signature.getsignature(".", 2)
-    build = shape.SharingShape
-    X = shape.InStorageShape.build()
-    s1 = build(sig, [X, X])
-    s2 = s1.replace(1, s1)
-
-    a = term.Callable.build("a")
-    b = term.Callable.build("b")
-    nil = term.Callable.build("[]")
-
-    # an unbound VarInTerm is updated to point to the new parent
-    obj = shape.ShapedCallableMutable(s1, [b, None])
-    var = h.newvar_in_term(obj, 1)
-    obj.storage[1] = var
-
-    self = shape.ShapedCallableMutable(s2, [a] + obj.storage)
-    self._fixup_var_in_term(obj, 1)
-    assert self.storage[2] is var
-    assert var.parent is self
-    assert var.indicator.index == 2
-
-
-    # an bound VarInTerm is shunted
-    obj = shape.ShapedCallableMutable(s1, [b, None])
-    var = h.newvar_in_term(obj, 0)
-    obj.storage[1] = var # it happens to live at index 1, but it's bound to b
-
-    self = shape.ShapedCallableMutable(s2, [a] + obj.storage)
-    self._fixup_var_in_term(obj, 1)
-    assert self.storage[2] is b
-    assert var.parent is obj
-    assert var.indicator.index == 0
-
 def test_replace_child_fixup_varinterm_at_end():
     from prolog.interpreter.heap import Heap
     h = Heap()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.