// assignment reports whether x can be assigned to a variable of type T, // if necessary by attempting to convert untyped values to the appropriate // type. context describes the context in which the assignment takes place. // Use T == nil to indicate assignment to an untyped blank identifier. // If the assignment check fails, x.mode is set to invalid. func (check *Checker) assignment(x *operand, T Type, context string) { … } func (check *Checker) initConst(lhs *Const, x *operand) { … } // initVar checks the initialization lhs = x in a variable declaration. // If lhs doesn't have a type yet, it is given the type of x, // or Typ[Invalid] in case of an error. // If the initialization check fails, x.mode is set to invalid. func (check *Checker) initVar(lhs *Var, x *operand, context string) { … } // lhsVar checks a lhs variable in an assignment and returns its type. // lhsVar takes care of not counting a lhs identifier as a "use" of // that identifier. The result is nil if it is the blank identifier, // and Typ[Invalid] if it is an invalid lhs expression. func (check *Checker) lhsVar(lhs syntax.Expr) Type { … } // assignVar checks the assignment lhs = rhs (if x == nil), or lhs = x (if x != nil). // If x != nil, it must be the evaluation of rhs (and rhs will be ignored). // If the assignment check fails and x != nil, x.mode is set to invalid. func (check *Checker) assignVar(lhs, rhs syntax.Expr, x *operand, context string) { … } // operandTypes returns the list of types for the given operands. func operandTypes(list []*operand) (res []Type) { … } // varTypes returns the list of types for the given variables. func varTypes(list []*Var) (res []Type) { … } // typesSummary returns a string of the form "(t1, t2, ...)" where the // ti's are user-friendly string representations for the given types. // If variadic is set and the last type is a slice, its string is of // the form "...E" where E is the slice's element type. func (check *Checker) typesSummary(list []Type, variadic bool) string { … } func measure(x int, unit string) string { … } func (check *Checker) assignError(rhs []syntax.Expr, l, r int) { … } func (check *Checker) returnError(at poser, lhs []*Var, rhs []*operand) { … } // initVars type-checks assignments of initialization expressions orig_rhs // to variables lhs. // If returnStmt is non-nil, initVars type-checks the implicit assignment // of result expressions orig_rhs to function result parameters lhs. func (check *Checker) initVars(lhs []*Var, orig_rhs []syntax.Expr, returnStmt syntax.Stmt) { … } // assignVars type-checks assignments of expressions orig_rhs to variables lhs. func (check *Checker) assignVars(lhs, orig_rhs []syntax.Expr) { … } func (check *Checker) shortVarDecl(pos poser, lhs, rhs []syntax.Expr) { … }