Add index entries for @defconstructor (and friends). Also add

code that skips over them when building the search indices.
Overall, this means that the only change most people would see
is that multiple constructors in the same class will get a warning
(and there was one of those, so fixed that too).

Also, Rackety. Specifically, transformed this surprising combination
of constructs (where all caps are placeholders for something specific):

((if PRED
     (λ (c mk) BODY2)
     (λ (c mk) BODY1))
 content
 (lambda (tag) BODY3))

into this one:

(define (mk tag) BODY3)
(if PRED
    BODY1{c:=content}
    BODY2{c:=content})

original commit: 8ee76c9547899f62e6f28eba1cdbba1f4d54c399
This commit is contained in:
Robby Findler 2012-08-11 21:50:16 -05:00
parent 9dd4dddb90
commit 8799cd2137
4 changed files with 61 additions and 20 deletions

View File

@ -9,6 +9,7 @@
[from-libs (listof module-path?)])]
[(method-index-desc exported-index-desc) ([method-name symbol?]
[class-tag tag?])]
[(constructor-index-desc exported-index-desc) ([class-tag tag?])]
[(procedure-index-desc exported-index-desc) ()]
[(thing-index-desc exported-index-desc) ()]
[(struct-index-desc exported-index-desc) ()]

View File

@ -11,6 +11,7 @@
; XXX unknown contracts
(provide *method **method
method-tag
constructor-tag
name-this-object)
(define-syntax-rule (method a b)
@ -23,25 +24,26 @@
(**method sym id))
(define (**method sym id/tag)
(let ([content (list (symbol->string sym))])
((if (identifier? id/tag)
(lambda (c mk)
(make-delayed-element
(lambda (ren p ri)
(let ([tag (find-scheme-tag p ri id/tag #f)])
(if tag (list (mk tag)) content)))
(lambda () (car content))
(lambda () (car content))))
(lambda (c mk) (mk id/tag)))
content
(lambda (tag)
(make-element symbol-color
(list (make-link-element value-link-color content
(method-tag tag sym))))))))
(define content (list (symbol->string sym)))
(define (mk tag)
(make-element symbol-color
(list (make-link-element value-link-color content
(method-tag tag sym)))))
(if (identifier? id/tag)
(make-delayed-element
(λ (ren p ri)
(let ([tag (find-scheme-tag p ri id/tag #f)])
(if tag (list (mk tag)) content)))
(λ () (car content))
(λ () (car content)))
(mk id/tag)))
(define (method-tag vtag sym)
(list 'meth (list (cadr vtag) sym)))
(define (constructor-tag vtag)
(list 'construtor (cadr vtag)))
(define (name-this-object type-sym)
(to-element
(string->symbol

View File

@ -283,11 +283,40 @@
(syntax->datum stx-id) names)))
(define tagged
(cond
[(eq? mode 'new)
(make-element #f (list (racket new) spacer (to-element within-id)))]
[(eq? mode 'make)
(make-element
#f (list (racket make-object) spacer (to-element within-id)))]
[(or (eq? mode 'new)
(eq? mode 'make))
(define content
(list (if (eq? mode 'new)
(racket new)
(racket make-object))))
(define new-elem
(if first?
(let* ([target-maker (id-to-target-maker within-id #f)])
(if target-maker
(target-maker
content
(lambda (ctag)
(let ([tag (constructor-tag ctag)])
(make-toc-target-element
#f
(list (make-index-element
#f
content
tag
(list (datum-intern-literal (symbol->string (syntax-e within-id)))
(if (eq? mode 'new)
"new"
"make-object"))
content
(with-exporting-libraries
(lambda (libs)
(make-constructor-index-desc
(syntax-e within-id)
libs ctag)))))
tag))))
(car content)))
(car content)))
(make-element #f (list new-elem spacer (to-element within-id)))]
[(eq? mode 'send)
(make-element
#f

View File

@ -1586,3 +1586,12 @@ from @racket[exported-index-desc] names the class or interface that
contains the method. The @racket[method-name] field names the method.
The @racket[class-tag] field provides a pointer to the start of the
documentation for the method's class or interface.}
@defstruct[(constructor-index-desc exported-index-desc) ([class-tag tag?])]{
Indicates that the index entry corresponds to a constructor
via @racket[defconstructor] and company. The @racket[_name] field
from @racket[exported-index-desc] names the class or interface that
contains the method.
The @racket[class-tag] field provides a pointer to the start of the
documentation for the method's class or interface.}