restore the import code on reset to provide consistent error message
original commit: 3da0f8ed90b849ea4a72d37169fa78652058d70f
This commit is contained in:
parent
47e236a07c
commit
8b9b2e6b10
2
LOG
2
LOG
|
@ -1001,3 +1001,5 @@
|
||||||
compile.ss
|
compile.ss
|
||||||
- clarify "unknown module" error message in determine-module-imports
|
- clarify "unknown module" error message in determine-module-imports
|
||||||
syntax.ss
|
syntax.ss
|
||||||
|
- restore the import code on reset to provide consistent error message
|
||||||
|
syntax.ss, 8.ms
|
42
mats/8.ms
42
mats/8.ms
|
@ -8977,7 +8977,47 @@
|
||||||
(eval '(lookup f g) (environment '(testfile-lr-l3) '(lookup))))])
|
(eval '(lookup f g) (environment '(testfile-lr-l3) '(lookup))))])
|
||||||
(eval '(lookup f g) (environment '(testfile-lr-l3) '(lookup))))))
|
(eval '(lookup f g) (environment '(testfile-lr-l3) '(lookup))))))
|
||||||
"Exception in h: user requested failure with (make-it-fail) parameter\nException in h: user requested failure with (make-it-fail) parameter\n")
|
"Exception in h: user requested failure with (make-it-fail) parameter\nException in h: user requested failure with (make-it-fail) parameter\n")
|
||||||
)
|
|
||||||
|
;; re-arm import code if it complains about a library that is not visible
|
||||||
|
(begin
|
||||||
|
(with-output-to-file "testfile-lr-l4.ss"
|
||||||
|
(lambda ()
|
||||||
|
(pretty-print
|
||||||
|
'(library (testfile-lr-l4)
|
||||||
|
(export x)
|
||||||
|
(import (chezscheme))
|
||||||
|
(define x 123))))
|
||||||
|
'replace)
|
||||||
|
(with-output-to-file "testfile-lr-p4.ss"
|
||||||
|
(lambda ()
|
||||||
|
(for-each pretty-print
|
||||||
|
'((import (testfile-lr-l4) (scheme))
|
||||||
|
(define (run args)
|
||||||
|
(guard (c [#t (display-condition c) (newline)])
|
||||||
|
(pretty-print (top-level-value (car args) (environment (cdr args))))))
|
||||||
|
(when (> x 0) ;; reference export
|
||||||
|
(let ([args (map string->symbol (command-line-arguments))])
|
||||||
|
(if (= (length args) 2)
|
||||||
|
(begin
|
||||||
|
(run args)
|
||||||
|
(run args))
|
||||||
|
(error #f "expected 2 args")))))))
|
||||||
|
'replace)
|
||||||
|
(separate-eval
|
||||||
|
'(parameterize ([compile-imported-libraries #t] [generate-wpo-files #t])
|
||||||
|
(compile-program "testfile-lr-p4.ss")
|
||||||
|
(compile-whole-program "testfile-lr-p4.wpo" "testfile-lr-p4-visible" #t)
|
||||||
|
(compile-whole-program "testfile-lr-p4.wpo" "testfile-lr-p4-not-visible" #f)))
|
||||||
|
(equal?
|
||||||
|
(separate-eval
|
||||||
|
'(parameterize ([command-line-arguments '("x" "testfile-lr-l4")])
|
||||||
|
(load-program "testfile-lr-p4-visible")
|
||||||
|
(load-program "testfile-lr-p4-not-visible")))
|
||||||
|
(string-append
|
||||||
|
"123\n"
|
||||||
|
"123\n"
|
||||||
|
"Exception in visit: library (testfile-lr-l4) is not visible\n"
|
||||||
|
"Exception in visit: library (testfile-lr-l4) is not visible\n"))))
|
||||||
|
|
||||||
(mat cross-library-optimization
|
(mat cross-library-optimization
|
||||||
(begin
|
(begin
|
||||||
|
|
|
@ -5147,10 +5147,11 @@
|
||||||
(when (eq? p 'loading)
|
(when (eq? p 'loading)
|
||||||
($oops #f "attempt to import library ~s while it is still being loaded" (libdesc-path desc)))
|
($oops #f "attempt to import library ~s while it is still being loaded" (libdesc-path desc)))
|
||||||
(libdesc-import-code-set! desc #f)
|
(libdesc-import-code-set! desc #f)
|
||||||
(for-each (lambda (req) (import-library (libreq-uid req))) (libdesc-import-req* desc))
|
(on-reset (libdesc-import-code-set! desc p)
|
||||||
($install-library-clo-info (libdesc-clo* desc))
|
(for-each (lambda (req) (import-library (libreq-uid req))) (libdesc-import-req* desc))
|
||||||
(libdesc-clo*-set! desc '())
|
($install-library-clo-info (libdesc-clo* desc))
|
||||||
(p))]))]
|
(libdesc-clo*-set! desc '())
|
||||||
|
(p)))]))]
|
||||||
[else ($oops #f "library ~:s is not defined" uid)])))
|
[else ($oops #f "library ~:s is not defined" uid)])))
|
||||||
|
|
||||||
; invoking or visiting a possibly unloaded library occurs in two separate steps:
|
; invoking or visiting a possibly unloaded library occurs in two separate steps:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user