diff --git a/src/pkg/exp/types/universe.go b/src/pkg/exp/types/universe.go index 780b82625f5..46cff31bce8 100644 --- a/src/pkg/exp/types/universe.go +++ b/src/pkg/exp/types/universe.go @@ -20,6 +20,7 @@ func define(kind ast.ObjKind, name string) *ast.Object { if scope.Insert(obj) != nil { panic("types internal error: double declaration") } + obj.Decl = scope return obj } diff --git a/src/pkg/go/ast/scope.go b/src/pkg/go/ast/scope.go index fbe4779671e..11e6b13f169 100644 --- a/src/pkg/go/ast/scope.go +++ b/src/pkg/go/ast/scope.go @@ -80,7 +80,7 @@ func (s *Scope) String() string { type Object struct { Kind ObjKind Name string // declared name - Decl interface{} // corresponding Field, XxxSpec, FuncDecl, LabeledStmt, or AssignStmt; or nil + Decl interface{} // corresponding Field, XxxSpec, FuncDecl, LabeledStmt, AssignStmt, Scope; or nil Data interface{} // object-specific data; or nil Type interface{} // place holder for type information; may be nil } @@ -131,6 +131,8 @@ func (obj *Object) Pos() token.Pos { return ident.Pos() } } + case *Scope: + // predeclared object - nothing to do for now } return token.NoPos }