uses ( defspec -- seq ) (original) (raw)

uses ( defspec -- seq )
Factor handbook » Developer tools » Definition cross referencing

Next: get-crossref ( -- crossref )

Vocabulary
tools.crossref

Inputs

defspec a definition specifier

Outputs

seq a sequence of definition specifiers

Word description
Outputs a sequence of definitions called by the given definition.

Notes
The sequence might include the definition itself, if it is a recursive word.

Examples
We can ask the sq word to produce a list of words it calls:

\ sq uses .
{ dup * }

Definition

IN: tools.crossref

GENERIC: uses ( defspec -- seq )

Methods

USING: hash-sets.identity kernel namespaces quotations sets
tools.crossref tools.crossref.private ;

M: callable uses
IHS{ } clone visited
[ HS{ } clone [ quot-uses ] keep members ] with-variable ;

USING: help.crossref help.markup help.topics kernel sequences
tools.crossref vocabs ;

M: link uses
[
{ $subsection $subsections $link $see-also }
article-links [ >link ] map
] [ { $vocab-link } article-links [ >vocab-link ] map ] bi
append ;

USING: kernel tools.crossref ;

M: object uses drop f ;

USING: accessors io.pathnames kernel source-files tools.crossref
;

M: pathname uses
string>> path>source-file top-level-form>>
[ uses ] [ { } ] if* ;

USING: accessors tools.crossref words ;

M: word uses def>> uses ;