summaryrefslogtreecommitdiff
path: root/src/pkg/go/ast/ast.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-03 13:40:11 -0800
committerRobert Griesemer <gri@golang.org>2009-11-03 13:40:11 -0800
commitb591b9b5fd617b7027293bd16af74d54ec8268c4 (patch)
treea3b0fea36ba621dc05b889f41daab71cb33ae3fc /src/pkg/go/ast/ast.go
parent53f43c11589d80c2a50a4cad053f271078965c61 (diff)
downloadgolang-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.go8
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.
//