1
0
mirror of https://github.com/golang/go synced 2024-11-16 22:14:45 -07:00

cmd/cgo: simplify switch statement to if statement

Change-Id: Ie7dce45d554fde69d682680f55abba6a7fc55036
Reviewed-on: https://go-review.googlesource.com/c/142017
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
avsharapov 2018-10-13 13:51:16 +03:00 committed by Ian Lance Taylor
parent e47c11d8b1
commit 9322b53396

View File

@ -1026,8 +1026,7 @@ func (p *Package) hasSideEffects(f *File, x ast.Expr) bool {
found := false
f.walk(x, ctxExpr,
func(f *File, x interface{}, context astContext) {
switch x.(type) {
case *ast.CallExpr:
if _, ok := x.(*ast.CallExpr); ok {
found = true
}
})
@ -1276,8 +1275,7 @@ func (p *Package) rewriteRef(f *File) {
// in case expression being replaced is first on line.
// See golang.org/issue/6563.
pos := (*r.Expr).Pos()
switch x := expr.(type) {
case *ast.Ident:
if x, ok := expr.(*ast.Ident); ok {
expr = &ast.Ident{NamePos: pos, Name: x.Name}
}