(block-partial-ancestry): allow ancestor to be same as starting block.
authorChris Hanson <org/chris-hanson/cph>
Wed, 14 Dec 1988 12:42:49 +0000 (12:42 +0000)
committerChris Hanson <org/chris-hanson/cph>
Wed, 14 Dec 1988 12:42:49 +0000 (12:42 +0000)
v7/src/compiler/base/blocks.scm

index 86886bcc0447e960e404ec48b99469e1aecca404..26d7cbdb6a256d833a50b73b0ded561c30c1e3ed 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/base/blocks.scm,v 4.6 1988/12/13 13:00:22 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/base/blocks.scm,v 4.7 1988/12/14 12:42:49 cph Exp $
 
 Copyright (c) 1988 Massachusetts Institute of Technology
 
@@ -220,11 +220,13 @@ from the continuation, and then "glued" into place afterwards.
        path)))
 
 (define (block-partial-ancestry block ancestor)
-  ;; (assert (or (not ancestor) (block-ancestor? block ancestor)))
-  (let loop ((block (block-parent block)) (path (list block)))
-    (if (eq? block ancestor)
-       path
-       (loop (block-parent block) (cons block path)))))
+  ;; (assert (or (not ancestor) (block-ancestor-or-self? block ancestor)))
+  (if (eq? block ancestor)
+      '()
+      (let loop ((block (block-parent block)) (path (list block)))
+       (if (eq? block ancestor)
+           path
+           (loop (block-parent block) (cons block path))))))
 
 (define (find-outermost-block block)
   ;; Should this check whether it is an expression/ic block or not?