-// UNREVIEWED
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
ddd := call.HasDots
// set up parameters
- sig_params := sig.params // adjusted for variadic functions (may be nil for empty parameter lists!)
- adjusted := false // indicates if sig_params is different from t.params
+ sigParams := sig.params // adjusted for variadic functions (may be nil for empty parameter lists!)
+ adjusted := false // indicates if sigParams is different from t.params
if sig.variadic {
if ddd {
// variadic_func(a, b, c...)
for len(vars) < nargs {
vars = append(vars, NewParam(last.pos, last.pkg, last.name, typ))
}
- sig_params = NewTuple(vars...) // possibly nil!
+ sigParams = NewTuple(vars...) // possibly nil!
adjusted = true
npars = nargs
} else {
if len(sig.tparams) > 0 {
// TODO(gri) provide position information for targs so we can feed
// it to the instantiate call for better error reporting
- targs, failed := check.infer(sig.tparams, sig_params, args)
+ targs, failed := check.infer(sig.tparams, sigParams, args)
if targs == nil {
return // error already reported
}
// need to compute it from the adjusted list; otherwise we can
// simply use the result signature's parameter list.
if adjusted {
- sig_params = check.subst(call.Pos(), sig_params, makeSubstMap(sig.tparams, targs)).(*Tuple)
+ sigParams = check.subst(call.Pos(), sigParams, makeSubstMap(sig.tparams, targs)).(*Tuple)
} else {
- sig_params = rsig.params
+ sigParams = rsig.params
}
}
// check arguments
for i, a := range args {
- check.assignment(a, sig_params.vars[i].typ, "argument")
+ check.assignment(a, sigParams.vars[i].typ, "argument")
}
return
if m, _ := obj.(*Func); m != nil {
// check.dump("### found method %s", m)
check.objDecl(m, nil)
- // If m has a parameterized receiver type, infer the type arguments
- // from the actual receiver provided and then substitute the type
- // parameters accordingly.
+ // If m has a parameterized receiver type, infer the type arguments from
+ // the actual receiver provided and then substitute the type parameters in
+ // the signature accordingly.
// TODO(gri) factor this code out
sig := m.typ.(*Signature)
if len(sig.rparams) > 0 {
// Traverse the embedding to find that type (issue #44688).
recv := x.typ
for i := 0; i < len(index)-1; i++ {
- // The embedded type is always a struct or a pointer to
+ // The embedded type is either a struct or a pointer to
// a struct except for the last one (which we don't need).
recv = asStruct(derefStructPtr(recv)).Field(index[i]).typ
}
if failed >= 0 {
// We may reach here if there were other errors (see issue #40056).
// check.infer will report a follow-up error.
- // TODO(gri) avoid the follow-up error as it is confusing (there's no inference in the source code)
+ // TODO(gri) avoid the follow-up error as it is confusing
+ // (there's no inference in the source code)
goto Error
}
// Don't modify m. Instead - for now - make a copy of m and use that instead.