leftovers.scm 672 B

1234567891011121314151617181920212223242526
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Richard Kelsey
  3. ; Identifying values called by primops
  4. ; Is NODE the value being called by a primop?
  5. (define (procedure-node? node)
  6. (let ((parent (node-parent node)))
  7. (and (node? parent)
  8. (let ((primop (call-primop parent)))
  9. (and (primop-procedure? primop)
  10. (eq? (primop-call-index primop)
  11. (node-index node)))))))
  12. ; Get the node called at CALL.
  13. (define (called-procedure-node call)
  14. (cond ((and (primop-procedure? (call-primop call))
  15. (primop-call-index (call-primop call)))
  16. => (lambda (i)
  17. (call-arg call i)))
  18. (else '#f)))