aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-05-18 01:54:39 +0200
committerTeddy Wing2023-05-18 01:54:39 +0200
commitd75790724acc77890acdbe4e1894e287e4db9b46 (patch)
tree561f54f98996ad408175b0b11ade00b5e293a85a
parentace55a2a1696e3b60891b5d731705ead72446f7d (diff)
downloadgocapturedrefrace-d75790724acc77890acdbe4e1894e287e4db9b46.tar.bz2
Create a new plan for checking shadowing
-rw-r--r--gocapturedrefrace.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/gocapturedrefrace.go b/gocapturedrefrace.go
index 369b107..cdc6486 100644
--- a/gocapturedrefrace.go
+++ b/gocapturedrefrace.go
@@ -37,6 +37,7 @@ var Analyzer = &analysis.Analyzer{
}
func run(pass *analysis.Pass) (interface{}, error) {
+ // TODO: Since we're calling ast.Inspect a bunch of times, maybe it's worthwhile using passes/inspect now.
for _, file := range pass.Files {
ast.Inspect(
file,
@@ -144,6 +145,8 @@ func isShadowingDeclaration(
node ast.Node,
funcScope *types.Scope,
) bool {
+ // TODO: Plan: Change this function to checkShadowing. Call ast.Inspect and build a list of local assignments in the closure. Then in checkClosure, ignore objects in the local assignments list.
+
assignStmt, ok := node.(*ast.AssignStmt)
if !ok {
return false