LGTM. This is all very straightforward. https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go File src/pkg/go/types/objects.go (right): https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go#newcode17 src/pkg/go/types/objects.go:17: GetPkg() *Package Under ...
12 years, 4 months ago
(2013-02-13 04:57:57 UTC)
#2
Let's discuss this tomorrow in detail. - gri https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go File src/pkg/go/types/objects.go (right): https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go#newcode17 src/pkg/go/types/objects.go:17: GetPkg() ...
12 years, 4 months ago
(2013-02-13 05:04:04 UTC)
#3
Let's discuss this tomorrow in detail.
- gri
https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go
File src/pkg/go/types/objects.go (right):
https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go#...
src/pkg/go/types/objects.go:17: GetPkg() *Package
On 2013/02/13 04:57:58, adonovan wrote:
> Under what circumstances is it nil?
>
> I would expect that for function-local 'const', 'var' and 'type' decls and for
> 'func' literals it would be nil.
Right now it should only be nil for objects that are in no package (universe),
and parameters/results.
We can define what we want - for instance we could only set it for top-level
(package-level) objects. That would make a lot of sense. The invariant would be
that for such an object obj we can always find it in obj.Pkg.Scope . Maybe
that's the right definition.
https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go#...
src/pkg/go/types/objects.go:56: type Var struct {
On 2013/02/13 04:57:58, adonovan wrote:
> I wonder if it's worth defining a different type for the elements of a
> types.Signature, since half the space of a Var is unused in that case.
Yes, I have been wondering, too. It might clean up a few things.
On 13 February 2013 00:04, <gri@golang.org> wrote: > Let's discuss this tomorrow in detail. > ...
12 years, 4 months ago
(2013-02-13 05:06:35 UTC)
#4
On 13 February 2013 00:04, <gri@golang.org> wrote:
> Let's discuss this tomorrow in detail.
> - gri
>
>
>
> https://codereview.appspot.**com/7312093/diff/6001/src/pkg/**
>
go/types/objects.go<https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go>
> File src/pkg/go/types/objects.go (right):
>
> https://codereview.appspot.**com/7312093/diff/6001/src/pkg/**
>
go/types/objects.go#newcode17<https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go#newcode17>
> src/pkg/go/types/objects.go:**17: GetPkg() *Package
> On 2013/02/13 04:57:58, adonovan wrote:
>
>> Under what circumstances is it nil?
>>
>
> I would expect that for function-local 'const', 'var' and 'type' decls
>>
> and for
>
>> 'func' literals it would be nil.
>>
>
> Right now it should only be nil for objects that are in no package
> (universe), and parameters/results.
>
> We can define what we want - for instance we could only set it for
> top-level (package-level) objects. That would make a lot of sense. The
> invariant would be that for such an object obj we can always find it in
> obj.Pkg.Scope . Maybe that's the right definition.
Yes, that's what makes most sense to me. What you have here is progress
though.
>
>
> https://codereview.appspot.**com/7312093/diff/6001/src/pkg/**
>
go/types/objects.go#newcode56<https://codereview.appspot.com/7312093/diff/6001/src/pkg/go/types/objects.go#newcode56>
> src/pkg/go/types/objects.go:**56: type Var struct {
> On 2013/02/13 04:57:58, adonovan wrote:
>
>> I wonder if it's worth defining a different type for the elements of a
>> types.Signature, since half the space of a Var is unused in that case.
>>
>
> Yes, I have been wondering, too. It might clean up a few things.
>
>
https://codereview.appspot.**com/7312093/<https://codereview.appspot.com/7312...
>
Issue 7312093: code review 7312093: go/types: Pkg *Package field for all objects
(Closed)
Created 12 years, 4 months ago by gri
Modified 12 years, 4 months ago
Reviewers:
Base URL:
Comments: 4