Fix `dot notation for nested hash lookups' example

The previous snippet had a guard of "fender" clause that always resulted in an error, even on valid calls. The fixed snippet performs a check and only errors in bad cases.
This commit is contained in:
Leandro Facchinetti 2016-04-14 07:21:07 -04:00
parent 27fc80861a
commit 366ee57b2a

View File

@ -1212,7 +1212,8 @@ messages when used in error. Let's try to do that here.
[(_ chain)
#'(hash.refs chain #f)]
[(_ chain default)
(raise-syntax-error #f "Expected hash.key0[.key1 ...] [default]" stx #'chain)
(unless (identifier? #'chain)
(raise-syntax-error #f "Expected hash.key0[.key1 ...] [default]" stx #'chain))
(let* ([chain-str (symbol->string (syntax->datum #'chain))]
[ids (for/list ([str (in-list (regexp-split #rx"\\." chain-str))])
(format-id #'chain "~a" str))])