1
0
mirror of https://github.com/golang/go synced 2024-10-01 07:28:35 -06:00
Commit Graph

745 Commits

Author SHA1 Message Date
Robert Griesemer
ef434a14da go.tools/go/types: record correct type for parenthesized x.(T) in comma-ok expressions
Fixes golang/go#6796.

R=adonovan
CC=golang-dev
https://golang.org/cl/30070044
2013-11-21 09:11:57 -08:00
Brad Garcia
f3faf8b6e0 godoc: add search results that point to documentation instead of source.
Add explicit options to Corpus to control search indexing of documentation, Go source code, and full-text.

R=bradfitz, r
CC=golang-dev
https://golang.org/cl/24190043
2013-11-21 11:55:42 -05:00
Richard Musiol
88e2928490 go.tools/go/types: Do not throw error on division of complex variables by zero.
See http://play.golang.org/p/DrgLKnHaUW
Seems like division of a variable by zero should only throw an error if the variable is an integer.

R=golang-dev, mtj, gri
CC=golang-dev, gri
https://golang.org/cl/29500047
2013-11-20 13:42:30 -08:00
Alan Donovan
2e33158b60 go.tools/oracle: show size and alignment for structs and named types.
Users should be familiar with the sizes of all other types.

Currently we assume amd64 (as do other parts of the oracle,
e.g. go/build tags).  Will parameterize later.

R=crawshaw
CC=golang-dev, gri
https://golang.org/cl/29710043
2013-11-20 16:00:23 -05:00
Brad Garcia
b844907f9f godoc: refactor command-line mode handling.
R=bradfitz
CC=golang-dev
https://golang.org/cl/29230044
2013-11-20 09:56:10 -05:00
Robert Griesemer
b4286c4c1b go.tools/go/types: missing checks for select statements
Also: Use defer to make sure scopes are always closed
even in case of early exits via bailout (and don't cause
an imbalanced scope error in debug mode).

R=adonovan, gri
CC=golang-dev
https://golang.org/cl/29300043
2013-11-19 13:58:01 -08:00
Robert Griesemer
849643aaaf go.tools: cleanups (added copyrights to astutil, clearer logic in go/types)
R=adonovan
CC=golang-dev
https://golang.org/cl/29110043
2013-11-19 09:07:02 -08:00
Robert Griesemer
df6f0829a2 go.tools/go/types: complete expr and type string functions
- consolidate them in (expr|type)string[_test].go
- support for printing all ast.Expr
- fix printing of type: chan (<-chan int) (parentheses)
- more consistent names, comments, and exports

R=adonovan
CC=golang-dev
https://golang.org/cl/28680043
2013-11-18 22:38:48 -08:00
Robert Griesemer
65aa1a4fbe go.tools/go/types: String method for Initializers
Plus a couple of minor fixes.

R=adonovan
CC=golang-dev
https://golang.org/cl/28540043
2013-11-18 11:26:49 -08:00
Brad Fitzpatrick
a284a61701 astutil: add new broken test
Tests will still pass because it's marked as known broken,
but it will log the unexpected for now.

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/27330043
2013-11-16 14:53:18 -08:00
Robert Griesemer
e785f050b6 go.tools/go/types: add missing checks for short variable declarations
Fixes golang/go#6766.

R=adonovan
CC=golang-dev
https://golang.org/cl/24330044
2013-11-15 14:26:29 -08:00
Robert Griesemer
01f122e48b go.tools/go/gcimporter: fix build by adjusting test to new print output
R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/26430049
2013-11-15 11:58:23 -08:00
Marko Mikulicic
ae3dd78063 godoc: Index const and vars in godoc.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/26990043
2013-11-15 11:03:25 -08:00
Alan Donovan
9c112540f6 go.tools/oracle: use SelectionString when printing methods.
R=gri, crawshaw, gri
CC=golang-dev
https://golang.org/cl/26900043
2013-11-15 12:35:11 -05:00
Alan Donovan
45992044b5 go.tools/go/types: SelectionString: print method with selective package-qualification.
R=gri, gri
CC=golang-dev
https://golang.org/cl/26570048
2013-11-15 12:35:03 -05:00
Alan Donovan
f488a2c4f5 go.tools/oracle: use TypeString, ObjectString to print relative (unqualified) names when a package is implied by the context.
+ a couple more tests.

R=gri, crawshaw
CC=golang-dev
https://golang.org/cl/26370046
2013-11-15 09:22:16 -05:00
Alan Donovan
9fcd20e680 go.tools/ssa: display named types package-qualified using types.TypeString.
Details:
- use relative (non-qualified) names in more places
- Member interface now has Package(), RelString() methods.
- (*Function).DumpTo: add "# Package: " header.
- Added sanity checks for String functions.

R=gri, gri
CC=golang-dev
https://golang.org/cl/26380043
2013-11-15 09:21:48 -05:00
Alan Donovan
0820934407 go.tools/go/types: add TypeString, ObjectString utilities
These are variants of Type.String(), Object.String() that
accept a 'from *Package' argument.  If provided, package
qualification is omitted when printing named types belonging
to that package.

This is useful for UIs where a package is implied by context
e.g. ssadump disassembly, oracle output.

+ Test.

R=gri, gri, gordon.klaus
CC=golang-dev
https://golang.org/cl/22190048
2013-11-15 09:20:46 -05:00
Robert Griesemer
91e5190eb9 go.tools/go/types: minor cleanups
R=adonovan
CC=golang-dev
https://golang.org/cl/26430045
2013-11-14 21:38:04 -08:00
Alan Donovan
19dd02b670 go.tools/ssa: fix bug in SSA lifting (!)
The previous code introduced spurious loop-carried
dependencies for variables local to a loop body (for example).
The SSA renaming pass now treats an Alloc instruction like a
Store of the zero value.

Also:
- added regression test
- improved log messages
- made the Store/Load/Alloc cases look more similar.

R=gri, gri
CC=golang-dev
https://golang.org/cl/26750043
2013-11-14 17:33:07 -05:00
Robert Griesemer
27563ff576 go.tools/go/types: move gcimporter to its own package
- fixed a couple of TODOs
- various cleanups along the way
- adjusted clients

Once submitted, clients of go/types that don't explicitly
specify Config.Import will need to add the extra import:

import _ "code.google.com/p/go.tools/go/gcimporter"

to install the default (gc) importer in go/types.

R=adonovan, gri
CC=golang-dev
https://golang.org/cl/26390043
2013-11-14 14:11:43 -08:00
Brad Fitzpatrick
88f792caef godoc: be quiet by default about bad examples
Fixes golang/go#6759

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/26420044
2013-11-14 09:01:08 -08:00
Alan Donovan
75d66fbb7b go.tools/ssa/interp: fix build breakage.
(intersecting changes in client)

R=gri, gri
CC=golang-dev
https://golang.org/cl/24100046
2013-11-13 18:50:24 -05:00
Robert Griesemer
d1184e294e go.tools/go/types: fix build
(I inadvertently submitted a modified file.)

R=adonovan
CC=golang-dev
https://golang.org/cl/22750044
2013-11-13 15:21:38 -08:00
Richard Musiol
cfc002f30b go.tools/go/types: Do not throw error on division of float variables by zero.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/26040043
2013-11-13 15:16:19 -08:00
Alan Donovan
cadc2255fe go.tools/ssa: don't synthesize an empty "testmain" package.
Also, only examine functions defined in *_test.go files.

Added tests for empty and nonempty behaviour of CreateTestMainPackage.
(Required some surgery to interp_test.)

R=gri, gri
CC=golang-dev
https://golang.org/cl/25570044
2013-11-13 16:05:13 -05:00
Alan Donovan
3f686cae84 go.tools/go/types: print named types with package qualification.
Depending on the context, printing only the package name can
be ambiguous or even incorrect since it is valid only within
the environment of a given file's import specs.

(The standard library packages are mostly unique in their last
segment, but this is not the case for proprietary repos.)

R=gri, gri
CC=golang-dev
https://golang.org/cl/26300043
2013-11-13 16:03:41 -05:00
Alan Donovan
677415b351 go.tools/ssa: don't print * on type of package-level vars (*ssa.Global)
R=gri, gri
CC=golang-dev
https://golang.org/cl/26240043
2013-11-13 15:13:55 -05:00
Alan Donovan
70692d3c5f go.tools/pointer: fix constraint generation bug in *ssa.Select.
The previous code assumed that each channel item contained one field.

+ regression test.

R=crawshaw
CC=golang-dev
https://golang.org/cl/25480044
2013-11-13 09:13:42 -05:00
Alan Donovan
775fb1976b go.tools/oracle: make callgraph printing deterministic (and context-insensitive)
+ re-enable test.

R=crawshaw
CC=golang-dev
https://golang.org/cl/25730044
2013-11-13 09:11:10 -05:00
Alan Donovan
e7a2e079b0 go.tools/ssa: use correct Alloc.Comment in lifting.
(Only affects diagnostic output.)

R=gri, gri
CC=golang-dev
https://golang.org/cl/23770046
2013-11-12 23:04:09 -05:00
Brad Fitzpatrick
626e9341d5 godoc: add forgotten file from last CL to fix build
R=adg, franciscossouza, dave
CC=golang-dev
https://golang.org/cl/25650043
2013-11-12 15:46:25 -08:00
David Crawshaw
545b16b6db go.tools/astutil: add AddNamedImport
R=bradfitz
CC=golang-dev
https://golang.org/cl/23850044
2013-11-12 18:02:47 -05:00
Brad Fitzpatrick
515bcdc536 godoc: update Index.{Write,Reader}, add tests
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/24490043
2013-11-12 14:58:47 -08:00
Robert Griesemer
f339918a70 go.tools/go/exact: some factoring, more tests
R=adonovan
CC=golang-dev
https://golang.org/cl/25440043
2013-11-12 12:45:43 -08:00
Richard Musiol
a5baa859ae go.tools/go/exact: Fix for exact.BinaryOp. It was modifying its argument.
R=golang-dev, gri, mail
CC=golang-dev
https://golang.org/cl/24570043
2013-11-12 10:06:24 -08:00
Alan Donovan
d8292e2a38 go.tools/go/types: cache method set for pointer-to-named in the Named.
This change improves the complete running time of 'ssadump cmd/oracle' by ~20%.

R=gri, gri
CC=golang-dev
https://golang.org/cl/22910045
2013-11-11 17:20:27 -05:00
Robert Griesemer
c798b9cca0 go.tools/go/types: check validity of import paths
This check is currently done in go/parser as well but
eventually can be removed from there (after Go 1.2).

R=adonovan
CC=golang-dev
https://golang.org/cl/22240045
2013-11-08 14:14:58 -08:00
Robert Griesemer
7b183d1766 go.tools/go/types, cmd/gotype: fix early bailout
Clients must have chance to look at panics they
are raising.

R=adonovan
CC=golang-dev
https://golang.org/cl/23820043
2013-11-08 12:52:57 -08:00
Robert Griesemer
e8fe66cd57 go.tools/go/types: print initialization cycles
Also: Always report cycle at first (in source order)
variable in the cycle.

R=adonovan, gri
CC=golang-dev
https://golang.org/cl/23370043
2013-11-08 12:06:10 -08:00
David Crawshaw
0d4ee40f21 go.tools/astutil: add Imports, which returns imports grouped by spacing.
R=bradfitz
CC=golang-dev
https://golang.org/cl/23660045
2013-11-08 14:51:15 -05:00
Robert Griesemer
0f193b767d go.tools/go/types: simplified GcImportedTypes test
R=adonovan
CC=golang-dev
https://golang.org/cl/23340043
2013-11-08 08:56:55 -08:00
Robert Griesemer
7520cff8d3 go.tools/go/types: remove a workaround for 386 bug
R=adonovan
CC=golang-dev
https://golang.org/cl/23350043
2013-11-08 08:55:16 -08:00
Andrew Gerrand
50d9adec93 go.tools/blog: strip prefix when serving static content
This fix permits godoc to serve images correctly under /blog/.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/22700043
2013-11-08 13:28:32 +11:00
Kamil Kisiel
e59751ce56 oracle: Fix documentation references to importer package functions.
R=golang-dev, adonovan
CC=golang-dev
https://golang.org/cl/21230043
2013-11-07 16:47:35 -05:00
Robert Griesemer
0c141425f6 go.tools/cmd/gotype: parse in parallel
Performance increase is much smaller than expected;
need to investigate. Possibly, repeatedly (for each
line) accessing file sets from multiple goroutines
(in the scanner) is a bottle neck; or perhaps i/o.

R=adonovan
CC=golang-dev
https://golang.org/cl/23090043
2013-11-07 13:32:02 -08:00
Alan Donovan
f1e5b03c6e go.tools/ssa: populate Function.Referrers(), for anon functions.
Added sanity check to ensure Operands/Referrers are complete and dual.

Also: unexport Instruction.setBlock (=> no longer user-implementable).

R=gri
CC=golang-dev
https://golang.org/cl/22150043
2013-11-07 10:08:51 -05:00
Robert Griesemer
7123ca00a8 go.tools/go/types: fix bug in init cycle detection
Initialization cycles need to reported for cycles
that contain variables, even if they don't end in
a variable.

This fixes the last known issue with the existing
std library tests.

R=adonovan, gri
CC=golang-dev
https://golang.org/cl/22200049
2013-11-06 17:47:54 -08:00
Francesc Campoy
2c650d6a84 go.tools/present: add extension name to Code
This will be used to show the "Run" button for code snippets in go.talks only for Go when running on App Engine.

R=adg, r, iant
CC=golang-dev
https://golang.org/cl/21930047
2013-11-06 13:02:20 -08:00
David Crawshaw
6df4bd0406 go.tools/astutil: make sure import blocks are marked as such (Lparen=1)
R=bradfitz
CC=golang-dev
https://golang.org/cl/22320044
2013-11-06 15:31:54 -05:00