Home | History | Annotate | Download | only in types

Lines Matching defs:Object

15 // An Object describes a named language entity such as a package,
17 // All objects implement the Object interface.
19 type Object interface {
20 Parent() *Scope // scope in which this object is declared; nil for methods and struct fields
21 Pos() token.Pos // position of object identifier in declaration
22 Pkg() *Package // package to which this object belongs; nil for labels and objects in the Universe scope
23 Name() string // package local object name
24 Type() Type // object type
26 Id() string // object name if exported, qualified name if not exported (see func Id)
28 // String returns a human-readable string of the object.
31 // order reflects a package-level object's source order: if object
32 // a is before object b in the source, then a.order() < b.order().
37 // setOrder sets the order number of the object. It must be > 0.
40 // setParent sets the parent scope of the object.
46 // scopePos returns the start position of the scope of this Object
49 // setScopePos sets the start position of the scope for this Object.
66 // introduced via Eval (see also comment in object.sameId)
73 // An object implements the common parts of an Object.
74 type object struct {
84 func (obj *object) Parent() *Scope { return obj.parent }
85 func (obj *object) Pos() token.Pos { return obj.pos }
86 func (obj *object) Pkg() *Package { return obj.pkg }
87 func (obj *object) Name() string { return obj.name }
88 func (obj *object) Type() Type { return obj.typ }
89 func (obj *object) Exported() bool { return ast.IsExported(obj.name) }
90 func (obj *object) Id() string { return Id(obj.pkg, obj.name) }
91 func (obj *object) String() string { panic("abstract") }
92 func (obj *object) order() uint32 { return obj.order_ }
93 func (obj *object) scopePos() token.Pos { return obj.scopePos_ }
95 func (obj *object) setParent(parent *Scope) { obj.parent = parent }
96 func (obj *object) setOrder(order uint32) { assert(order > 0); obj.order_ = order }
97 func (obj *object) setScopePos(pos token.Pos) { obj.scopePos_ = pos }
99 func (obj *object) sameId(pkg *Package, name string) bool {
124 object
129 // NewPkgName returns a new PkgName object representing an imported package.
132 return &PkgName{object{nil, pos, pkg, name, Typ[Invalid], 0, token.NoPos}, imported, false}
141 object
149 return &Const{object{nil, pos, pkg, name, typ, 0, token.NoPos}, val, false}
157 object
168 return &TypeName{object{nil, pos, pkg, name, typ, 0, token.NoPos}}
197 object
207 return &Var{object: object{nil, pos, pkg, name, typ, 0, token.NoPos}}
212 return &Var{object: object{nil, pos, pkg, name, typ, 0, token.NoPos}, used: true} // parameters are always 'used'
219 return &Var{object: object{nil, pos, pkg, name, typ, 0, token.NoPos}, anonymous: anonymous, isField: true}
234 object
245 return &Func{object{nil, pos, pkg, name, typ, 0, token.NoPos}}
264 object
270 return &Label{object{pos: pos, pkg: pkg, name: name, typ: Typ[Invalid]}, false}
276 object
281 return &Builtin{object{name: predeclaredFuncs[id].name, typ: Typ[Invalid]}, id}
286 object
289 func writeObject(buf *bytes.Buffer, obj Object, qf Qualifier) {
352 // We have a type object: Don't print anything more for
388 func ObjectString(obj Object, qf Qualifier) string {