forked from alex-eg/sex
look for an import beside the file it is written in
Imports were looked for from the unit's directory, so a module in a subdirectory could not import its neighbours: a pub import failed, a private one lost its handle declarations, and --public-interface changed with where sexc ran.
This commit is contained in:
8
tests/modules/shelf/book.sex
Normal file
8
tests/modules/shelf/book.sex
Normal file
@@ -0,0 +1,8 @@
|
||||
;;; Its imports are found beside it, wherever the unit importing it is
|
||||
(pub import page)
|
||||
(import spine)
|
||||
|
||||
(pub record book ((spine (* spine)) (first page)))
|
||||
|
||||
(pub fn second-page ((b (* const book))) page
|
||||
(return (page-after (. b first))))
|
||||
4
tests/modules/shelf/page.sex
Normal file
4
tests/modules/shelf/page.sex
Normal file
@@ -0,0 +1,4 @@
|
||||
(pub record page ((number int)))
|
||||
|
||||
(pub fn page-after ((p page)) page
|
||||
(return #(page : (+ (. p number) 1))))
|
||||
3
tests/modules/shelf/spine.sex
Normal file
3
tests/modules/shelf/spine.sex
Normal file
@@ -0,0 +1,3 @@
|
||||
;;; book imports this without `pub', so book's importers get the record
|
||||
;;; behind a pointer, declared and no more
|
||||
(pub record spine ((width int)))
|
||||
Reference in New Issue
Block a user