Better way to setup the sandbox input.
original commit: 9f540bce011106dfcda7de2c13eae3bcd3d42582
This commit is contained in:
parent
5ead0f43e2
commit
d516bb877d
|
@ -13,16 +13,15 @@
|
|||
(list (car (sandbox-namespace-specs))
|
||||
'typed/racket
|
||||
'typed/scheme)])
|
||||
(let* ((lines (cdr (file->lines file))) ;; drop the #lang line
|
||||
(in (if optimize?
|
||||
lines
|
||||
(cdr lines))) ;; drop the #:optimize
|
||||
(evaluator
|
||||
(make-evaluator 'typed/racket
|
||||
(foldl (lambda (acc new)
|
||||
(string-append new "\n" acc))
|
||||
"" in)))
|
||||
(out (get-output evaluator)))
|
||||
;; drop the #lang line
|
||||
(let* ((prog (regexp-replace #rx"^#lang typed/(scheme|racket)(/base)?"
|
||||
(file->string file) ""))
|
||||
(in (if optimize?
|
||||
prog
|
||||
;; drop the #:optimize
|
||||
(regexp-replace #rx"#:optimize" prog "")))
|
||||
(evaluator (make-evaluator 'typed/racket in))
|
||||
(out (get-output evaluator)))
|
||||
(kill-evaluator evaluator)
|
||||
out)))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user