1
0
mirror of https://github.com/golang/go synced 2024-11-19 15:44:44 -07:00
go/ssa/interp
Alan Donovan 4da31df1c8 go.tools/ssa: (another) major refactoring of method-set logic.
We now use LookupFieldOrMethod for all SelectorExprs, and
simplify the logic to discriminate the various cases.

We inline static calls to promoted/indirected functions,
dramatically reducing the number of functions created.

More tests are needed, but I'd like to submit this as-is.

In this CL, we:
- rely less on Id strings.  Internally we now use
  *types.Method (and its components) almost everywhere.
- stop thinking of types.Methods as objects. They don't
  have stable identities. (Hopefully they will become
  plain-old structs soon.)
- eliminate receiver indirection wrappers:
  indirection and promotion are handled together by makeWrapper.
- Handle the interactions of promotion, indirection and
  abstract methods much more cleanly.
- support receiver-bound interface method closures.
- break up builder.selectField so we can re-use parts
  (emitFieldSelection).
- add importer.PackageInfo.classifySelector utility.
- delete interfaceMethodIndex()
- delete namedTypeMethodIndex()
- delete isSuperInterface() (replaced by types.IsAssignable)
- call memberFromObject on each declared concrete method's
  *types.Func, not on every Method frem each method set, in the
  CREATE phase for packages loaded by gcimporter.

go/types:
- document Func, Signature.Recv() better.
- use fmt in {Package,Label}.String
- reimplement Func.String to be prettier and to include method
  receivers.

API changes:
- Function.method now holds the types.Method (soon to be
  not-an-object) for synthetic wrappers.
- CallCommon.Method now contains an abstract (interface)
  method object; was an abstract method index.
- CallCommon.MethodId() gone.
- Program.LookupMethod now takes a *Method not an Id string.

R=gri
CC=golang-dev
https://golang.org/cl/11674043
2013-07-26 11:22:34 -04:00
..
testdata go.tools/ssa: (another) major refactoring of method-set logic. 2013-07-26 11:22:34 -04:00
external_plan9.go go.tools: add go/types, ssa, and cmd/vet 2013-05-17 13:20:39 -07:00
external_unix.go go.tools: add go/types, ssa, and cmd/vet 2013-05-17 13:20:39 -07:00
external_windows.go go.tools: add go/types, ssa, and cmd/vet 2013-05-17 13:20:39 -07:00
external.go go.tools/ssa: several small clean-ups. 2013-07-16 12:23:55 -04:00
interp_test.go go.tools/importer: rename Context to Config for consistency with go/types. 2013-07-19 11:02:27 -04:00
interp.go go.tools/ssa: (another) major refactoring of method-set logic. 2013-07-26 11:22:34 -04:00
map.go go.tools: add go/types, ssa, and cmd/vet 2013-05-17 13:20:39 -07:00
ops.go go.tools/ssa: s/Literal/Const/g, s/Constant/NamedConst/g 2013-07-16 13:50:08 -04:00
reflect.go go.tools/go/types: simplified and faster Scope 2013-07-23 21:21:37 -07:00
value.go go.tools/ssa: Value.Pos() method + remaining source position plumbing. 2013-05-30 09:59:17 -04:00