fix multiple places imported into the same module

This commit is contained in:
Kevin Tew 2012-02-01 11:48:36 -07:00
parent c2f5b7e0ed
commit 6ababab853
5 changed files with 36 additions and 2 deletions

View File

@ -1857,6 +1857,7 @@ path/s is either such a string or a list of them.
"collects/tests/racket/place-channel-socket.rkt" responsible (tewk) drdr:command-line (racket "-tm" *)
"collects/tests/racket/place-channel.rkt" responsible (tewk) drdr:command-line (racket "-tm" *) drdr:timeout 300
"collects/tests/racket/place.rktl" responsible (tewk) drdr:command-line (racket "-f" *)
"collects/tests/racket/places.rkt" responsible (tewk) drdr:command-line (racket *)
"collects/tests/racket/port.rktl" drdr:command-line #f
"collects/tests/racket/portlib.rktl" drdr:command-line #f
"collects/tests/racket/pretty.rktl" drdr:command-line (racket "-f" *)

View File

@ -219,6 +219,17 @@
(and (not out) outr)
(and (not err) errr)))]))
(define-for-syntax (modpath->string modpath)
(cond
[(equal? modpath #f)
(number->string (current-inexact-milliseconds))]
[else
(define name (resolved-module-path-name modpath))
(cond
[(symbol? name) (symbol->string name)]
[(path? name) (path->string name)])]))
(define-for-syntax (place-form _in _out _err _start-place-func stx orig-stx)
(syntax-case stx ()
[(who ch body1 body ...)
@ -226,14 +237,19 @@
;; when a `place' form is the only thing in a module mody:
#`(begin #,stx)
;; normal case:
(begin
(let ()
(unless (syntax-transforming-module-expression?)
(raise-syntax-error #f "can only be used in a module" stx))
(unless (identifier? #'ch)
(raise-syntax-error #f "expected an identifier" stx #'ch))
(define func-name-stx
(datum->syntax stx
(string->symbol
(string-append "place/anon"
(modpath->string (current-module-declare-name))))))
(with-syntax ([internal-def-name
(syntax-local-lift-expression #'(lambda (ch) body1 body ...))]
[func-name (generate-temporary #'place/anon)]
[func-name (generate-temporary func-name-stx)]
[in _in]
[out _out]
[err _err]

View File

@ -0,0 +1,7 @@
#lang racket/base
(require racket/place)
(provide p1)
(define (p1)
(place ch 1))

View File

@ -0,0 +1,7 @@
#lang racket/base
(require racket/place)
(provide p2)
(define (p2)
(place ch 1))

View File

@ -0,0 +1,3 @@
#lang racket/base
(require "place1.rkt")
(require "place2.rkt")