mirror of
https://github.com/Crocmagnon/fatcontext.git
synced 2024-11-21 15:38:08 +01:00
Explain getRootIdent/ObjectOf/Pos check
This commit is contained in:
parent
0e13d068ad
commit
69e9ae12fc
1 changed files with 2 additions and 1 deletions
|
@ -55,10 +55,11 @@ func run(pass *analysis.Pass) (interface{}, error) {
|
|||
break
|
||||
}
|
||||
|
||||
// allow assignment to non-pointer children of values defined within the loop
|
||||
if lhs := getRootIdent(pass, assignStmt.Lhs[0]); lhs != nil {
|
||||
if obj := pass.TypesInfo.ObjectOf(lhs); obj != nil {
|
||||
if obj.Pos() >= body.Pos() && obj.Pos() < body.End() {
|
||||
continue
|
||||
continue // definition is within the loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue