]> Cypherpunks repositories - gostls13.git/commitdiff
go/printer: more accurate comment for incomplete structs/interfaces
authorRobert Griesemer <gri@golang.org>
Thu, 12 May 2011 16:01:50 +0000 (09:01 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 12 May 2011 16:01:50 +0000 (09:01 -0700)
A struct or interface type node is marked incomplete if fields or
methods have been removed through any kind of filtering, not just
because entries are not exported.

The current message was misleading in some cases (for instance:
"godoc -src reflect Implements").

This CL requires CL 4527050 .

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4529054

src/pkg/go/printer/nodes.go
src/pkg/go/printer/testdata/comments.x

index 572c9bd28f144553a227bd3799e01a8bbfd27ccb..3b504bd2c5306f36fb6e758f622e7f45ced554c0 100644 (file)
@@ -439,7 +439,7 @@ func (p *printer) fieldList(fields *ast.FieldList, isStruct, isIncomplete bool)
                                p.print(formfeed)
                        }
                        p.flush(p.fset.Position(rbrace), token.RBRACE) // make sure we don't loose the last line comment
-                       p.setLineComment("// contains unexported fields")
+                       p.setLineComment("// contains filtered or unexported fields")
                }
 
        } else { // interface
@@ -466,7 +466,7 @@ func (p *printer) fieldList(fields *ast.FieldList, isStruct, isIncomplete bool)
                                p.print(formfeed)
                        }
                        p.flush(p.fset.Position(rbrace), token.RBRACE) // make sure we don't loose the last line comment
-                       p.setLineComment("// contains unexported methods")
+                       p.setLineComment("// contains filtered or unexported methods")
                }
 
        }
index 4d7a928ae096ebf5a2ab96d6d48007a117964959..30a182f490888a06cfcf7c254078d92afd471b80 100644 (file)
@@ -8,7 +8,7 @@ type SZ struct{}
 
 // The S0 struct; no field is exported.
 type S0 struct {
-       // contains unexported fields
+       // contains filtered or unexported fields
 }
 
 // The S1 struct; some fields are not exported.
@@ -16,7 +16,7 @@ type S1 struct {
        S0
        A, B, C float   // 3 exported fields
        D       int     // 2 unexported fields
-       // contains unexported fields
+       // contains filtered or unexported fields
 }
 
 // The S2 struct; all fields are exported.
@@ -30,14 +30,14 @@ type SZ interface{}
 
 // The I0 interface; no method is exported.
 type I0 interface {
-       // contains unexported methods
+       // contains filtered or unexported methods
 }
 
 // The I1 interface; some methods are not exported.
 type I1 interface {
        I0
        F(x float) float        // exported methods
-       // contains unexported methods
+       // contains filtered or unexported methods
 }
 
 // The I2 interface; all methods are exported.
@@ -53,5 +53,5 @@ type S3 struct {
        F1      int     // line comment for F1
        // lead comment for F2
        F2      int     // line comment for F2
-       // contains unexported fields
+       // contains filtered or unexported fields
 }