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: request for NewSelection constructor #12881

Open
griesemer opened this issue Oct 8, 2015 · 0 comments
Open

go/types: request for NewSelection constructor #12881

griesemer opened this issue Oct 8, 2015 · 0 comments
Assignees
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Oct 8, 2015

Consider (*ssa.Program).MethodValue(sel *types.Selection) *ssa.Function. It requires a *types.Selection as its argument. If you have the receiver type T and the selector name (pkg, name), you can obtain a Selection by calling types.NewMethodSet(T).Lookup(pkg, name), but this is asymptotically more expensive than calling types.LookupFieldOrMethod(T, false, pkg, name).

Ideally the client would be able to call LookupFieldOrMethod and then construct a Selection (field or method) from the result, but there is no way for clients to construct a Selection.

Could we expose a NewSelection constructor?

(see #10091 for background)

@griesemer griesemer self-assigned this Oct 8, 2015
@rsc rsc added this to the Go1.6 milestone Oct 23, 2015
@rsc rsc added this to the Unplanned milestone Nov 30, 2015
@rsc rsc removed this from the Go1.6 milestone Nov 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants