Skip to content

Commit

Permalink
all: use "reports whether" in place of "returns true if(f)"
Browse files Browse the repository at this point in the history
Comment changes only.

Change-Id: I56848814564c4aa0988b451df18bebdfc88d6d94
Reviewed-on: https://go-review.googlesource.com/7721
Reviewed-by: Rob Pike <[email protected]>
  • Loading branch information
josharian committed Mar 18, 2015
1 parent fcb895f commit 2adc4e8
Show file tree
Hide file tree
Showing 47 changed files with 100 additions and 102 deletions.
2 changes: 1 addition & 1 deletion src/archive/zip/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (h *FileHeader) SetMode(mode os.FileMode) {
}
}

// isZip64 returns true if the file size exceeds the 32 bit limit
// isZip64 reports whether the file size exceeds the 32 bit limit
func (fh *FileHeader) isZip64() bool {
return fh.CompressedSize64 > uint32max || fh.UncompressedSize64 > uint32max
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/cgo/gcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ func (tr *TypeRepr) String() string {
return fmt.Sprintf(tr.Repr, tr.FormatArgs...)
}

// Empty returns true if the result of String would be "".
// Empty reports whether the result of String would be "".
func (tr *TypeRepr) Empty() bool {
return len(tr.Repr) == 0
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/cgo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type Name struct {
Const string // constant definition
}

// IsVar returns true if Kind is either "var" or "fpvar"
// IsVar reports whether Kind is either "var" or "fpvar"
func (n *Name) IsVar() bool {
return n.Kind == "var" || n.Kind == "fpvar"
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/cgo/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func error_(pos token.Pos, msg string, args ...interface{}) {
fmt.Fprintf(os.Stderr, "\n")
}

// isName returns true if s is a valid C identifier
// isName reports whether s is a valid C identifier
func isName(s string) bool {
for i, v := range s {
if v != '_' && (v < 'A' || v > 'Z') && (v < 'a' || v > 'z') && (v < '0' || v > '9') {
Expand Down
20 changes: 10 additions & 10 deletions src/cmd/fix/fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func walkBeforeAfter(x interface{}, before, after func(interface{})) {
after(x)
}

// imports returns true if f imports path.
// imports reports whether f imports path.
func imports(f *ast.File, path string) bool {
return importSpec(f, path) != nil
}
Expand Down Expand Up @@ -322,33 +322,33 @@ func declImports(gen *ast.GenDecl, path string) bool {
return false
}

// isPkgDot returns true if t is the expression "pkg.name"
// isPkgDot reports whether t is the expression "pkg.name"
// where pkg is an imported identifier.
func isPkgDot(t ast.Expr, pkg, name string) bool {
sel, ok := t.(*ast.SelectorExpr)
return ok && isTopName(sel.X, pkg) && sel.Sel.String() == name
}

// isPtrPkgDot returns true if f is the expression "*pkg.name"
// isPtrPkgDot reports whether f is the expression "*pkg.name"
// where pkg is an imported identifier.
func isPtrPkgDot(t ast.Expr, pkg, name string) bool {
ptr, ok := t.(*ast.StarExpr)
return ok && isPkgDot(ptr.X, pkg, name)
}

// isTopName returns true if n is a top-level unresolved identifier with the given name.
// isTopName reports whether n is a top-level unresolved identifier with the given name.
func isTopName(n ast.Expr, name string) bool {
id, ok := n.(*ast.Ident)
return ok && id.Name == name && id.Obj == nil
}

// isName returns true if n is an identifier with the given name.
// isName reports whether n is an identifier with the given name.
func isName(n ast.Expr, name string) bool {
id, ok := n.(*ast.Ident)
return ok && id.String() == name
}

// isCall returns true if t is a call to pkg.name.
// isCall reports whether t is a call to pkg.name.
func isCall(t ast.Expr, pkg, name string) bool {
call, ok := t.(*ast.CallExpr)
return ok && isPkgDot(call.Fun, pkg, name)
Expand All @@ -360,20 +360,20 @@ func isIdent(n interface{}) *ast.Ident {
return id
}

// refersTo returns true if n is a reference to the same object as x.
// refersTo reports whether n is a reference to the same object as x.
func refersTo(n ast.Node, x *ast.Ident) bool {
id, ok := n.(*ast.Ident)
// The test of id.Name == x.Name handles top-level unresolved
// identifiers, which all have Obj == nil.
return ok && id.Obj == x.Obj && id.Name == x.Name
}

// isBlank returns true if n is the blank identifier.
// isBlank reports whether n is the blank identifier.
func isBlank(n ast.Expr) bool {
return isName(n, "_")
}

// isEmptyString returns true if n is an empty string literal.
// isEmptyString reports whether n is an empty string literal.
func isEmptyString(n ast.Expr) bool {
lit, ok := n.(*ast.BasicLit)
return ok && lit.Kind == token.STRING && len(lit.Value) == 2
Expand Down Expand Up @@ -430,7 +430,7 @@ func rewriteUses(x *ast.Ident, f, fnot func(token.Pos) ast.Expr, scope []ast.Stm
}
}

// assignsTo returns true if any of the code in scope assigns to or takes the address of x.
// assignsTo reports whether any of the code in scope assigns to or takes the address of x.
func assignsTo(x *ast.Ident, scope []ast.Stmt) bool {
assigned := false
ff := func(n interface{}) {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (s *importStack) copy() []string {
return append([]string{}, *s...)
}

// shorterThan returns true if sp is shorter than t.
// shorterThan reports whether sp is shorter than t.
// We use this to record the shortest import sequence
// that leads to a particular package.
func (sp *importStack) shorterThan(t []string) bool {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/gofmt/rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func isWildcard(s string) bool {
return size == len(s) && unicode.IsLower(rune)
}

// match returns true if pattern matches val,
// match reports whether pattern matches val,
// recording wildcard submatches in m.
// If m == nil, match checks whether pattern == val.
func match(m map[string]reflect.Value, pattern, val reflect.Value) bool {
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/elliptic/elliptic.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
type Curve interface {
// Params returns the parameters for the curve.
Params() *CurveParams
// IsOnCurve returns true if the given (x,y) lies on the curve.
// IsOnCurve reports whether the given (x,y) lies on the curve.
IsOnCurve(x, y *big.Int) bool
// Add returns the sum of (x1,y1) and (x2,y2)
Add(x1, y1, x2, y2 *big.Int) (x, y *big.Int)
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/hmac/hmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The receiver verifies the hash by recomputing it using the same key.
Receivers should be careful to use Equal to compare MACs in order to avoid
timing side-channels:
// CheckMAC returns true if messageMAC is a valid HMAC tag for message.
// CheckMAC reports whether messageMAC is a valid HMAC tag for message.
func CheckMAC(message, messageMAC, key []byte) bool {
mac := hmac.New(sha256.New, key)
mac.Write(message)
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/tls/handshake_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Curves:
return false, nil
}

// checkForResumption returns true if we should perform resumption on this connection.
// checkForResumption reports whether we should perform resumption on this connection.
func (hs *serverHandshakeState) checkForResumption() bool {
c := hs.c

Expand Down
2 changes: 1 addition & 1 deletion src/crypto/x509/cert_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *CertPool) AddCert(cert *Certificate) {
}

// AppendCertsFromPEM attempts to parse a series of PEM encoded certificates.
// It appends any certificates found to s and returns true if any certificates
// It appends any certificates found to s and reports whether any certificates
// were successfully parsed.
//
// On many Linux systems, /etc/ssl/cert.pem will contain the system wide set
Expand Down
2 changes: 1 addition & 1 deletion src/encoding/asn1/asn1.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func parsePrintableString(bytes []byte) (ret string, err error) {
return
}

// isPrintable returns true iff the given b is in the ASN.1 PrintableString set.
// isPrintable reports whether the given b is in the ASN.1 PrintableString set.
func isPrintable(b byte) bool {
return 'a' <= b && b <= 'z' ||
'A' <= b && b <= 'Z' ||
Expand Down
2 changes: 1 addition & 1 deletion src/encoding/csv/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (w *Writer) WriteAll(records [][]string) (err error) {
return w.w.Flush()
}

// fieldNeedsQuotes returns true if our field must be enclosed in quotes.
// fieldNeedsQuotes reports whether our field must be enclosed in quotes.
// Fields with a Comma, fields with a quote or newline, and
// fields which start with a space must be enclosed in quotes.
// We used to quote empty strings, but we do not anymore (as of Go 1.4).
Expand Down
2 changes: 1 addition & 1 deletion src/flag/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ func Parse() {
CommandLine.Parse(os.Args[1:])
}

// Parsed returns true if the command-line flags have been parsed.
// Parsed reports whether the command-line flags have been parsed.
func Parsed() bool {
return CommandLine.Parsed()
}
Expand Down
17 changes: 8 additions & 9 deletions src/go/ast/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ func exportFilter(name string) bool {
// body) are removed. Non-exported fields and methods of exported types are
// stripped. The File.Comments list is not changed.
//
// FileExports returns true if there are exported declarations;
// it returns false otherwise.
// FileExports reports whether there are exported declarations.
//
func FileExports(src *File) bool {
return filterFile(src, exportFilter, true)
Expand All @@ -34,7 +33,7 @@ func FileExports(src *File) bool {
// only exported nodes remain. The pkg.Files list is not changed, so that
// file names and top-level package comments don't get lost.
//
// PackageExports returns true if there are exported declarations;
// PackageExports reports whether there are exported declarations;
// it returns false otherwise.
//
func PackageExports(pkg *Package) bool {
Expand Down Expand Up @@ -199,8 +198,8 @@ func filterSpecList(list []Spec, f Filter, export bool) []Spec {
// all names (including struct field and interface method names, but
// not from parameter lists) that don't pass through the filter f.
//
// FilterDecl returns true if there are any declared names left after
// filtering; it returns false otherwise.
// FilterDecl reports whether there are any declared names left after
// filtering.
//
func FilterDecl(decl Decl, f Filter) bool {
return filterDecl(decl, f, false)
Expand All @@ -224,8 +223,8 @@ func filterDecl(decl Decl, f Filter, export bool) bool {
// the declaration is removed from the AST. Import declarations are
// always removed. The File.Comments list is not changed.
//
// FilterFile returns true if there are any top-level declarations
// left after filtering; it returns false otherwise.
// FilterFile reports whether there are any top-level declarations
// left after filtering.
//
func FilterFile(src *File, f Filter) bool {
return filterFile(src, f, false)
Expand All @@ -251,8 +250,8 @@ func filterFile(src *File, f Filter, export bool) bool {
// changed, so that file names and top-level package comments don't get
// lost.
//
// FilterPackage returns true if there are any top-level declarations
// left after filtering; it returns false otherwise.
// FilterPackage reports whether there are any top-level declarations
// left after filtering.
//
func FilterPackage(pkg *Package, f Filter) bool {
return filterPackage(pkg, f, false)
Expand Down
2 changes: 1 addition & 1 deletion src/go/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ func splitQuoted(s string) (r []string, err error) {
return args, err
}

// match returns true if the name is one of:
// match reports whether the name is one of:
//
// $GOOS
// $GOARCH
Expand Down
2 changes: 1 addition & 1 deletion src/go/doc/exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func removeErrorField(ityp *ast.InterfaceType) {
}

// filterFieldList removes unexported fields (field names) from the field list
// in place and returns true if fields were removed. Anonymous fields are
// in place and reports whether fields were removed. Anonymous fields are
// recorded with the parent type. filterType is called with the types of
// all remaining fields.
//
Expand Down
4 changes: 2 additions & 2 deletions src/go/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ func (p *parser) checkExpr(x ast.Expr) ast.Expr {
return x
}

// isTypeName returns true iff x is a (qualified) TypeName.
// isTypeName reports whether x is a (qualified) TypeName.
func isTypeName(x ast.Expr) bool {
switch t := x.(type) {
case *ast.BadExpr:
Expand All @@ -1379,7 +1379,7 @@ func isTypeName(x ast.Expr) bool {
return true
}

// isLiteralType returns true iff x is a legal composite literal type.
// isLiteralType reports whether x is a legal composite literal type.
func isLiteralType(x ast.Expr) bool {
switch t := x.(type) {
case *ast.BadExpr:
Expand Down
2 changes: 1 addition & 1 deletion src/go/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (p *printer) nextComment() {
p.commentOffset = infinity
}

// commentBefore returns true iff the current comment group occurs
// commentBefore reports whether the current comment group occurs
// before the next position in the source code and printing it does
// not introduce implicit semicolons.
//
Expand Down
4 changes: 2 additions & 2 deletions src/go/printer/testdata/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ func (p *parser) checkExpr(x ast.Expr) ast.Expr {
return x
}

// isTypeName returns true iff x is a (qualified) TypeName.
// isTypeName reports whether x is a (qualified) TypeName.
func isTypeName(x ast.Expr) bool {
switch t := x.(type) {
case *ast.BadExpr:
Expand All @@ -1179,7 +1179,7 @@ func isTypeName(x ast.Expr) bool {
return true
}

// isLiteralType returns true iff x is a legal composite literal type.
// isLiteralType reports whether x is a legal composite literal type.
func isLiteralType(x ast.Expr) bool {
switch t := x.(type) {
case *ast.BadExpr:
Expand Down
6 changes: 3 additions & 3 deletions src/go/token/position.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Position struct {
Column int // column number, starting at 1 (byte count)
}

// IsValid returns true if the position is valid.
// IsValid reports whether the position is valid.
func (pos *Position) IsValid() bool { return pos.Line > 0 }

// String returns a string in one of several forms:
Expand Down Expand Up @@ -77,7 +77,7 @@ type Pos int
//
const NoPos Pos = 0

// IsValid returns true if the position is valid.
// IsValid reports whether the position is valid.
func (p Pos) IsValid() bool {
return p != NoPos
}
Expand Down Expand Up @@ -157,7 +157,7 @@ func (f *File) MergeLine(line int) {
f.lines = f.lines[:len(f.lines)-1]
}

// SetLines sets the line offsets for a file and returns true if successful.
// SetLines sets the line offsets for a file and reports whether it succeeded.
// The line offsets are the offsets of the first character of each line;
// for instance for the content "ab\nc\n" the line offsets are {0, 3}.
// An empty file has an empty line offset table.
Expand Down
4 changes: 2 additions & 2 deletions src/math/big/nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func karatsuba(z, x, y nat) {
}
}

// alias returns true if x and y share the same base array.
// alias reports whether x and y share the same base array.
func alias(x, y nat) bool {
return cap(x) > 0 && cap(y) > 0 && &x[0:cap(x)][cap(x)-1] == &y[0:cap(y)][cap(y)-1]
}
Expand Down Expand Up @@ -819,7 +819,7 @@ func (z nat) xor(x, y nat) nat {
return z.norm()
}

// greaterThan returns true iff (x1<<_W + x2) > (y1<<_W + y2)
// greaterThan reports whether (x1<<_W + x2) > (y1<<_W + y2)
func greaterThan(x1, x2, y1, y2 Word) bool {
return x1 > y1 || x1 == y1 && x2 > y2
}
Expand Down
2 changes: 1 addition & 1 deletion src/math/big/rat.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func (x *Rat) Sign() int {
return x.a.Sign()
}

// IsInt returns true if the denominator of x is 1.
// IsInt reports whether the denominator of x is 1.
func (x *Rat) IsInt() bool {
return len(x.b.abs) == 0 || x.b.abs.cmp(natOne) == 0
}
Expand Down
6 changes: 3 additions & 3 deletions src/mime/grammar.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import (
"strings"
)

// isTSpecial returns true if rune is in 'tspecials' as defined by RFC
// isTSpecial reports whether rune is in 'tspecials' as defined by RFC
// 1521 and RFC 2045.
func isTSpecial(r rune) bool {
return strings.IndexRune(`()<>@,;:\"/[]?=`, r) != -1
}

// isTokenChar returns true if rune is in 'token' as defined by RFC
// isTokenChar reports whether rune is in 'token' as defined by RFC
// 1521 and RFC 2045.
func isTokenChar(r rune) bool {
// token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
// or tspecials>
return r > 0x20 && r < 0x7f && !isTSpecial(r)
}

// isToken returns true if s is a 'token' as defined by RFC 1521
// isToken reports whether s is a 'token' as defined by RFC 1521
// and RFC 2045.
func isToken(s string) bool {
if s == "" {
Expand Down
Loading

0 comments on commit 2adc4e8

Please sign in to comment.