goto bad;
e = "sigt";
- if(t->etype == TINTER)
+ if(t->etype == TINTER || t->etype == TDDD)
e = "sigi";
// name is exported name, like *[]byte or *Struct or Interface
// so that it can be referred to by the runtime.
if(strcmp(buf, "interface { }") == 0)
strcpy(buf, "empty");
+
+ // special case: sigi.... is just too hard to read in assembly.
+ if(strcmp(buf, "...") == 0)
+ strcpy(buf, "dotdotdot");
ss = pkglookup(buf, e);
if(ss->oname == N) {
case OPROC:
if(top != Etop)
goto nottop;
- walkstate(n->left);
+ walktype(n->left, Etop);
goto ret;
case OCALLMETH:
var = nod(OXXX, N, N);
tempname(var, st);
- // assign the fields to the struct
+ // assign the fields to the struct.
+ // use addtop so that reorder1 doesn't reorder
+ // these assignments after the interface conversion
+ // below.
n = rev(n);
r = listfirst(&saven, &n);
t = st->type;
*r->left = *var;
r->left->type = r->right->type;
r->left->xoffset += t->width;
- nn = list(r, nn);
+ addtop = list(addtop, r);
r = listnext(&saven);
t = t->down;
}
// last thing is to put assignment
// of a pointer to the structure to
// the DDD parameter
-
- a = nod(OADDR, var, N);
- a->type = ptrto(st);
- a = nod(OAS, nodarg(l, fp), a);
- a = convas(a);
-
- nn = list(a, nn);
+ a = nod(OAS, nodarg(l, fp), var);
+ nn = list(convas(a), nn);
return nn;
}
// These routines end in 'f' and take a format string.
func Fprintf(w io.Write, format string, a ...) (n int, error *os.Error) {
- v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
+ v := reflect.NewValue(a).(reflect.StructValue);
p := newPrinter();
p.doprintf(format, v);
n, error = w.Write(p.buf[0:p.n]);
}
func Sprintf(format string, a ...) string {
- v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
+ v := reflect.NewValue(a).(reflect.StructValue);
p := newPrinter();
p.doprintf(format, v);
s := string(p.buf)[0 : p.n];
// when the operand on neither side is a string.
func Fprint(w io.Write, a ...) (n int, error *os.Error) {
- v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
+ v := reflect.NewValue(a).(reflect.StructValue);
p := newPrinter();
p.doprint(v, false, false);
n, error = w.Write(p.buf[0:p.n]);
}
func Sprint(a ...) string {
- v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
+ v := reflect.NewValue(a).(reflect.StructValue);
p := newPrinter();
p.doprint(v, false, false);
s := string(p.buf)[0 : p.n];
// after the last operand.
func Fprintln(w io.Write, a ...) (n int, error *os.Error) {
- v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
+ v := reflect.NewValue(a).(reflect.StructValue);
p := newPrinter();
p.doprint(v, true, true);
n, error = w.Write(p.buf[0:p.n]);
}
func Sprintln(a ...) string {
- v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
+ v := reflect.NewValue(a).(reflect.StructValue);
p := newPrinter();
p.doprint(v, true, true);
s := string(p.buf)[0 : p.n];