static void
funcargs(Node *nt)
{
- Node *n;
+ Node *n, *nn;
NodeList *l;
int gen;
n->left->ntype = n->right;
if(isblank(n->left)) {
// Give it a name so we can assign to it during return.
+ // preserve the original in ->orig
+ nn = nod(OXXX, N, N);
+ *nn = *n->left;
+ n->left = nn;
snprint(namebuf, sizeof(namebuf), ".anon%d", gen++);
n->left->sym = lookup(namebuf);
}
funcdepth = 0;
dclcontext = PEXTERN;
}
-
-
-
//
// %T Type* Types
// Flags: +,- #: mode (see below)
-// 'l' definition instead of name.
+// 'l' definition instead of name.
// 'h' omit "func" and receiver in function types
-// 'u' (only in -/Sym mode) print type identifiers wit package name instead of prefix.
+// 'u' (only in -/Sym mode) print type identifiers wit package name instead of prefix.
//
// %N Node* Nodes
// Flags: +,- #: mode (see below)
// Flags: those of %N
// ',' separate items with ',' instead of ';'
//
-// %Z Strlit* String literals
+// %Z Strlit* String literals
//
// In mparith1.c:
// %B Mpint* Big integers
typefmt(Fmt *fp, Type *t)
{
Type *t1;
+ Sym *s;
if(t == T)
return fmtstrcpy(fp, "<T>");
case TFIELD:
if(!(fp->flags&FmtShort)) {
- if(t->sym != S && !t->embedded)
- fmtprint(fp, "%hS ", t->sym);
- if((!t->sym || t->embedded) && fmtmode == FExp)
- fmtstrcpy(fp, "? ");
+ s = t->sym;
+ switch(fmtmode) {
+ case FErr:
+ case FExp:
+ // Take the name from the original, lest we substituted it with .anon%d
+ if (t->nname)
+ s = t->nname->orig->sym;
+
+ if((s == S || t->embedded)) {
+ fmtstrcpy(fp, "? ");
+ break;
+ }
+ // fallthrough
+ default:
+ if(!(s == S || t->embedded))
+ fmtprint(fp, "%hS ", s);
+ }
}
if(t->isddd)
--- /dev/null
+// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go
+
+// Copyright 2011 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.
+
+// Issue 1802
+
+ignored