Skip to content

Commit 945a2b1

Browse files
griesemergopherbot
authored andcommitted
go/types, types2: move xlist next to targs in Checker.arguments signature
targs and xlist belong together (xlist contains the type expressions for each of the type arguments). Also, in builtins.go, rename xlist to alist2 to avoid some confusion. Preparation for adding more parameters to the Checker.arguments signature. Change-Id: I960501cfd2b88410ec0d581a6520a4e80fcdc56a Reviewed-on: https://go-review.googlesource.com/c/go/+/494121 Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
1 parent 95c4f32 commit 945a2b1

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/cmd/compile/internal/types2/builtins.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,17 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
133133
// check general case by creating custom signature
134134
sig := makeSig(S, S, NewSlice(T)) // []T required for variadic signature
135135
sig.variadic = true
136-
var xlist []*operand
136+
var alist2 []*operand
137137
// convert []operand to []*operand
138138
for i := range alist {
139-
xlist = append(xlist, &alist[i])
139+
alist2 = append(alist2, &alist[i])
140140
}
141141
for i := len(alist); i < nargs; i++ {
142142
var x operand
143143
arg(&x, i)
144-
xlist = append(xlist, &x)
144+
alist2 = append(alist2, &x)
145145
}
146-
check.arguments(call, sig, nil, xlist, nil) // discard result (we know the result type)
146+
check.arguments(call, sig, nil, nil, alist2) // discard result (we know the result type)
147147
// ok to continue even if check.arguments reported errors
148148

149149
x.mode = value

src/cmd/compile/internal/types2/call.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func (check *Checker) callExpr(x *operand, call *syntax.CallExpr) exprKind {
325325

326326
// evaluate arguments
327327
args := check.genericExprList(call.ArgList)
328-
sig = check.arguments(call, sig, targs, args, xlist)
328+
sig = check.arguments(call, sig, targs, xlist, args)
329329

330330
if wasGeneric && sig.TypeParams().Len() == 0 {
331331
// update the recorded type of call.Fun to its instantiated type
@@ -419,7 +419,7 @@ func (check *Checker) genericExprList(elist []syntax.Expr) []*operand {
419419
}
420420

421421
// xlist is the list of type argument expressions supplied in the source code.
422-
func (check *Checker) arguments(call *syntax.CallExpr, sig *Signature, targs []Type, args []*operand, xlist []syntax.Expr) (rsig *Signature) {
422+
func (check *Checker) arguments(call *syntax.CallExpr, sig *Signature, targs []Type, xlist []syntax.Expr, args []*operand) (rsig *Signature) {
423423
rsig = sig
424424

425425
// TODO(gri) try to eliminate this extra verification loop

src/go/types/builtins.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,17 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
134134
// check general case by creating custom signature
135135
sig := makeSig(S, S, NewSlice(T)) // []T required for variadic signature
136136
sig.variadic = true
137-
var xlist []*operand
137+
var alist2 []*operand
138138
// convert []operand to []*operand
139139
for i := range alist {
140-
xlist = append(xlist, &alist[i])
140+
alist2 = append(alist2, &alist[i])
141141
}
142142
for i := len(alist); i < nargs; i++ {
143143
var x operand
144144
arg(&x, i)
145-
xlist = append(xlist, &x)
145+
alist2 = append(alist2, &x)
146146
}
147-
check.arguments(call, sig, nil, xlist, nil) // discard result (we know the result type)
147+
check.arguments(call, sig, nil, nil, alist2) // discard result (we know the result type)
148148
// ok to continue even if check.arguments reported errors
149149

150150
x.mode = value

src/go/types/call.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ func (check *Checker) callExpr(x *operand, call *ast.CallExpr) exprKind {
330330

331331
// evaluate arguments
332332
args := check.genericExprList(call.Args)
333-
sig = check.arguments(call, sig, targs, args, xlist)
333+
sig = check.arguments(call, sig, targs, xlist, args)
334334

335335
if wasGeneric && sig.TypeParams().Len() == 0 {
336336
// Update the recorded type of call.Fun to its instantiated type.
@@ -424,7 +424,7 @@ func (check *Checker) genericExprList(elist []ast.Expr) []*operand {
424424
}
425425

426426
// xlist is the list of type argument expressions supplied in the source code.
427-
func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type, args []*operand, xlist []ast.Expr) (rsig *Signature) {
427+
func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type, xlist []ast.Expr, args []*operand) (rsig *Signature) {
428428
rsig = sig
429429

430430
// TODO(gri) try to eliminate this extra verification loop

0 commit comments

Comments
 (0)