--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
When using go/types (including via go/loader), you want to use https://golang.org/pkg/go/types/#Info.ObjectOf instead of `*ast.Ident.Obj`.On Sun, Apr 16, 2017 at 11:50 PM, <m...@tejas.io> wrote:https://github.com/golang/tools/blob/master/go/loader/loader.goI think it'd be nice to expose ast.Package so it's ast.Walk-able, as (I think) that would mean you could assume things like `*ast.Ident.Obj` were not nil for valid Go code while traversing method declarations and whatnot rather than having to ast.Walk on a per-file basis when the linked declaration could be in another file.
But this won't work if the object is declared in a different file if AST is parsed on a per file basis right?
If we were using an ast.Package I'd assume everything was available in the scope of the package
is it possible to derive go/types.Named from AST? I am able to match on `*ast.TypeSpec` and get a StructType from here, but it does not have support for extracting things like receiver methods (even though reflection and Named allow for this).