Make srclocs serializable.
This commit is contained in:
parent
6e02d12beb
commit
cc8bd4f294
|
@ -54,7 +54,8 @@
|
|||
(void? v)
|
||||
(date? v)
|
||||
(arity-at-least? v)
|
||||
(module-path-index? v)))
|
||||
(module-path-index? v)
|
||||
(srcloc? v)))
|
||||
|
||||
;; If a module is dynamic-required through a path,
|
||||
;; then it can cause simplified module paths to be paths;
|
||||
|
@ -191,7 +192,8 @@
|
|||
(char? v)
|
||||
(symbol? v)
|
||||
(null? v)
|
||||
(void? v))
|
||||
(void? v)
|
||||
(srcloc? v))
|
||||
(void)]
|
||||
[(hash-ref cycle v #f)
|
||||
;; We already know that this value is
|
||||
|
@ -367,6 +369,9 @@
|
|||
(cons 'mpi
|
||||
(cons ((serial #t) path)
|
||||
((serial #t) base))))]
|
||||
[(srcloc? v)
|
||||
(cons 'srcloc
|
||||
(map (serial #t) (take (struct->list v) 5)))]
|
||||
[else (error 'serialize "shouldn't get here")]))
|
||||
((serial check-share?) v))
|
||||
|
||||
|
@ -529,6 +534,7 @@
|
|||
[(arity-at-least) (make-arity-at-least (loop (cdr v)))]
|
||||
[(mpi) (module-path-index-join (loop (cadr v))
|
||||
(loop (cddr v)))]
|
||||
[(srcloc) (apply make-srcloc (map loop (cdr v)))]
|
||||
[else (error 'serialize "ill-formed serialization")])])))
|
||||
|
||||
(define (deserial-shell v mod-map fixup n)
|
||||
|
|
|
@ -48,7 +48,8 @@ The following kinds of values are serializable:
|
|||
@item{@tech{pairs}, @tech{mutable pairs}, @tech{vectors}, @tech{flvectors}, @tech{fxvectors},
|
||||
@tech{box}es, @tech{hash tables}, and @tech{sets};}
|
||||
|
||||
@item{@racket[date], @racket[date*], and @racket[arity-at-least] structures; and}
|
||||
@item{@racket[date], @racket[date*], @racket[arity-at-least] and @racket[srcloc]
|
||||
structures; and}
|
||||
|
||||
@item{@tech{module path index} values.}
|
||||
|
||||
|
@ -178,6 +179,10 @@ elements:
|
|||
this case does not appear in output generated by
|
||||
@racket[serialize]).}
|
||||
|
||||
@item{@racket['srcloc] for a @racket[srcloc] structure, which
|
||||
fails on deserialization (since srclocs are immutable;
|
||||
this case does not appear in output generated by
|
||||
@racket[serialize]).}
|
||||
]
|
||||
|
||||
The @racket[#f]-filled value will be updated with content specified
|
||||
|
@ -309,6 +314,9 @@ elements:
|
|||
@tech{module path index} that joins the paired
|
||||
values.}
|
||||
|
||||
@item{a pair whose @racket[car] is @racket['srcloc] and whose
|
||||
@racket[cdr] is a list of serials; it represents a
|
||||
@racket[srcloc] structure.}
|
||||
]}
|
||||
|
||||
]}
|
||||
|
|
|
@ -163,6 +163,9 @@
|
|||
(test-ser (make-c 30))
|
||||
(test-ser (make-d 100 200 300))
|
||||
|
||||
(test-ser (make-srcloc 1 2 3 4 5))
|
||||
(test-ser (make-srcloc (string->path "/tmp/test.rkt") 2 3 4 5))
|
||||
|
||||
;; Simple sharing
|
||||
(let ([p (cons 1 2)])
|
||||
(test-ser (cons p p))
|
||||
|
|
Loading…
Reference in New Issue
Block a user