re-fix error when keywords missing in app; fix defn to allow non-keyword args withotu default after keyword args

svn: r8140
This commit is contained in:
Matthew Flatt 2007-12-27 16:49:27 +00:00
parent bd260e132e
commit d2aa4f610b
2 changed files with 8 additions and 4 deletions

View File

@ -338,7 +338,11 @@
#'rest)] #'rest)]
[rest-empty (if (null? (syntax-e #'rest)) [rest-empty (if (null? (syntax-e #'rest))
'() '()
'(null))]) '(null))]
[fail-rest (if (null? (syntax-e #'rest))
'(null)
#'rest)])
(let ([with-core (let ([with-core
(lambda (result) (lambda (result)
;; body of procedure, where all keyword and optional ;; body of procedure, where all keyword and optional
@ -402,7 +406,7 @@
;; struct-type entry point for no keywords when a keyword is required ;; struct-type entry point for no keywords when a keyword is required
(syntax/loc stx (syntax/loc stx
(fail-opt-cases (missing-kw) (opt-id ...) (self plain-id ...) (fail-opt-cases (missing-kw) (opt-id ...) (self plain-id ...)
() (rest-id . rest) () (rest-id . fail-rest)
())))]) ())))])
(cond (cond
[(null? kws) [(null? kws)

View File

@ -89,13 +89,13 @@
(identifier? #'id)) (identifier? #'id))
(begin (begin
(check-kw #'kw) (check-kw #'kw)
(cons #'id (loop #'more #t)))] (cons #'id (loop #'more need-def?)))]
[(kw [id def-expr] . more) [(kw [id def-expr] . more)
(and (keyword? (syntax-e #'kw)) (and (keyword? (syntax-e #'kw))
(identifier? #'id)) (identifier? #'id))
(begin (begin
(check-kw #'kw) (check-kw #'kw)
(cons #'id (loop #'more #t)))] (cons #'id (loop #'more need-def?)))]
[(kw . more) [(kw . more)
(keyword? (syntax-e #'kw)) (keyword? (syntax-e #'kw))
(raise-syntax-error #f (raise-syntax-error #f