You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See golang/lint#61 for some background.
For this program,
```
package foo
import "syscall"
var flags uint32 = syscall.AF_INET
```
the go/types package will (correctly) say that the *types.Scope of the `flags` var is
the package scope rather than the file scope. That, however, makes it harder to evaluate
the RHS of the assignment outside of the assignment context, since the
"syscall" name is not defined at package scope.
Please provide an easy way to get from the *ast.ValueSpec (or any ast.Expr, or a
token.Pos) to the narrowest scope that encompasses its definition.
The text was updated successfully, but these errors were encountered:
Turns out there's no need to have special go/types support: it's fairly trivial to get
to the corresponding *ast.File given a token.Pos (search if the pos is within the file),
and then map the file to the respective file scope.
Here's a complete example program (needs to be run outside the playground):
http://play.golang.org/p/zFF56WBxiy
Will close for now. Feel free to re-open if this is not satisfactory.
The text was updated successfully, but these errors were encountered: