type operandMode … const invalid … const novalue … const builtin … const typexpr … const constant_ … const variable … const mapindex … const value … const nilvalue … const commaok … const commaerr … const cgofunc … var operandModeString … type operand … // Pos returns the position of the expression corresponding to x. // If x is invalid the position is nopos. func (x *operand) Pos() syntax.Pos { … } // Operand string formats // (not all "untyped" cases can appear due to the type system, // but they fall out naturally here) // // mode format // // invalid <expr> ( <mode> ) // novalue <expr> ( <mode> ) // builtin <expr> ( <mode> ) // typexpr <expr> ( <mode> ) // // constant <expr> (<untyped kind> <mode> ) // constant <expr> ( <mode> of type <typ>) // constant <expr> (<untyped kind> <mode> <val> ) // constant <expr> ( <mode> <val> of type <typ>) // // variable <expr> (<untyped kind> <mode> ) // variable <expr> ( <mode> of type <typ>) // // mapindex <expr> (<untyped kind> <mode> ) // mapindex <expr> ( <mode> of type <typ>) // // value <expr> (<untyped kind> <mode> ) // value <expr> ( <mode> of type <typ>) // // nilvalue untyped nil // nilvalue nil ( of type <typ>) // // commaok <expr> (<untyped kind> <mode> ) // commaok <expr> ( <mode> of type <typ>) // // commaerr <expr> (<untyped kind> <mode> ) // commaerr <expr> ( <mode> of type <typ>) // // cgofunc <expr> (<untyped kind> <mode> ) // cgofunc <expr> ( <mode> of type <typ>) func operandString(x *operand, qf Qualifier) string { … } // compositeKind returns the kind of the given composite type // ("array", "slice", etc.) or the empty string if typ is not // composite but a basic type. func compositeKind(typ Type) string { … } func (x *operand) String() string { … } // setConst sets x to the untyped constant for literal lit. func (x *operand) setConst(k syntax.LitKind, lit string) { … } // isNil reports whether x is the (untyped) nil value. func (x *operand) isNil() bool { … } // assignableTo reports whether x is assignable to a variable of type T. If the // result is false and a non-nil cause is provided, it may be set to a more // detailed explanation of the failure (result != ""). The returned error code // is only valid if the (first) result is false. The check parameter may be nil // if assignableTo is invoked through an exported API call, i.e., when all // methods have been type-checked. func (x *operand) assignableTo(check *Checker, T Type, cause *string) (bool, Code) { … }