Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(146)

Issue 60110044: go.tools/go/types: Add Info parameter to EvalNode, remo...

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 11 months ago by gmk
Modified:
11 years, 10 months ago
Reviewers:
gri, adonovan
CC:
golang-codereviews
Visibility:
Public.

Description

go.tools/go/types: Add Info parameter to EvalNode, remove results, rename to CheckExpr, remove eval.go. Fixes issue 7151.

Patch Set 1 #

Patch Set 2 : diff -r f01dd4f7d639 https://code.google.com/p/go.tools #

Patch Set 3 : diff -r f01dd4f7d639 https://code.google.com/p/go.tools #

Patch Set 4 : diff -r f01dd4f7d639 https://code.google.com/p/go.tools #

Patch Set 5 : diff -r f01dd4f7d639 https://code.google.com/p/go.tools #

Total comments: 19

Patch Set 6 : diff -r fd4c6a614a3b https://code.google.com/p/go.tools #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+112 lines, -137 lines) Patch
M cmd/vet/types.go View 1 2 3 4 5 2 chunks +24 lines, -4 lines 2 comments Download
M go/pointer/pointer_test.go View 1 2 2 chunks +6 lines, -5 lines 0 comments Download
M go/pointer/testdata/mapreflect.go View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M go/types/api.go View 1 2 3 4 5 1 chunk +51 lines, -0 lines 0 comments Download
M go/types/checkexpr_test.go View 1 2 3 4 5 6 chunks +29 lines, -16 lines 0 comments Download
R go/types/eval.go View 1 1 chunk +0 lines, -110 lines 0 comments Download
M go/types/object.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 9
gmk
I shouldn't have just blown away eval_test.go. Resuscitating...
11 years, 11 months ago (2014-02-05 18:40:43 UTC) #1
gmk
On 2014/02/05 18:40:43, gmk wrote: > I shouldn't have just blown away eval_test.go. Resuscitating... eval_test.go ...
11 years, 11 months ago (2014-02-05 19:59:38 UTC) #2
gmk
https://codereview.appspot.com/60110044/diff/80001/go/types/object.go File go/types/object.go (right): https://codereview.appspot.com/60110044/diff/80001/go/types/object.go#newcode106 go/types/object.go:106: // introduced via CheckExpr) pkg == nil for fields ...
11 years, 11 months ago (2014-02-09 13:00:56 UTC) #3
gmk
https://codereview.appspot.com/60110044/diff/80001/go/types/object.go File go/types/object.go (right): https://codereview.appspot.com/60110044/diff/80001/go/types/object.go#newcode106 go/types/object.go:106: // introduced via CheckExpr) On 2014/02/09 13:00:57, gmk wrote: ...
11 years, 11 months ago (2014-02-09 16:41:16 UTC) #4
adonovan
Generally looks good, but wait for gri's review. FYI: I didn't see the mail for ...
11 years, 11 months ago (2014-02-09 18:53:49 UTC) #5
gmk
On 2014/02/09 18:53:49, adonovan wrote: > Generally looks good, but wait for gri's review. > ...
11 years, 11 months ago (2014-02-09 20:10:49 UTC) #6
gmk
https://codereview.appspot.com/60110044/diff/80001/cmd/vet/types.go File cmd/vet/types.go (right): https://codereview.appspot.com/60110044/diff/80001/cmd/vet/types.go#newcode82 cmd/vet/types.go:82: err = types.CheckExpr(x, fset, nil, nil, info) On 2014/02/09 ...
11 years, 11 months ago (2014-02-09 20:11:26 UTC) #7
gri
I'm going to have to think about this for a little while. The API is ...
11 years, 11 months ago (2014-02-10 21:09:41 UTC) #8
gmk
11 years, 10 months ago (2014-02-18 12:59:49 UTC) #9
Yes, CheckStmt would be great in theory, but is there a real need for it? 
CheckExpr is definitely useful and it makes go/types complement go/parser.

Regarding ease of use:  I've addressed the issue of the FileSet below; what
else?  The Package, Scope, and Info parameters are straightforward.

https://codereview.appspot.com/60110044/diff/100001/cmd/vet/types.go
File cmd/vet/types.go (right):

https://codereview.appspot.com/60110044/diff/100001/cmd/vet/types.go#newcode76
cmd/vet/types.go:76: // Create a file set that looks structurally identical to
the
On 2014/02/10 21:09:42, gri wrote:
> We really don't want to expose this to clients, exactly for reasons like this.
> types.New() is easy to use. types.CheckExpr is not.

In some (most?) cases, clients will already have a token.FileSet and then
types.CheckExpr is not so bad.

As Alan pointed out, parser.ParseExpr really ought to accept a token.FileSet.  I
don't think we should let this limitation of go/parser affect the API of
go/types.  But to make it easier to use we should provide such a version of
parser.ParseExpr, if possible; or at least wrap up the following two lines in
something like astutil.FileSetForExpr and mention it in the doc for CheckExpr.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b