mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-30 17:00:23 +02:00
repl compiles with warnings by default
* module/system/repl/command.scm (compile): Remove the bitrotten options. * module/system/repl/common.scm (repl-default-options): Add 'compile-options option. (repl-compile-options): Accessor for compile-options. (repl-compile): Use repl-compile-options. (repl-eval): Adapt to repl-compile interface change.
This commit is contained in:
parent
a5f9384211
commit
35d70eccac
2 changed files with 14 additions and 19 deletions
|
@ -333,17 +333,10 @@ Change languages."
|
||||||
;;; Compile commands
|
;;; Compile commands
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define-meta-command (compile repl (form) . opts)
|
(define-meta-command (compile repl (form))
|
||||||
"compile FORM
|
"compile FORM
|
||||||
Generate compiled code.
|
Generate compiled code."
|
||||||
|
(let ((x (repl-compile repl (repl-parse repl form))))
|
||||||
-e Stop after expanding syntax/macro
|
|
||||||
-t Stop after translating into GHIL
|
|
||||||
-c Stop after generating GLIL
|
|
||||||
|
|
||||||
-O Enable optimization
|
|
||||||
-D Add debug information"
|
|
||||||
(let ((x (apply repl-compile repl (repl-parse repl form) opts)))
|
|
||||||
(cond ((objcode? x) (guile:disassemble x))
|
(cond ((objcode? x) (guile:disassemble x))
|
||||||
(else (repl-print repl x)))))
|
(else (repl-print repl x)))))
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,8 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
|
||||||
(define-record/keywords <repl> language options tm-stats gc-stats)
|
(define-record/keywords <repl> language options tm-stats gc-stats)
|
||||||
|
|
||||||
(define repl-default-options
|
(define repl-default-options
|
||||||
'((trace . #f)
|
'((compile-options . (#:warnings (unbound-variable arity-mismatch)))
|
||||||
|
(trace . #f)
|
||||||
(interp . #f)))
|
(interp . #f)))
|
||||||
|
|
||||||
(define %make-repl make-repl)
|
(define %make-repl make-repl)
|
||||||
|
@ -132,13 +133,14 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
|
||||||
((language-reader (repl-language repl)) (current-input-port)
|
((language-reader (repl-language repl)) (current-input-port)
|
||||||
(current-module)))
|
(current-module)))
|
||||||
|
|
||||||
(define (repl-compile repl form . opts)
|
(define (repl-compile-options repl)
|
||||||
(let ((to (lookup-language (cond ((memq #:e opts) 'scheme)
|
(repl-option-ref repl 'compile-options))
|
||||||
((memq #:t opts) 'ghil)
|
|
||||||
((memq #:c opts) 'glil)
|
(define (repl-compile repl form)
|
||||||
(else 'objcode))))
|
(let ((from (repl-language repl))
|
||||||
(from (repl-language repl)))
|
(opts (repl-compile-options repl)))
|
||||||
(compile form #:from from #:to to #:opts opts #:env (current-module))))
|
(compile form #:from from #:to 'objcode #:opts opts
|
||||||
|
#:env (current-module))))
|
||||||
|
|
||||||
(define (repl-parse repl form)
|
(define (repl-parse repl form)
|
||||||
(let ((parser (language-parser (repl-language repl))))
|
(let ((parser (language-parser (repl-language repl))))
|
||||||
|
@ -150,7 +152,7 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
|
||||||
(or (null? (language-compilers (repl-language repl)))
|
(or (null? (language-compilers (repl-language repl)))
|
||||||
(assq-ref (repl-options repl) 'interp)))
|
(assq-ref (repl-options repl) 'interp)))
|
||||||
(lambda () (eval form (current-module)))
|
(lambda () (eval form (current-module)))
|
||||||
(make-program (repl-compile repl form '())))))
|
(make-program (repl-compile repl form)))))
|
||||||
(% (thunk))))
|
(% (thunk))))
|
||||||
|
|
||||||
(define (repl-print repl val)
|
(define (repl-print repl val)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue