Commit 9322b533 authored by avsharapov's avatar avsharapov Committed by Ian Lance Taylor

cmd/cgo: simplify switch statement to if statement

Change-Id: Ie7dce45d554fde69d682680f55abba6a7fc55036
Reviewed-on: https://go-review.googlesource.com/c/142017Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent e47c11d8
...@@ -1026,8 +1026,7 @@ func (p *Package) hasSideEffects(f *File, x ast.Expr) bool { ...@@ -1026,8 +1026,7 @@ func (p *Package) hasSideEffects(f *File, x ast.Expr) bool {
found := false found := false
f.walk(x, ctxExpr, f.walk(x, ctxExpr,
func(f *File, x interface{}, context astContext) { func(f *File, x interface{}, context astContext) {
switch x.(type) { if _, ok := x.(*ast.CallExpr); ok {
case *ast.CallExpr:
found = true found = true
} }
}) })
...@@ -1276,8 +1275,7 @@ func (p *Package) rewriteRef(f *File) { ...@@ -1276,8 +1275,7 @@ func (p *Package) rewriteRef(f *File) {
// in case expression being replaced is first on line. // in case expression being replaced is first on line.
// See golang.org/issue/6563. // See golang.org/issue/6563.
pos := (*r.Expr).Pos() pos := (*r.Expr).Pos()
switch x := expr.(type) { if x, ok := expr.(*ast.Ident); ok {
case *ast.Ident:
expr = &ast.Ident{NamePos: pos, Name: x.Name} expr = &ast.Ident{NamePos: pos, Name: x.Name}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment