]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: remove unnecessary nil check
authorTobias Klauser <tklauser@distanz.ch>
Tue, 31 Oct 2017 22:25:09 +0000 (23:25 +0100)
committerTobias Klauser <tobias.klauser@gmail.com>
Wed, 1 Nov 2017 08:21:26 +0000 (08:21 +0000)
commentText is only called if g != nil in ParseGo, so the check inside
commentText is redundant and can be deleted.

Change-Id: I130c18b738527c96bc59950b354a50b9e23f92e9
Reviewed-on: https://go-review.googlesource.com/74871
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/cgo/ast.go

index 96cad8050c785c54f4e9f9657fbee66d01af7a3c..f59f7afcb759548e43bdf2f09bb28475057373f4 100644 (file)
@@ -144,9 +144,6 @@ func (f *File) ParseGo(name string, src []byte) {
 // Like ast.CommentGroup's Text method but preserves
 // leading blank lines, so that line numbers line up.
 func commentText(g *ast.CommentGroup) string {
-       if g == nil {
-               return ""
-       }
        var pieces []string
        for _, com := range g.List {
                c := com.Text