add comment

This commit is contained in:
Mateusz Poliwczak 2024-09-04 09:13:59 +02:00
parent 9162984fe9
commit 7ec34ffe0c
1 changed files with 3 additions and 0 deletions

View File

@ -2695,6 +2695,9 @@ func extractName(x ast.Expr, force bool) (*ast.Ident, ast.Expr) {
case *ast.CallExpr:
if name, _ := x.Fun.(*ast.Ident); name != nil {
if len(x.Args) == 1 && x.Ellipsis == token.NoPos && (force || isTypeElem(x.Args[0])) {
// x = name (x.Args[0])
// (Note that the cmd/compile/internal/syntax parser does not care
// about syntax tree fidelity and does not preserve parentheses here.)
return name, &ast.ParenExpr{
Lparen: x.Lparen,
X: x.Args[0],