// If e is a valid function instantiation, indexExpr returns true. // In that case x represents the uninstantiated function value and // it is the caller's responsibility to instantiate the function. func (check *Checker) indexExpr(x *operand, e *syntax.IndexExpr) (isFuncInst bool) { … } func (check *Checker) sliceExpr(x *operand, e *syntax.SliceExpr) { … } // singleIndex returns the (single) index from the index expression e. // If the index is missing, or if there are multiple indices, an error // is reported and the result is nil. func (check *Checker) singleIndex(e *syntax.IndexExpr) syntax.Expr { … } // index checks an index expression for validity. // If max >= 0, it is the upper bound for index. // If the result typ is != Typ[Invalid], index is valid and typ is its (possibly named) integer type. // If the result val >= 0, index is valid and val is its constant int value. func (check *Checker) index(index syntax.Expr, max int64) (typ Type, val int64) { … } // isValidIndex checks whether operand x satisfies the criteria for integer // index values. If allowNegative is set, a constant operand may be negative. // If the operand is not valid, an error is reported (using what as context) // and the result is false. func (check *Checker) isValidIndex(x *operand, code Code, what string, allowNegative bool) bool { … }