Documentation generates documentation about the Function and its overloads as a common.Doc object.
()
| 89 | |
| 90 | // Documentation generates documentation about the Function and its overloads as a common.Doc object. |
| 91 | func (f *FunctionDecl) Documentation() *common.Doc { |
| 92 | if f == nil { |
| 93 | return nil |
| 94 | } |
| 95 | children := make([]*common.Doc, len(f.OverloadDecls())) |
| 96 | for i, o := range f.OverloadDecls() { |
| 97 | var examples []*common.Doc |
| 98 | for _, ex := range o.Examples() { |
| 99 | examples = append(examples, common.NewExampleDoc(ex)) |
| 100 | } |
| 101 | od := common.NewOverloadDoc(o.ID(), formatSignature(f.Name(), o), examples...) |
| 102 | children[i] = od |
| 103 | } |
| 104 | return common.NewFunctionDoc( |
| 105 | f.Name(), |
| 106 | f.Description(), |
| 107 | children...) |
| 108 | } |
| 109 | |
| 110 | // Name returns the function name in human-readable terms, e.g. 'contains' of 'math.least' |
| 111 | func (f *FunctionDecl) Name() string { |