ret = false
case TARRAY:
- if t.Bound < 0 { // slice
+ if t.IsSlice() {
ret = true
break
}
ot = duint8(s, ot, t.Align) // fieldAlign
i = kinds[t.Etype]
- if t.Etype == TARRAY && t.Bound < 0 {
+ if t.IsSlice() {
i = obj.KindSlice
}
if !haspointers(t) {
ot = dextratype(s, ot, t, 0)
case TARRAY:
- if t.Bound >= 0 {
+ if t.IsArray() {
// ../../../../runtime/type.go:/arrayType
s1 := dtypesym(t.Type)
t2 := typSlice(t.Type)
return initDynamic
case OARRAYLIT:
- if top == 0 && n.Type.Bound < 0 {
+ if top == 0 && n.Type.IsSlice() {
return initDynamic
}
switch value.Op {
case OARRAYLIT:
- if value.Type.Bound < 0 {
+ if value.Type.IsSlice() {
if pass == 1 && ctxt != 0 {
a := NodSym(ODOT, var_, index.Sym)
slicelit(ctxt, value, a, init)
switch value.Op {
case OARRAYLIT:
- if value.Type.Bound < 0 {
+ if value.Type.IsSlice() {
if pass == 1 && ctxt != 0 {
a := Nod(OINDEX, var_, index)
slicelit(ctxt, value, a, init)
switch value.Op {
case OARRAYLIT:
- if value.Type.Bound < 0 {
+ if value.Type.IsSlice() {
break
}
arraylit(ctxt, 2, value, a, init)
if t.Etype != TARRAY {
Fatalf("anylit: not array")
}
- if t.Bound < 0 {
+ if t.IsSlice() {
slicelit(ctxt, n, var_, init)
break
}
return true
case OINDEX:
- if n.Left.Type.Bound < 0 {
+ if n.Left.Type.IsSlice() {
break
}
if !stataddr(nam, n.Left) {
}
// nr is the array being converted to a slice
- if nr.Type == nil || nr.Type.Etype != TARRAY || nr.Type.Bound < 0 {
+ if nr.Type == nil || nr.Type.Etype != TARRAY || nr.Type.IsSlice() {
return false
}
}
func Isfixedarray(t *Type) bool {
- return t != nil && t.Etype == TARRAY && t.Bound >= 0
+ return t != nil && t.IsArray()
}
func Isslice(t *Type) bool {
- return t != nil && t.Etype == TARRAY && t.Bound < 0
+ return t != nil && t.IsSlice()
}
func isblank(n *Node) bool {
Yyerror("array bound is too large")
n.Type = nil
return n
- } else if t.Bound < 0 {
+ } else if t.IsSlice() {
Yyerror("array bound must be non-negative")
n.Type = nil
return n
}
case TARRAY:
- if t.Bound < 0 { // slice
+ if t.IsSlice() {
break
}
if callrecv(l) { // has call or receive
i++
if int64(i) > length {
length = int64(i)
- if t.Bound >= 0 && length > t.Bound {
+ if t.IsArray() && length > t.Bound {
setlineno(l)
Yyerror("array index %d out of bounds [0:%d]", length-1, t.Bound)
t.Bound = -1 // no more errors
if t.isDDDArray() {
t.Bound = length
}
- if t.Bound < 0 {
+ if t.IsSlice() {
n.Right = Nodintconst(length)
}
n.Op = OARRAYLIT