Rewrite the checker to be more flexible and better documented, being
more explicit about parsed format vs. checked arguments.
No attempt yet to do check indexed formats; this just paves the way.
All tests still pass.
R=gri
CC=golang-dev
https://golang.org/cl/9881044
Also:
- more cleanup of new identifier resolution code
- removed residue Object.Pos() code
- two separate, equally formatted error messages for redeclaration
errors for easier tool support
- initial support for labels
- enabled several disabled tests
Thic CL will break go.tools/ssa/interp, but the pending
CL 9863045 fixes that.
Fixesgolang/go#5504.
R=adonovan
CC=golang-dev
https://golang.org/cl/9839045
Implement Pos() method for
Values: Parameter, Capture, Phi. (Not Literal, Builtin.)
Instructions: UnOp, BinOp, Store.
'address' (an lvalue) now needs position of '*' in "*addr".
Also:
- Un-export fields Pos_ Type_ Name_ Block_ from various values/instructions.
Define NewFunction() as a temporary measure.
Will try to eliminate calls from clients...
- Remove Implements{Value,Member,Interface} marker methods.
I've decided I don't like them.
- Func.addParamObj helper.
- Various comment fixes.
R=gri
CC=golang-dev
https://golang.org/cl/9740046
Can't reproduce the failure outside the builder, but attempt a fix
by changing the criterion for failure: FAIL iff the output contains "BUG".
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/9798050
Simplify the code a bit, get it working after recent go/types changes,
and handle "%*%" just in case. Preparation for handling argument indexing.
R=gri
CC=golang-dev
https://golang.org/cl/9747045
PathEnclosingInterval: maps a source position to an ast.Node.
EnclosingFunction: finds ssa.Function enclosing an ast.Node.
HasEnclosingFunction: cheaper impl of EnclosingFunction()!=nil
NodeDescription: user friendly node type descriptions.
+ tests.
Also: make ssa.Package.TypeInfo field a pointer.
R=gri, r
CC=golang-dev
https://golang.org/cl/9639045
By setting resolve = true in check.go, the type checker
will do all identifier resolution during type checking
time and ignore (and not depend on) parser objects. This
permits the type checker to run easily on ASTs that are
not generated with invariants guaranteed by the parser.
There is a lot of new code; much of it slightly modified
copies of old code. There is also a lot of duplication.
After removing the dead code resulting from resolve = true
permanently (and removing the flag as well), it will be
easier to perform a thorough cleanup. As is, there are
too many intertwined code paths.
For now resolve = false. To be enabled in a successor CL.
R=adonovan
CC=golang-dev
https://golang.org/cl/9606045
Extracted Builder.findMethod function to handle
methodset/receiver logic common to
function calls (Builder.setCall) and
bound method closure creation (Builder.selector).
Capture: added explicit Name, Type fields to Capture instead
of relying on Outer field, which is now un-exported since its
only purpose is to let Builder.expr(case *ast.FuncLit) know
which values to put in the closure; it is nilled immediately
after.
Simplified Function.lookup() logic: there's no need to walk
the Outer chain each time to set Alloc.Heap=true, as it's
already set during creation of the outermost
Capture{outer:*Alloc}.
Added interp/testdata/boundmeth.go test.
Cosmetic changes:
- add support for bound method thunks to Function.FullName().
- Simplified {Literal,Global,Builtin,Function}.String()
- doc: Captures are no longer necessarily addresses.
- added yet another missing pair of "()" (go/types accessors).
- print "Synthetic" not "Declared at -" for synthetic functions.
- use '$' not center-dot in synthetic identifiers (easier to type).
R=gri
CC=golang-dev
https://golang.org/cl/9654043
- remove Makefile
- move test data into a subdirectory
- encapsulate the invocation of errchk into a standard Test using os.exec
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/9509045
Now that it's in the same repository as the go/types package we can delete
the mechanism to build it without type checking.
Add a make rule to install it where the go tool can find it.
Why doesn't "go install" take a -o flag?
R=gri
CC=gobot, golang-dev
https://golang.org/cl/9526043
Also:
- remove redundant text in doc.go.
- fix (yet more) cases of missing parens in Printf, fallout from
go/types accessors refactoring.
- don't mix spaces and tabs within lines printed by ssa.Function.DumpTo:
it makes it too hard to constructed expected outputs for tests.
(Tabs may appear at line start though.)
Sadly godoc -play won't run this program; it complains it
can't import "code.google.com/p/go.exp/ssa". Any idea why?
R=gri
CC=golang-dev
https://golang.org/cl/9481044
They will be deleted from their current homes once this has landed.
Changes made to import paths to make the code compile, and to find
errchk in the right place in cmd/vet's Makefile.
TODO in a later CL: tidy up vet.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/9495043