(pass *analysis.Pass, body *ast.BlockStmt)
| 322 | } |
| 323 | |
| 324 | func (m outerStoreMatcher) withAliases(pass *analysis.Pass, body *ast.BlockStmt) outerStoreMatcher { |
| 325 | base := m |
| 326 | derived := m |
| 327 | |
| 328 | ast.Inspect(body, func(n ast.Node) bool { |
| 329 | switch n := n.(type) { |
| 330 | case *ast.FuncLit: |
| 331 | return false |
| 332 | case *ast.AssignStmt: |
| 333 | if n.Tok != token.DEFINE { |
| 334 | return true |
| 335 | } |
| 336 | for i, lhs := range n.Lhs { |
| 337 | if i >= len(n.Rhs) { |
| 338 | break |
| 339 | } |
| 340 | derived.collectAlias(pass, base, lhs, n.Rhs[i]) |
| 341 | } |
| 342 | case *ast.DeclStmt: |
| 343 | genDecl, ok := n.Decl.(*ast.GenDecl) |
| 344 | if !ok || genDecl.Tok != token.VAR { |
| 345 | return true |
| 346 | } |
| 347 | for _, spec := range genDecl.Specs { |
| 348 | valueSpec, ok := spec.(*ast.ValueSpec) |
| 349 | if !ok { |
| 350 | continue |
| 351 | } |
| 352 | for i, name := range valueSpec.Names { |
| 353 | if i >= len(valueSpec.Values) { |
| 354 | break |
| 355 | } |
| 356 | derived.collectAlias(pass, base, name, valueSpec.Values[i]) |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | return true |
| 361 | }) |
| 362 | |
| 363 | return derived |
| 364 | } |
| 365 | |
| 366 | func (m *outerStoreMatcher) collectAlias(pass *analysis.Pass, base outerStoreMatcher, lhs ast.Expr, rhs ast.Expr) { |
| 367 | lhsForm, ok := declaredIdentForm(pass, lhs) |
nothing calls this directly
no test coverage detected