1
0
mirror of https://github.com/golang/go synced 2024-10-01 11:18:32 -06:00
Commit Graph

7 Commits

Author SHA1 Message Date
Alan Donovan
4e0d6858c8 go.types/ssa: inline all calls to objKind().
R=gri
CC=golang-dev
https://golang.org/cl/9740052
2013-05-30 12:13:42 -04:00
Alan Donovan
6c7ce1c2d3 go.tools/ssa: Value.Pos() method + remaining source position plumbing.
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
2013-05-30 09:59:17 -04:00
Alan Donovan
20029fe5f7 go.tools/ssa: utility functions mapping source intervals to ast.Nodes.
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
2013-05-28 15:28:46 -04:00
Robert Griesemer
98bcbfbab7 go.tools/ssa: print identifer location if not found in TypeInfo
R=adonovan, r
CC=golang-dev
https://golang.org/cl/9703044
2013-05-25 10:04:20 -07:00
Alan Donovan
8cdf1f1cb1 go.tools/ssa: add support for bound-method closures.
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
2013-05-22 17:56:18 -04:00
Rob Pike
87334f402b go.tools: bring up to date
Repo was copied from old point.  Bad r.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/9504043
2013-05-17 14:02:47 -07:00
Rob Pike
83f21b9226 go.tools: add missing files ssa/*.go
R=golang-dev, adonovan
CC=golang-dev
https://golang.org/cl/9500043
2013-05-17 13:25:48 -07:00