diff options
author | Robert Griesemer <gri@golang.org> | 2009-11-03 13:40:11 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-11-03 13:40:11 -0800 |
commit | b591b9b5fd617b7027293bd16af74d54ec8268c4 (patch) | |
tree | a3b0fea36ba621dc05b889f41daab71cb33ae3fc /src/pkg/go/ast/ast.go | |
parent | 53f43c11589d80c2a50a4cad053f271078965c61 (diff) | |
download | golang-b591b9b5fd617b7027293bd16af74d54ec8268c4.tar.gz |
- don't loose extra line breaks in struct/interface declarations
- start new sections if a field/method declaration spans multiple lines;
this avoids tabs from the previous line affecting the next field/method
R=rsc
http://go/go-review/1017015
Diffstat (limited to 'src/pkg/go/ast/ast.go')
-rw-r--r-- | src/pkg/go/ast/ast.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pkg/go/ast/ast.go b/src/pkg/go/ast/ast.go index c346c48b3..4b90f3b74 100644 --- a/src/pkg/go/ast/ast.go +++ b/src/pkg/go/ast/ast.go @@ -95,6 +95,14 @@ type Field struct { } +func (f *Field) Pos() token.Position { + if len(f.Names) > 0 { + return f.Names[0].Pos(); + } + return f.Type.Pos(); +} + + // An expression is represented by a tree consisting of one // or more of the following concrete expression nodes. // |