diff options
| author | Michael Stapelberg <stapelberg@debian.org> | 2013-05-14 18:39:35 +0200 |
|---|---|---|
| committer | Michael Stapelberg <michael@stapelberg.de> | 2013-05-14 18:39:35 +0200 |
| commit | efcc50dfdc94c82ee0292bf71992ecb7c0123061 (patch) | |
| tree | 17dca99d1dc7fc4e9fe49c2cf6a99d337d4c039f /src/pkg/go/doc/doc.go | |
| parent | 04b08da9af0c450d645ab7389d1467308cfc2db8 (diff) | |
| download | golang-efcc50dfdc94c82ee0292bf71992ecb7c0123061.tar.gz | |
Imported Upstream version 1.1upstream/1.1
Diffstat (limited to 'src/pkg/go/doc/doc.go')
| -rw-r--r-- | src/pkg/go/doc/doc.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/pkg/go/doc/doc.go b/src/pkg/go/doc/doc.go index 65b1b83eb..4264940a0 100644 --- a/src/pkg/go/doc/doc.go +++ b/src/pkg/go/doc/doc.go @@ -17,17 +17,11 @@ type Package struct { ImportPath string Imports []string Filenames []string + Notes map[string][]*Note // DEPRECATED. For backward compatibility Bugs is still populated, // but all new code should use Notes instead. Bugs []string - // Notes such as TODO(userid): or SECURITY(userid): - // along the lines of BUG(userid). Any marker with 2 or more upper - // case [A-Z] letters is recognised. - // BUG is explicitly not included in these notes but will - // be in a subsequent change when the Bugs field above is removed. - Notes map[string][]string - // declarations Consts []*Value Types []*Type @@ -70,6 +64,16 @@ type Func struct { Level int // embedding level; 0 means not embedded } +// A Note represents a marked comment starting with "MARKER(uid): note body". +// Any note with a marker of 2 or more upper case [A-Z] letters and a uid of +// at least one character is recognized. The ":" following the uid is optional. +// Notes are collected in the Package.Notes map indexed by the notes marker. +type Note struct { + Pos, End token.Pos // position range of the comment containing the marker + UID string // uid found with the marker + Body string // note body text +} + // Mode values control the operation of New. type Mode int @@ -97,8 +101,8 @@ func New(pkg *ast.Package, importPath string, mode Mode) *Package { ImportPath: importPath, Imports: sortedKeys(r.imports), Filenames: r.filenames, - Bugs: r.bugs, Notes: r.notes, + Bugs: noteBodies(r.notes["BUG"]), Consts: sortedValues(r.values, token.CONST), Types: sortedTypes(r.types, mode&AllMethods != 0), Vars: sortedValues(r.values, token.VAR), |
