Source file src/cmd/vendor/golang.org/x/tools/go/ast/astutil/util.go
1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package astutil 6 7 import "go/ast" 8 9 // Unparen returns e with any enclosing parentheses stripped. 10 // TODO(adonovan): use go1.22's ast.Unparen. 11 func Unparen(e ast.Expr) ast.Expr { 12 for { 13 p, ok := e.(*ast.ParenExpr) 14 if !ok { 15 return e 16 } 17 e = p.X 18 } 19 } 20