count a unit among its own imports
Two modules importing each other with pub hand the unit its own interface back, and its types were defined twice.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
(export
|
||||
get-modules-public-forms
|
||||
mark-imported!
|
||||
load-persistent-module-paths
|
||||
check-public-interface
|
||||
module-dependencies
|
||||
@@ -29,6 +30,12 @@
|
||||
;;; once)
|
||||
(define +imported-modules+ (list))
|
||||
|
||||
;;; The unit is one of its own imports from the start: two modules that
|
||||
;;; import each other with pub hand it its own interface back otherwise,
|
||||
;;; and its types are defined twice
|
||||
(define (mark-imported! path)
|
||||
(set! +imported-modules+ (cons (normalize-pathname path) +imported-modules+)))
|
||||
|
||||
(define (get-modules-public-forms import-form)
|
||||
;; How Sex handles modules:
|
||||
;; For each module IMPORT-FORM names, construct path, find module by
|
||||
@@ -43,10 +50,11 @@
|
||||
(module-path (locate-module name directory)))
|
||||
(unless module-path
|
||||
(sex-error form "Failed to find module" name (get-module-paths directory)))
|
||||
(if (member module-path +imported-modules+)
|
||||
(if (member (normalize-pathname module-path) +imported-modules+)
|
||||
(list)
|
||||
(begin
|
||||
(set! +imported-modules+ (cons module-path +imported-modules+))
|
||||
(set! +imported-modules+ (cons (normalize-pathname module-path)
|
||||
+imported-modules+))
|
||||
(read-public-interface module-path)))))
|
||||
|
||||
;;; An import is looked for beside the file it is written in, so a
|
||||
|
||||
Reference in New Issue
Block a user