fixing pr11175, added only-rest-arg-not-used flag

This commit is contained in:
Blake Johnson 2010-09-10 13:51:38 -06:00 committed by Jay McCarthy
parent 5ded2b9e5f
commit 3433af0a30
4 changed files with 11 additions and 6 deletions

View File

@ -970,7 +970,9 @@
(let* ([l (protect-quote body)]
[any-refs? (or (ormap (lambda (t) (memq t '(ref flonum))) param-types)
(ormap (lambda (t) (memq t '(flonum))) closure-types))]
[num-all-params ((if rest? add1 values) num-params)]
[num-all-params (if (and rest? (not (memq 'only-rest-arg-not-used flags)))
(add1 num-params)
num-params)]
[l (cons (make-svector (if any-refs?
(list->vector
(append

View File

@ -117,8 +117,11 @@
(append
(if (zero? (bitwise-and flags flags CLOS_PRESERVES_MARKS)) null '(preserves-marks))
(if (zero? (bitwise-and flags flags CLOS_IS_METHOD)) null '(is-method))
(if (zero? (bitwise-and flags flags CLOS_SINGLE_RESULT)) null '(single-result)))
((if rest? sub1 values) num-params)
(if (zero? (bitwise-and flags flags CLOS_SINGLE_RESULT)) null '(single-result))
(if (and rest? (zero? num-params)) '(only-rest-arg-not-used) null))
(if (and rest? (num-params . > . 0))
(sub1 num-params)
num-params)
arg-types
rest?
(if (= closure-size (vector-length closed-over))

View File

@ -135,8 +135,8 @@
[internal-context (or/c #f #t stx?)]))
(define-form-struct (lam expr) ([name (or/c symbol? vector? empty?)]
[flags (listof (or/c 'preserves-marks 'is-method 'single-result))]
[num-params integer?] ; should be exact-nonnegative-integer?
[flags (listof (or/c 'preserves-marks 'is-method 'single-result 'only-rest-arg-not-used))]
[num-params exact-nonnegative-integer?]
[param-types (listof (or/c 'val 'ref 'flonum))]
[rest? boolean?]
[closure-map (vectorof exact-nonnegative-integer?)]

View File

@ -289,7 +289,7 @@ only other things that can be expressions).}
@defstruct+[(lam expr) ([name (or/c symbol? vector?)]
[flags (listof (or/c 'preserves-marks 'is-method 'single-result))]
[flags (listof (or/c 'preserves-marks 'is-method 'single-result 'only-rest-arg-not-used))]
[num-params exact-nonnegative-integer?]
[param-types (listof (or/c 'val 'ref 'flonum))]
[rest? boolean?]