// ident type-checks identifier e and initializes x with the value or type of e. // If an error occurred, x.mode is set to invalid. // For the meaning of def, see Checker.definedType, below. // If wantType is set, the identifier e is expected to denote a type. func (check *Checker) ident(x *operand, e *syntax.Name, def *TypeName, wantType bool) { … } // typ type-checks the type expression e and returns its type, or Typ[Invalid]. // The type must not be an (uninstantiated) generic type. func (check *Checker) typ(e syntax.Expr) Type { … } // varType type-checks the type expression e and returns its type, or Typ[Invalid]. // The type must not be an (uninstantiated) generic type and it must not be a // constraint interface. func (check *Checker) varType(e syntax.Expr) Type { … } // validVarType reports an error if typ is a constraint interface. // The expression e is used for error reporting, if any. func (check *Checker) validVarType(e syntax.Expr, typ Type) { … } // definedType is like typ but also accepts a type name def. // If def != nil, e is the type specification for the type named def, declared // in a type declaration, and def.typ.underlying will be set to the type of e // before any components of e are type-checked. func (check *Checker) definedType(e syntax.Expr, def *TypeName) Type { … } // genericType is like typ but the type must be an (uninstantiated) generic // type. If cause is non-nil and the type expression was a valid type but not // generic, cause will be populated with a message describing the error. func (check *Checker) genericType(e syntax.Expr, cause *string) Type { … } // goTypeName returns the Go type name for typ and // removes any occurrences of "types2." from that name. func goTypeName(typ Type) string { … } // typInternal drives type checking of types. // Must only be called by definedType or genericType. func (check *Checker) typInternal(e0 syntax.Expr, def *TypeName) (T Type) { … } func setDefType(def *TypeName, typ Type) { … } func (check *Checker) instantiatedType(x syntax.Expr, xlist []syntax.Expr, def *TypeName) (res Type) { … } // arrayLength type-checks the array length expression e // and returns the constant length >= 0, or a value < 0 // to indicate an error (and thus an unknown length). func (check *Checker) arrayLength(e syntax.Expr) int64 { … } // typeList provides the list of types corresponding to the incoming expression list. // If an error occurred, the result is nil, but all list elements were type-checked. func (check *Checker) typeList(list []syntax.Expr) []Type { … }