Skip to content

Commit 47718c4

Browse files
Copilotjackfirth
andcommitted
Change syntax-path->string to return immutable-string?
Co-authored-by: jackfirth <[email protected]>
1 parent 6d4cb05 commit 47718c4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

private/syntax-path.rkt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
[syntax-path-add (-> syntax-path? exact-nonnegative-integer? syntax-path?)]
2121
[syntax-path-remove-prefix (-> syntax-path? syntax-path? syntax-path?)]
2222
[syntax-path-neighbors? (-> syntax-path? syntax-path? boolean?)]
23-
[syntax-path->string (-> syntax-path? string?)]
23+
[syntax-path->string (-> syntax-path? immutable-string?)]
2424
[string->syntax-path (-> string? syntax-path?)]
2525
[syntax-ref (-> syntax? syntax-path? syntax?)]
2626
[syntax-set (-> syntax? syntax-path? syntax? syntax?)]
@@ -38,6 +38,7 @@
3838
racket/syntax)
3939
data/order
4040
guard
41+
racket/mutability
4142
racket/sequence
4243
racket/string
4344
racket/struct
@@ -218,11 +219,12 @@
218219

219220

220221
(define (syntax-path->string path)
221-
(string-join
222-
(for/list ([elem (in-treelist (syntax-path-elements path))])
223-
(number->string elem))
224-
"/"
225-
#:before-first "/"))
222+
(string->immutable-string
223+
(string-join
224+
(for/list ([elem (in-treelist (syntax-path-elements path))])
225+
(number->string elem))
226+
"/"
227+
#:before-first "/")))
226228

227229

228230
(module+ test

0 commit comments

Comments
 (0)