Commits

Rene Bartelmus  committed 8a7a155

Fixed bug with and-compounded terms

  • Participants
  • Parent commits 3903493
  • Branches tracing-support

Comments (0)

Files changed (1)

File prolog/interpreter/continuation.py

                 else:
                     write("\n")
 
+            # XXX make with dict
             decision = getattr(self, "action_"+res)
             ans = decision(fcont, heap)
             if ans is not None:
         if self.port == "Call":
             nextcont, fcont, heap = self.innercont.activate(fcont, heap)
             depth += 1
+        elif self.port == "Exit" and isinstance(fcont, TraceFailureContinuation):
+            # unwrap corresponding fail
+            fcont = fcont.innerfcont
         nextcont = nextcont.trace_wrap(depth)
         fcont = nextcont.make_next_fcont(fcont)
         return nextcont, fcont, heap
     # XXX crop processed TraceFailureContinuations
     def make_next_fcont(self, fcont):
         """ Prepend an element to fcont-chain for fail output, if innercont fails. """
-        nextc = self.innercont
-        if isinstance(nextc, RuleContinuation) or (isinstance(nextc, BuiltinContinuation) and
-                    nextc.builtin.should_trace):
-            fcont = fcont.trace_wrap(self.depth, scont=self)
+        if self.port != "Exit":
+            nextc = self.innercont
+            if isinstance(nextc, RuleContinuation) or (isinstance(nextc, BuiltinContinuation) and
+                        nextc.builtin.should_trace):
+                fcont = fcont.trace_wrap(self.depth, scont=self)
         return fcont
 
     def trace_wrap(self, depth, query=None):