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