Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types: need way to get from function type to function decl #8763

Open
griesemer opened this issue Sep 17, 2014 · 0 comments
Open

go/types: need way to get from function type to function decl #8763

griesemer opened this issue Sep 17, 2014 · 0 comments
Labels
Milestone

Comments

@griesemer
Copy link
Contributor

From a mail conversation:

On Fri, Sep 12, 2014 at 12:09 PM, Peter Collingbourne <pcc@google.com> wrote:
This information is significant for name mangling and is therefore needed. If there were
a convenient way to ask a named type for its enclosing function, I think it would be
possible to get rid of this traversal. Robert might have opinions on this.

On Fri, Sep 12, 2014 at 5:05 PM, Robert Griesemer <gri@google.com> wrote:
 You should be able to get the scope for each variable (Object) via Parent(). Furthermore, Info.Scopes should give you a mapping of nodes to scopes, which should make this simpler. But perhaps I am missing something.

Peter Collingbourne:
I looked at Info.Scopes. I imagine that I could potentially make that work if I built my
own scope-to-function map from that mapping.

According to the documentation, I might expect to find (among other things) ast.FuncType
keys in the map. Is this what I should expect functions to be represented as? I looked
up ast.FuncType and could not see any way to get the function's name. It seems like it
would be more useful for me if that map stored FuncDecl keys. (If that wouldn't work for
whatever reason, it seems better to me for go/types to maintain the mapping from scopes
to objects, maybe just by adding an Object field to Scope).

--------------------

Need to rethink connection between function types/decls and scopes.
@griesemer griesemer self-assigned this Sep 17, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc removed the release-none label Apr 10, 2015
@rsc rsc changed the title go.tools/go/types: need way to get from function type to function decl x/tools/go/types: need way to get from function type to function decl Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@griesemer griesemer changed the title x/tools/go/types: need way to get from function type to function decl go/types: need way to get from function type to function decl Jul 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants