1
0
mirror of https://github.com/golang/go synced 2024-11-18 10:04:43 -07:00

internal/lsp/source: fix cloneExpr for SelectorExprs

A missing return in the SelectorExpr case meant that cloneExpr would
return the original node, resulting in AST corruption when the caller
modified it.

It might be nice to panic in the default case to prevent this from
happening again, but for now let's just fix it.

Fixes golang/go#38927.

Change-Id: Ib99f2dadecf52007ac9319c480fbd2d636a0474a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/232990
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Heschi Kreinick 2020-05-08 18:05:27 -04:00 committed by Rebecca Stambler
parent 2d0106b2df
commit 058404a2dd

View File

@ -388,6 +388,7 @@ func cloneExpr(expr ast.Expr, info *types.Info, clonedInfo map[token.Pos]*types.
}
}
return s
case *ast.StarExpr:
return &ast.StarExpr{
Star: expr.Star,