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 {
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}
}
......
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