From 57ea31cca214476fc7abf2a897c9fc8626e19fdf Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Mon, 29 Aug 2011 16:36:24 -0400 Subject: [PATCH] With 4f83f7f, the hack around PR7104 is no longer needed. --- collects/ffi/unsafe.rkt | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/collects/ffi/unsafe.rkt b/collects/ffi/unsafe.rkt index 961bd9bf9a..4a21d279fd 100644 --- a/collects/ffi/unsafe.rkt +++ b/collects/ffi/unsafe.rkt @@ -247,31 +247,16 @@ ;; The `_fun' macro tears its input apart and reassemble it using pieces from ;; custom function types (macros). This whole deal needs some work to make - ;; it play nicely with taints and code inspectors, so Matthew wrote the following - ;; code. The idea is to create a define-fun-syntax which makes the new - ;; syntax transformer be an object that carries extra information, later used - ;; by `expand-fun-syntax/fun'. + ;; it play nicely with taints and code inspectors, so Matthew wrote the + ;; following code. The idea is to create a define-fun-syntax which makes the + ;; new syntax transformer be an object that carries extra information, later + ;; used by `expand-fun-syntax/fun'. (define orig-inspector (current-code-inspector)) (define (disarm stx) (syntax-disarm stx orig-inspector)) - ;; bug in begin-for-syntax (PR7104), see below - (define foo!!! (make-parameter #f)) - (define (expand-fun-syntax/normal fun-stx stx) - ((foo!!!) fun-stx stx)) - - (define-values (make-fun-syntax fun-syntax? - fun-syntax-proc fun-syntax-name) - (let-values ([(desc make pred? get set!) - (make-struct-type - 'fun-syntax #f 2 0 #f '() (current-inspector) - expand-fun-syntax/normal)]) - (values make pred? - (make-struct-field-accessor get 0 'proc) - (make-struct-field-accessor get 1 'name)))) - ;; This is used to expand a fun-syntax in a _fun type context. (define (expand-fun-syntax/fun stx) (let loop ([stx stx]) @@ -370,9 +355,7 @@ ;; This is used for a normal expansion of fun-syntax, when not in a _fun type ;; context. - ;; bug in begin-for-syntax (PR7104), see above - ;; should be (define (expand-fun-syntax/normal fun-stx stx) ...) - (foo!!! (lambda (fun-stx stx) + (define (expand-fun-syntax/normal fun-stx stx) (define (err msg . sub) (apply raise-syntax-error (fun-syntax-name fun-stx) msg stx sub)) (let ([keys (custom-type->keys stx err)]) @@ -404,7 +387,17 @@ ;; simple type type)) ;; no keys => normal expansion - ((fun-syntax-proc fun-stx) stx)))))) + ((fun-syntax-proc fun-stx) stx)))) + + (define-values (make-fun-syntax fun-syntax? + fun-syntax-proc fun-syntax-name) + (let-values ([(desc make pred? get set!) + (make-struct-type + 'fun-syntax #f 2 0 #f '() (current-inspector) + expand-fun-syntax/normal)]) + (values make pred? + (make-struct-field-accessor get 0 'proc) + (make-struct-field-accessor get 1 'name))))) ;; Use define-fun-syntax instead of define-syntax for forms that ;; are to be expanded by `_fun':