go/src/cmd/compile/internal/types2/object.go

type Object

func isExported(name string) bool {}

// Id returns name if it is exported, otherwise it
// returns the name qualified with the package path.
func Id(pkg *Package, name string) string {}

type object

type color

const white

const black

const grey

func (c color) String() string {}

// colorFor returns the (initial) color for an object depending on
// whether its type t is known or not.
func colorFor(t Type) color {}

// Parent returns the scope in which the object is declared.
// The result is nil for methods and struct fields.
func (obj *object) Parent() *Scope {}

// Pos returns the declaration position of the object's identifier.
func (obj *object) Pos() syntax.Pos {}

// Pkg returns the package to which the object belongs.
// The result is nil for labels and objects in the Universe scope.
func (obj *object) Pkg() *Package {}

// Name returns the object's (package-local, unqualified) name.
func (obj *object) Name() string {}

// Type returns the object's type.
func (obj *object) Type() Type {}

// Exported reports whether the object is exported (starts with a capital letter).
// It doesn't take into account whether the object is in a local (function) scope
// or not.
func (obj *object) Exported() bool {}

// Id is a wrapper for Id(obj.Pkg(), obj.Name()).
func (obj *object) Id() string {}

func (obj *object) String() string       {}

func (obj *object) order() uint32        {}

func (obj *object) color() color         {}

func (obj *object) scopePos() syntax.Pos {}

func (obj *object) setParent(parent *Scope)    {}

func (obj *object) setType(typ Type)           {}

func (obj *object) setOrder(order uint32)      {}

func (obj *object) setColor(color color)       {}

func (obj *object) setScopePos(pos syntax.Pos) {}

func (obj *object) sameId(pkg *Package, name string, foldCase bool) bool {}

// cmp reports whether object a is ordered before object b.
// cmp returns:
//
//	-1 if a is before b
//	 0 if a is equivalent to b
//	+1 if a is behind b
//
// Objects are ordered nil before non-nil, exported before
// non-exported, then by name, and finally (for non-exported
// functions) by package path.
func (a *object) cmp(b *object) int {}

type PkgName

// NewPkgName returns a new PkgName object representing an imported package.
// The remaining arguments set the attributes found with all Objects.
func NewPkgName(pos syntax.Pos, pkg *Package, name string, imported *Package) *PkgName {}

// Imported returns the package that was imported.
// It is distinct from Pkg(), which is the package containing the import statement.
func (obj *PkgName) Imported() *Package {}

type Const

// NewConst returns a new constant with value val.
// The remaining arguments set the attributes found with all Objects.
func NewConst(pos syntax.Pos, pkg *Package, name string, typ Type, val constant.Value) *Const {}

// Val returns the constant's value.
func (obj *Const) Val() constant.Value {}

func (*Const) isDependency() {}

type TypeName

// NewTypeName returns a new type name denoting the given typ.
// The remaining arguments set the attributes found with all Objects.
//
// The typ argument may be a defined (Named) type or an alias type.
// It may also be nil such that the returned TypeName can be used as
// argument for NewNamed, which will set the TypeName's type as a side-
// effect.
func NewTypeName(pos syntax.Pos, pkg *Package, name string, typ Type) *TypeName {}

// NewTypeNameLazy returns a new defined type like NewTypeName, but it
// lazily calls resolve to finish constructing the Named object.
func NewTypeNameLazy(pos syntax.Pos, pkg *Package, name string, load func(named *Named) (tparams []*TypeParam, underlying Type, methods []*Func)) *TypeName {}

// IsAlias reports whether obj is an alias name for a type.
func (obj *TypeName) IsAlias() bool {}

type Var

// NewVar returns a new variable.
// The arguments set the attributes found with all Objects.
func NewVar(pos syntax.Pos, pkg *Package, name string, typ Type) *Var {}

// NewParam returns a new variable representing a function parameter.
func NewParam(pos syntax.Pos, pkg *Package, name string, typ Type) *Var {}

// NewField returns a new variable representing a struct field.
// For embedded fields, the name is the unqualified type name
// under which the field is accessible.
func NewField(pos syntax.Pos, pkg *Package, name string, typ Type, embedded bool) *Var {}

// Anonymous reports whether the variable is an embedded field.
// Same as Embedded; only present for backward-compatibility.
func (obj *Var) Anonymous() bool {}

// Embedded reports whether the variable is an embedded field.
func (obj *Var) Embedded() bool {}

// IsField reports whether the variable is a struct field.
func (obj *Var) IsField() bool {}

// Origin returns the canonical Var for its receiver, i.e. the Var object
// recorded in Info.Defs.
//
// For synthetic Vars created during instantiation (such as struct fields or
// function parameters that depend on type arguments), this will be the
// corresponding Var on the generic (uninstantiated) type. For all other Vars
// Origin returns the receiver.
func (obj *Var) Origin() *Var {}

func (*Var) isDependency() {}

type Func

// NewFunc returns a new function with the given signature, representing
// the function's type.
func NewFunc(pos syntax.Pos, pkg *Package, name string, sig *Signature) *Func {}

// Signature returns the signature (type) of the function or method.
func (obj *Func) Signature() *Signature {}

// FullName returns the package- or receiver-type-qualified name of
// function or method obj.
func (obj *Func) FullName() string {}

// Scope returns the scope of the function's body block.
// The result is nil for imported or instantiated functions and methods
// (but there is also no mechanism to get to an instantiated function).
func (obj *Func) Scope() *Scope {}

// Origin returns the canonical Func for its receiver, i.e. the Func object
// recorded in Info.Defs.
//
// For synthetic functions created during instantiation (such as methods on an
// instantiated Named type or interface methods that depend on type arguments),
// this will be the corresponding Func on the generic (uninstantiated) type.
// For all other Funcs Origin returns the receiver.
func (obj *Func) Origin() *Func {}

// Pkg returns the package to which the function belongs.
//
// The result is nil for methods of types in the Universe scope,
// like method Error of the error built-in interface type.
func (obj *Func) Pkg() *Package {}

// hasPtrRecv reports whether the receiver is of the form *T for the given method obj.
func (obj *Func) hasPtrRecv() bool {}

func (*Func) isDependency() {}

type Label

// NewLabel returns a new label.
func NewLabel(pos syntax.Pos, pkg *Package, name string) *Label {}

type Builtin

func newBuiltin(id builtinId) *Builtin {}

type Nil

func writeObject(buf *bytes.Buffer, obj Object, qf Qualifier) {}

func packagePrefix(pkg *Package, qf Qualifier) string {}

// ObjectString returns the string form of obj.
// The Qualifier controls the printing of
// package-level objects, and may be nil.
func ObjectString(obj Object, qf Qualifier) string {}

func (obj *PkgName) String() string  {}

func (obj *Const) String() string    {}

func (obj *TypeName) String() string {}

func (obj *Var) String() string      {}

func (obj *Func) String() string     {}

func (obj *Label) String() string    {}

func (obj *Builtin) String() string  {}

func (obj *Nil) String() string      {}

func writeFuncName(buf *bytes.Buffer, f *Func, qf Qualifier) {}