From a0cc29953e041c650eca9ecb09cfc72ce503c4ce Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 14 Jan 2014 14:47:27 -0800 Subject: [PATCH] go.tools/go/types: introduce Func.Scope() The goal is to allow clients to distinguish function-local objects from package-local objects and identify the specific function by examining its scope. For example, a compiler may need to mangle object names according to the outer function name. R=gri CC=golang-codereviews, golang-dev https://golang.org/cl/52280043 --- go/types/objects.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/go/types/objects.go b/go/types/objects.go index 595378c1..730b6557 100644 --- a/go/types/objects.go +++ b/go/types/objects.go @@ -192,6 +192,10 @@ func (obj *Func) FullName() string { return buf.String() } +func (obj *Func) Scope() *Scope { + return obj.typ.(*Signature).scope +} + // A Label represents a declared label. type Label struct { object