Scopes now have "extent" information; that is they provide a range [scope.Pos(), scope.End()) which describes the source text range covered by the scope. It requires that the incoming AST has correct position information; also the extent for the Universe and for package scopes is not set (positions are invalid). Objects have a new (currently unexported) scopePos position, which is the position at which the object becomes visible inside its *Scope. Scope.LookupParent takes an addition parameter pos. If valid, an identifier is looked up as if found at position pos. This can be used to find the object corresponding to an identifier at position pos after scopes have been completely populated (and thus may contain the same identifier which may be defined only later in the source text). Fixes #9980. Change-Id: Icb49c44c5c3d4b93c0718ce2a769ec468877709d Reviewed-on: https://go-review.googlesource.com/10800 Reviewed-by: Alan Donovan <adonovan@google.com> |
||
|---|---|---|
| .. | ||
| ast/astutil | ||
| buildutil | ||
| callgraph | ||
| exact | ||
| gccgoimporter | ||
| gcimporter | ||
| importer | ||
| loader | ||
| pointer | ||
| ssa | ||
| types | ||
| vcs | ||