mirror of https://github.com/golang/go.git
ssa: switch lblocks to types.Object
Switches lblocks from *ast.Object to types.Object. Removes a user from the infrequently used *ast.Object. Updates golang/go#52463 Change-Id: I1a21ab55b7136f4891f6aa2f76459880ace389c9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/402034 Reviewed-by: Dominik Honnef <dominik@honnef.co> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Tim King <taking@google.com> Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
This commit is contained in:
parent
559469ae16
commit
ae12e8f2c7
|
|
@ -74,13 +74,14 @@ type lblock struct {
|
|||
// labelledBlock returns the branch target associated with the
|
||||
// specified label, creating it if needed.
|
||||
func (f *Function) labelledBlock(label *ast.Ident) *lblock {
|
||||
lb := f.lblocks[label.Obj]
|
||||
obj := f.objectOf(label)
|
||||
lb := f.lblocks[obj]
|
||||
if lb == nil {
|
||||
lb = &lblock{_goto: f.newBasicBlock(label.Name)}
|
||||
if f.lblocks == nil {
|
||||
f.lblocks = make(map[*ast.Object]*lblock)
|
||||
f.lblocks = make(map[types.Object]*lblock)
|
||||
}
|
||||
f.lblocks[label.Obj] = lb
|
||||
f.lblocks[obj] = lb
|
||||
}
|
||||
return lb
|
||||
}
|
||||
|
|
|
|||
|
|
@ -331,13 +331,13 @@ type Function struct {
|
|||
|
||||
// The following fields are set transiently during building,
|
||||
// then cleared.
|
||||
currentBlock *BasicBlock // where to emit code
|
||||
objects map[types.Object]Value // addresses of local variables
|
||||
namedResults []*Alloc // tuple of named results
|
||||
targets *targets // linked stack of branch targets
|
||||
lblocks map[*ast.Object]*lblock // labelled blocks
|
||||
info *types.Info // *types.Info to build from. nil for wrappers.
|
||||
subst *subster // type substitution cache
|
||||
currentBlock *BasicBlock // where to emit code
|
||||
objects map[types.Object]Value // addresses of local variables
|
||||
namedResults []*Alloc // tuple of named results
|
||||
targets *targets // linked stack of branch targets
|
||||
lblocks map[types.Object]*lblock // labelled blocks
|
||||
info *types.Info // *types.Info to build from. nil for wrappers.
|
||||
subst *subster // type substitution cache
|
||||
}
|
||||
|
||||
// BasicBlock represents an SSA basic block.
|
||||
|
|
|
|||
Loading…
Reference in New Issue