mirror of
https://github.com/golang/go
synced 2024-11-02 11:50:30 +00:00
go/types, types2: don't re-evaluate context string for each function argument (optimization)
Change-Id: Ie1b4d5b64350ea42484adea14df84cacd1d2653b Reviewed-on: https://go-review.googlesource.com/c/go/+/344576 Trust: Robert Griesemer <gri@golang.org> Trust: Dan Scales <danscales@google.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
4158e88f64
commit
bf0bc4122f
2 changed files with 10 additions and 4 deletions
|
@ -341,8 +341,11 @@ func (check *Checker) arguments(call *syntax.CallExpr, sig *Signature, targs []T
|
|||
}
|
||||
|
||||
// check arguments
|
||||
for i, a := range args {
|
||||
check.assignment(a, sigParams.vars[i].typ, check.sprintf("argument to %s", call.Fun))
|
||||
if len(args) > 0 {
|
||||
context := check.sprintf("argument to %s", call.Fun)
|
||||
for i, a := range args {
|
||||
check.assignment(a, sigParams.vars[i].typ, context)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
|
|
@ -347,8 +347,11 @@ func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type
|
|||
}
|
||||
|
||||
// check arguments
|
||||
for i, a := range args {
|
||||
check.assignment(a, sigParams.vars[i].typ, check.sprintf("argument to %s", call.Fun))
|
||||
if len(args) > 0 {
|
||||
context := check.sprintf("argument to %s", call.Fun)
|
||||
for i, a := range args {
|
||||
check.assignment(a, sigParams.vars[i].typ, context)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue