(let ((class (assq package classes)))
(if class
(format-package/bindings port indentation width package (cdr class)))
+ (format-package/inherited port indentation width package)
(for-each (lambda (class)
(if (not (eq? package (car class)))
(format-package/imports port indentation width package
")")
name)))))
+(define (format-package/inherited port indentation width package)
+ (let ((inherited
+ (filter (lambda (reference)
+ (let ((binding (reference/binding reference)))
+ (and binding
+ (ancestor-package? (binding/package binding)
+ package))))
+ (package/references package))))
+ (if (pair? inherited)
+ (begin
+ (newline port)
+ (format-references port indentation width "Inherited" package
+ (sort inherited reference<?))))))
+
(define (format-package/imports port indentation width local-package
remote-package bindings)
(format-exports port indentation width local-package remote-package bindings
(set-package/bindings! package
(cons binding (package/bindings package))))
+(define (ancestor-package? p1 p2)
+ (let ((parent (package/parent p2)))
+ (and parent
+ (or (eq? p1 parent)
+ (ancestor-package? p1 parent)))))
+
(define-integrable (file-case/type file-case)
(car file-case))