1
0
mirror of https://github.com/golang/go synced 2024-11-05 21:36:12 -07:00
Commit Graph

635 Commits

Author SHA1 Message Date
Alan Donovan
1ff3452afa go.tools/ssa: unexport Register.
R=gri
CC=golang-dev
https://golang.org/cl/14672043
2013-10-14 13:48:34 -04:00
Shenghou Ma
1e6b0db4b9 go.tools/godoc/static: fix & escape in codewalks
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14426053
2013-10-13 22:22:48 -04:00
Robert Griesemer
60c505c95c go.tools/go/types: fix recorded type for append(s, "foo"...)
R=adonovan
CC=golang-dev
https://golang.org/cl/14512057
2013-10-11 14:27:44 -07:00
Alan Donovan
aff951c80f go.tools/pointer: more reflection operators.
(reflect.Value).Bytes
(reflect.Value).Elem
(reflect.Value).Index
(reflect.Value).SetBytes
(reflect.Value).Slice
reflect.PtrTo
reflect.SliceOf

+ Tests.

Also: comment out an 'info-'level print statement in the test; it was distracting.

R=crawshaw
CC=golang-dev
https://golang.org/cl/14454055
2013-10-11 15:34:19 -04:00
Robert Griesemer
271af2c149 go.tools/importer: delete BuiltinCallSignature
This functionality is now provided by go/types.

R=adonovan
CC=golang-dev
https://golang.org/cl/14489045
2013-10-11 12:26:31 -07:00
Alan Donovan
7e4be2f6bc go.tools/importer: crude fix for race condition.
Revision 8f2c714c6d97 made the 'imports' map per-typechecker,
not per package, breaking an assumption of doImport0.  This
API needs a rethink for a number of reasons, some of which are
noted in this CL.

R=gri
CC=golang-dev
https://golang.org/cl/14606044
2013-10-11 15:18:21 -04:00
Rob Pike
e4256a40f4 go.tools/cmd/cover: for range loops might contain function literals
Break the basic block at the function literal. The code to do this analysis
was already there; this CL just factors it out more nicely and uses it in
one new place. Also adds a test.

Fixes golang/go#6555.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14601043
2013-10-11 10:32:36 -07:00
Robert Griesemer
0c45220917 go.tools/go/types: record call-site specific types of built-in functions
Given a built-in call f(args), Info.Types now maps f to the call-site
specific type of f (by looking at the argument types) if the built-in
call is not producing a constant (at typecheck time) result. If the
result is constant, the recorded type is invalid (a back-end won't
need it).

R=adonovan
CC=golang-dev
https://golang.org/cl/14598045
2013-10-11 10:04:10 -07:00
Andrew Gerrand
7b481db506 go.tools/cmd/godoc: search go.tools/cmd for command docs
Update golang/go#6527

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/14526053
2013-10-11 10:36:50 +09:00
Andrew Gerrand
ce4c627192 go.tools/cmd/cover: move docs to separate doc.go
The doc.go files will be copied into the binary distributions'
source tree that "godoc cover" works.

R=r
CC=golang-dev
https://golang.org/cl/14599045
2013-10-11 09:13:58 +09:00
Alan Donovan
f5b337da55 go.tools/cmd/cover: preserve comments, as other build tools may need "// +build" directives.
Also: fix a crash when a file already contains 'import "sync/atomic"'.

R=r, gri
CC=golang-dev
https://golang.org/cl/14441052
2013-10-10 15:29:24 -04:00
Robert Griesemer
579c61d653 go.tools/go/types: more robust handling of ... errors with built-ins
Catch ... errors earlier and in case of error, type-check all
arguments anyway for better type reporting and fewer "declared
but not used" errors.

R=adonovan
CC=golang-dev
https://golang.org/cl/14600043
2013-10-10 11:05:46 -07:00
Robert Griesemer
f54303d6cb to.tools/go/types: check invalid use of ... with built-ins
R=adonovan
CC=golang-dev
https://golang.org/cl/14531047
2013-10-10 10:46:54 -07:00
Alan Donovan
548052f0fa go.tools/importer: honor the client's TypeChecker.{Import,Error} values.
This requires us to make a copy of (not clobber) the supplied
config, and retain their Import hook separately so that it can
be wrapped by Importer.doImport.

Fixes bug 6562.

R=gri
CC=golang-dev
https://golang.org/cl/14523054
2013-10-10 13:34:24 -04:00
Alan Donovan
e1e9089196 go.tools/importer: change type of print{,ln} built-ins.
Before: func(any, ...interface{}).
After:  func(any, ...any)

They are no longer variadic, so you can't write print(x, y...).

(Recall that print(1) and print(interface{}(1)) behave
differently and that this is useful.)

Fixes bug 6560

R=gri
CC=golang-dev
https://golang.org/cl/14455054
2013-10-10 13:33:29 -04:00
Alan Donovan
9cce4759bb go.tools/importer: expose CreatePackage method.
The new method is functionally identical to typeCheck, and
obviates the LoadMainPackage method.

Updated all clients.

Fixes bug 6561.

R=gri
CC=golang-dev
https://golang.org/cl/14494051
2013-10-10 12:37:49 -04:00
Robert Griesemer
7ca228a514 go.tools/go.types: more missing assigment checks implemented
Assignments to "comma, ok" expressions on the lhs of an
assignment are not permitted unless we have map index
"comma, ok" expression. Created new operand mode 'mapindex'
to distinguish this case. Renamed mode 'valueok' to the more
commonly used 'commaok' term, which also makes it easier to
distinguish from simply 'value'.

Added corresponding tests.

Fixes a TODO.

R=adonovan
CC=golang-dev
https://golang.org/cl/14526049
2013-10-10 09:02:54 -07:00
Robert Griesemer
f50f6c858a go.tools/go/types: nil is not a constant + misc. cleanups
- removed support for nil constants from go/exact
- instead define a singleton Nil Object (the nil _value_)
- in assignments, follow more closely spec wording
  (pending spec CL 14415043)
- removed use of goto in checker.unary
- cleanup around handling of isRepresentable for
  constants, with better error messages
- fix missing checks in checker.convertUntyped
- added isTyped (== !isUntyped) and isInterface predicates
- fixed hasNil predicate: unsafe.Pointer also has nil
- adjusted ssa per adonovan
- implememted types.Implements (wrapper arounfd types.MissingMethod)
- use types.Implements in vet (and fix a bug)

R=adonovan, r
CC=golang-dev
https://golang.org/cl/14438052
2013-10-09 14:17:25 -07:00
Alan Donovan
9c8d9fe736 go.tools/pointer: support reflect.Method{,ByName}.
R=crawshaw
CC=golang-dev
https://golang.org/cl/14589043
2013-10-09 16:35:59 -04:00
Rob Pike
3edc3b18a9 go.tools/README: update to make truthful
The old README was misleading, saying the packages were not of interest.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14516051
2013-10-09 11:47:05 -07:00
Alan Donovan
e590cdbdf8 go.tools/ssa: doc tweaks + a sanity check.
R=gri
CC=golang-dev
https://golang.org/cl/14454053
2013-10-09 12:47:30 -04:00
Alan Donovan
2299ac6bf3 go.tools/pointer: make sole callsite available to intrinsics in non-shared contours.
This information can be used to specialize such calls, e.g.
- report location of unsound calls (done for reflect.NewAt)
- exploit argument information (done for constant 'dir' parameter to reflect.ChanOf)

+ tests.

R=crawshaw
CC=golang-dev
https://golang.org/cl/14517046
2013-10-09 12:41:55 -04:00
Alan Donovan
cd908f1108 go.tools/ssa/interp: capture stdout/err of target programs and check for "BUG".
The $GOROOT/tests may print "BUG" on failure but do not
necessarily exit zero, so we must capture their output too.

Details:
- make plan9 use unix's valueToBytes function (now in externals.go)
- direct the target's syscall.Write and print/println built-ins to a new utility, write().  This may capture the output into a global variable.

R=gri, r
CC=golang-dev
https://golang.org/cl/14550044
2013-10-08 14:35:39 -04:00
Alan Donovan
068f017092 go.tools/ssa: s/Ret/Return/g
R=gri
CC=golang-dev
https://golang.org/cl/14526044
2013-10-08 12:31:39 -04:00
Alan Donovan
8ae5d36d2a go.tools: clear DeclarationErrors flag; it's redundant w.r.t go/types checking.
R=gri
CC=golang-dev
https://golang.org/cl/14147043
2013-10-08 10:34:36 -04:00
Tw
da6f00a60b go.tools/blog: replace "\\" with "/" in path string to be compatible with windows platform
Fixes golang/go#6539

The problem happens on my win7,
for example, the path is "/content\\foo.article".
It leads to the wrong link in generated html page.
So I think we should replace all"\\" with "/" in path string at first.

R=golang-dev, dsymonds, mirtchovski, dave, adg, alex.brainman
CC=golang-dev
https://golang.org/cl/14023043
2013-10-08 16:55:56 +11:00
Robert Griesemer
5d9b86d6ce go.tools/go/types: range iteration variables are typed (not untyped)
R=adonovan
CC=golang-dev
https://golang.org/cl/14516044
2013-10-07 20:27:21 -07:00
Dominik Honnef
d5044c7ed2 go.tools/cmd/vet: Update canonical method check for new xml.Marshaler/Unmarshaler interfaces
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14484043
2013-10-07 11:10:36 -07:00
Chris Manghane
1d4de00292 go.tools/dashboard: clone main repo from local path if it already exists locally.
R=adg, minux.ma
CC=golang-dev
https://golang.org/cl/14462049
2013-10-07 09:06:32 -07:00
Alan Donovan
eb632ebaca go.tools/ssa/interp: enable tests of builtin(f()) where f has multiple results.
R=gri
CC=golang-dev
https://golang.org/cl/14408043
2013-10-04 16:52:12 -04:00
Robert Griesemer
5d0990f591 go.tools/go/types: built-in calls of the form builtin(f())
- factor out argument extraction logic
- cleaned up error handling in builtin.go (no need for goto's anymore)
- lots of additional test cases
- various cleanups, better documentation

Fixes golang/go#5795.

R=adonovan
CC=golang-dev
https://golang.org/cl/14312044
2013-10-04 13:32:21 -07:00
Matt Reiferson
6af036a659 go.tools/vcs: allow compilation with go 1.0
It would be nice to be able to use this package
as a dependency (or other go utilities in the
ecosystem that depend on this package) in
environments which have not (or cannot) for
whatever reason upgraded to newer versions of
golang.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14283043
2013-10-04 11:46:57 +10:00
Andrew Gerrand
c8494e30f9 go.tools/godoc/redirect: remove redundant redirect rules
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14365043
2013-10-04 09:49:25 +10:00
Andrew Gerrand
0ccb6234c3 undo CL 14368043 / 7750fc1a6bd2
Not the right approach.

««« original CL description
go.tools/godoc: reverse reversed redirects

Make godoc work again for go spec and memory model doc.

TBR=rsc
CC=golang-dev
https://golang.org/cl/14368043
»»»

R=gri
CC=golang-dev
https://golang.org/cl/14370043
2013-10-04 09:48:07 +10:00
Rob Pike
51613a10d7 go.tools/cmd/cover: sort the file names in the output presentation
Present the files in lexical order so the output is reproducible
and easier to navigate. Do a little type rearrangement to simplify
things while we're there.

R=adg
CC=golang-dev
https://golang.org/cl/14357043
2013-10-03 16:37:34 -07:00
Robert Griesemer
40ede1040a go.tools/godoc: reverse reversed redirects
Make godoc work again for go spec and memory model doc.

TBR=rsc
CC=golang-dev
https://golang.org/cl/14368043
2013-10-03 16:36:34 -07:00
Russ Cox
5785dc19d7 godoc: redirect bogus /doc/spec links to /ref/spec
It was not enough to make /ref/spec work (which it now does),
because some of the docs on golang.org (in particular golang.org/doc)
are pulled from tip, and tip links to /doc/spec now.
Make those "too new" links work by redirecting /doc/spec
back to /ref/spec for now.

TBR=adg
CC=golang-dev
https://golang.org/cl/14348043
2013-10-03 13:41:38 -04:00
Russ Cox
c11b695c55 go.tools/godoc: remove Go 1.2 redirects
They are breaking golang.org
(try loading golang.org/ref/spec).

TBR=adg
CC=golang-dev
https://golang.org/cl/14165044
2013-10-03 13:16:17 -04:00
Andrew Gerrand
dcad628c68 go.tools/cmd/blog: handle "/blog/" redirect properly
The redirect.PrefixHandler redirects "/foo/" to "/foo", which is what
we want in most cases ("/cl/", "/change/", etc) but not here.
So wrap it with a handler that handles "/blog/" explictly.

R=dsymonds
CC=golang-dev
https://golang.org/cl/14326043
2013-10-03 18:10:57 +10:00
Andrew Gerrand
228e3cbbaa go.tools/blog: remove playground package import
This is the responsibility of the godoc or blog binary,
not the blog package.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14323043
2013-10-03 15:07:29 +10:00
Andrew Gerrand
3a3a765782 go.tools/cmd/godoc: fix app engine version; update build script and readme
R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/12897045
2013-10-03 14:29:16 +10:00
Russ Cox
1d95d02fef go.tools/cmd/godoc: point at doc.ToHTML documentation for formatting rules
Fixes golang/go#5429.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14292043
2013-10-02 22:08:24 -04:00
Robert Griesemer
b9b3bed16e go.tools/go/types: fix build (gc export format changed)
Revision f280b8a485fd of the std library changed the
gc export format: anonymous fields may be qualified
with a package.

R=rsc
TBR=rsc
CC=golang-dev
https://golang.org/cl/14312043
2013-10-02 16:53:34 -07:00
Chris Manghane
63365376db go.tools/dashboard: Don't keep unversioned directories in gcc copy.
`svn update` would fail if the updated files were in the gcc/libgo or gcc/go/gofrontend because unrevisioned versions of those files had been inserted in the last build of gcc.

R=adg, adg
CC=golang-dev
https://golang.org/cl/14299043
2013-10-02 15:56:27 -07:00
Chris Manghane
691b055ea6 go.tools/dashboard: Make sure links to commits and logs are dashboard specific.
R=adg
CC=golang-dev
https://golang.org/cl/14297043
2013-10-02 15:55:44 -07:00
Andrew Gerrand
401293d22c go.tools/godoc: provide an explicit mux to register redirects
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14199043
2013-10-02 13:13:34 +10:00
Robert Griesemer
a32c2633d0 go.tools/go/types: complete checking of append built-in
R=adonovan
CC=golang-dev
https://golang.org/cl/14238043
2013-10-01 18:14:15 -07:00
Caine Tighe
d7d04a24e8 present/code.go: remove residual file from an hg merge.
R=adg
CC=golang-dev
https://golang.org/cl/14043043
2013-10-02 11:02:33 +10:00
Alan Donovan
2bd0ec31c0 go.tools/oracle: fix minor but confusing bug in test driver.
Since rev 4c5f46cc7b9d, error messages no longer contain
"file:line:col: " prefixes, so applying stripLocation to them
is incorrect.

Also: add rationale comment to callgraph2.go test.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13888044
2013-10-01 10:17:26 -04:00
Alan Donovan
ae060fe849 go.tools/pointer: make os.Args point to something.
Since the Go runtime treats it specially, so must the pointer analysis.

Details:
- Combine object.{val,typ} fields into 'data interface{}'.
  It may now hold a string, describing an instrinsically
  allocated object such as the command-line args.
- extend Label accordingly; add Label.ReflectType() accessor.

Also: document pointer analysis algorithm classification.

R=crawshaw
CC=golang-dev
https://golang.org/cl/14156043
2013-10-01 09:46:33 -04:00