mirror of
https://github.com/golang/go
synced 2024-11-23 00:40:08 -07:00
treat ... as agreed
only unencapsulated if passing one ddd argument to one ddd parameter. R=r OCL=18376 CL=18376
This commit is contained in:
parent
63f38d62ac
commit
90e5574f1c
@ -1640,7 +1640,7 @@ sigtype(Type *st)
|
|||||||
* with a pointer to the structure
|
* with a pointer to the structure
|
||||||
*/
|
*/
|
||||||
Node*
|
Node*
|
||||||
mkdotargs(Node *r, Iter *saver, Node *nn, Type *l, int fp)
|
mkdotargs(Node *r, Node *rr, Iter *saver, Node *nn, Type *l, int fp)
|
||||||
{
|
{
|
||||||
Type *t, *st, *ft;
|
Type *t, *st, *ft;
|
||||||
Node *a, *n, *var;
|
Node *a, *n, *var;
|
||||||
@ -1664,6 +1664,10 @@ mkdotargs(Node *r, Iter *saver, Node *nn, Type *l, int fp)
|
|||||||
|
|
||||||
a = nod(OAS, N, r);
|
a = nod(OAS, N, r);
|
||||||
n = list(n, a);
|
n = list(n, a);
|
||||||
|
if(rr != N) {
|
||||||
|
r = rr;
|
||||||
|
rr = N;
|
||||||
|
} else
|
||||||
r = listnext(saver);
|
r = listnext(saver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1705,8 +1709,8 @@ mkdotargs(Node *r, Iter *saver, Node *nn, Type *l, int fp)
|
|||||||
Node*
|
Node*
|
||||||
ascompatte(int op, Type **nl, Node **nr, int fp)
|
ascompatte(int op, Type **nl, Node **nr, int fp)
|
||||||
{
|
{
|
||||||
Type *l;
|
Type *l, *ll;
|
||||||
Node *r, *nn, *a;
|
Node *r, *rr, *nn, *a;
|
||||||
Iter savel, saver;
|
Iter savel, saver;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1721,15 +1725,28 @@ ascompatte(int op, Type **nl, Node **nr, int fp)
|
|||||||
|
|
||||||
loop:
|
loop:
|
||||||
if(l != T && isddd(l->type)) {
|
if(l != T && isddd(l->type)) {
|
||||||
if(r != N && isddd(r->type)) {
|
// the ddd parameter must be last
|
||||||
goto more;
|
ll = structnext(&savel);
|
||||||
|
if(ll != T)
|
||||||
|
yyerror("... must be last argument");
|
||||||
|
|
||||||
|
// special case --
|
||||||
|
// only if we are assigning a single ddd
|
||||||
|
// argument to a ddd parameter then it is
|
||||||
|
// passed thru unencapsulated
|
||||||
|
rr = listnext(&saver);
|
||||||
|
if(r != N && rr == N && isddd(r->type)) {
|
||||||
|
a = nod(OAS, nodarg(l, fp), r);
|
||||||
|
a = convas(a);
|
||||||
|
nn = list(a, nn);
|
||||||
|
return rev(nn);
|
||||||
}
|
}
|
||||||
|
|
||||||
nn = mkdotargs(r, &saver, nn, l, fp);
|
// normal case -- make a structure of all
|
||||||
|
// remaining arguments and pass a pointer to
|
||||||
|
// it to the ddd parameter (empty interface)
|
||||||
|
nn = mkdotargs(r, rr, &saver, nn, l, fp);
|
||||||
|
|
||||||
l = structnext(&savel);
|
|
||||||
if(l != T)
|
|
||||||
yyerror("... must be last argument");
|
|
||||||
return rev(nn);
|
return rev(nn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user