OSLICEARR: 8,
OSLICE3: 8,
OSLICE3ARR: 8,
+ OSLICEHEADER: 8,
ODOTINTER: 8,
ODOTMETH: 8,
ODOTPTR: 8,
}
fmt.Fprint(s, "]")
+ case OSLICEHEADER:
+ if n.List.Len() != 2 {
+ Fatalf("bad OSLICEHEADER list length %d", n.List.Len())
+ }
+ mode.Fprintf(s, "sliceheader{%v,%v,%v}", n.Left, n.List.First(), n.List.Second())
+
case OCOPY, OCOMPLEX:
mode.Fprintf(s, "%#v(%v, %v)", n.Op, n.Left, n.Right)
ok |= Erv
t := n.Type
+ if t == nil {
+ Fatalf("no type specified for OSLICEHEADER")
+ }
+
if !t.IsSlice() {
Fatalf("invalid type %v for OSLICEHEADER", n.Type)
}
- if !n.Left.Type.IsUnsafePtr() {
+ if n.Left == nil || n.Left.Type == nil || !n.Left.Type.IsUnsafePtr() {
Fatalf("need unsafe.Pointer for OSLICEHEADER")
}
argtype = types.Types[TINT]
}
+ m := nod(OSLICEHEADER, nil, nil)
+ m.Type = t
+
fn := syslook(fnname)
- n.Left = mkcall1(fn, types.Types[TUNSAFEPTR], init, typename(t.Elem()), conv(len, argtype), conv(cap, argtype))
- n.Left.SetNonNil(true)
- n.List.Set2(conv(len, types.Types[TINT]), conv(cap, types.Types[TINT]))
- n.Op = OSLICEHEADER
- n.Type = t
- n = typecheck(n, Erv)
- n = walkexpr(n, init)
+ m.Left = mkcall1(fn, types.Types[TUNSAFEPTR], init, typename(t.Elem()), conv(len, argtype), conv(cap, argtype))
+ m.Left.SetNonNil(true)
+ m.List.Set2(conv(len, types.Types[TINT]), conv(cap, types.Types[TINT]))
+
+ m = typecheck(m, Erv)
+ m = walkexpr(m, init)
+ n = m
}
case ORUNESTR: