if t.Width == -2 {
lno := int(lineno)
lineno = int32(t.Lineno)
- if t.Broke == 0 {
- t.Broke = 1
+ if !t.Broke {
+ t.Broke = true
Yyerror("invalid recursive type %v", t)
}
// break infinite recursion if the broken recursive type
// is referenced again
- if t.Broke != 0 && t.Width == 0 {
+ if t.Broke && t.Width == 0 {
return
}
checkwidth(t.Down)
case TFORW: // should have been filled in
- if t.Broke == 0 {
+ if !t.Broke {
Yyerror("invalid recursive type %v", t)
}
w = 1 // anything will do
checkwidth(t.Type)
t.Align = uint8(Widthptr)
} else if t.Bound == -100 {
- if t.Broke == 0 {
+ if !t.Broke {
Yyerror("use of [...] array outside of array literal")
- t.Broke = 1
+ t.Broke = true
}
} else {
Fatalf("dowidth %v", t) // probably [...]T
bad:
if n.Diag == 0 {
- if t.Broke == 0 {
+ if !t.Broke {
Yyerror("cannot convert %v to type %v", n, t)
}
n.Diag = 1
f.Type = n.Type
if f.Type == nil {
- f.Broke = 1
+ f.Broke = true
}
switch n.Val().Ctype() {
tp = &f.Down
}
- for f := t.Type; f != nil && t.Broke == 0; f = f.Down {
- if f.Broke != 0 {
- t.Broke = 1
+ for f := t.Type; f != nil && !t.Broke; f = f.Down {
+ if f.Broke {
+ t.Broke = true
}
}
uniqgen++
checkdupfields(t.Type, "field")
- if t.Broke == 0 {
+ if !t.Broke {
checkwidth(t)
}
tp = &f.Down
}
- for f := t.Type; f != nil && t.Broke == 0; f = f.Down {
- if f.Broke != 0 {
- t.Broke = 1
+ for f := t.Type; f != nil && !t.Broke; f = f.Down {
+ if f.Broke {
+ t.Broke = true
}
}
case TFORW:
Yyerror("interface type loop involving %v", n.Type)
- f.Broke = 1
+ f.Broke = true
default:
Yyerror("interface contains embedded non-interface %v", n.Type)
- f.Broke = 1
+ f.Broke = true
}
}
}
f.Type = n.Type
if f.Type == nil {
- f.Broke = 1
+ f.Broke = true
}
lineno = int32(lno)
}
}
- for f := t.Type; f != nil && t.Broke == 0; f = f.Down {
- if f.Broke != 0 {
- t.Broke = 1
+ for f := t.Type; f != nil && !t.Broke; f = f.Down {
+ if f.Broke {
+ t.Broke = true
}
}
checkdupfields(t.Type.Down.Type, "argument")
checkdupfields(t.Type.Down.Down.Type, "argument")
- if t.Type.Broke != 0 || t.Type.Down.Broke != 0 || t.Type.Down.Down.Broke != 0 {
- t.Broke = 1
+ if t.Type.Broke || t.Type.Down.Broke || t.Type.Down.Down.Broke {
+ t.Broke = true
}
if this != nil {
t = t.Type
}
- if t.Broke != 0 { // rely on typecheck having complained before
+ if t.Broke { // rely on typecheck having complained before
return
}
if t.Sym == nil {
Copyany uint8
Local bool // created in this file
Deferwidth uint8
- Broke uint8 // broken type definition.
- Isddd bool // TFIELD is ... argument
+ Broke bool // broken type definition.
+ Isddd bool // TFIELD is ... argument
Align uint8
Haspointers uint8 // 0 unknown, 1 no, 2 yes
if bad != nil {
*bad = nil
}
- if t.Broke != 0 {
+ if t.Broke {
return AMEM
}
if t.Noalg != 0 {
}
// we'll have complained about this method anyway, suppress spurious messages.
- if have != nil && have.Sym == missing.Sym && (have.Type.Broke != 0 || missing.Type.Broke != 0) {
+ if have != nil && have.Sym == missing.Sym && (have.Type.Broke || missing.Type.Broke) {
return OCONVIFACE
}
// Convert node n for assignment to type t.
func assignconvfn(n *Node, t *Type, context func() string) *Node {
- if n == nil || n.Type == nil || n.Type.Broke != 0 {
+ if n == nil || n.Type == nil || n.Type.Broke {
return n
}
// reset to original type
ll.N = n.Left.Right
case ll.N.Type.Etype != TINTER && t.Etype == TINTER && !implements(ll.N.Type, t, &missing, &have, &ptr):
- if have != nil && missing.Broke == 0 && have.Broke == 0 {
+ if have != nil && !missing.Broke && !have.Broke {
Yyerror("impossible type switch case: %v cannot have dynamic type %v"+" (wrong type for %v method)\n\thave %v%v\n\twant %v%v", Nconv(n.Left.Right, obj.FmtLong), ll.N.Type, missing.Sym, have.Sym, Tconv(have.Type, obj.FmtShort), missing.Sym, Tconv(missing.Type, obj.FmtShort))
- } else if missing.Broke == 0 {
+ } else if !missing.Broke {
Yyerror("impossible type switch case: %v cannot have dynamic type %v"+" (missing %v method)", Nconv(n.Left.Right, obj.FmtLong), ll.N.Type, missing.Sym)
}
}
} else if l.Op == ODDD {
t.Bound = -100 // to be filled in
if top&Ecomplit == 0 && n.Diag == 0 {
- t.Broke = 1
+ t.Broke = true
n.Diag = 1
Yyerror("use of [...] array outside of array literal")
}
ok |= Etype
n.Op = OTYPE
n.Type = tostruct(n.List)
- if n.Type == nil || n.Type.Broke != 0 {
+ if n.Type == nil || n.Type.Broke {
n.Type = nil
return
}
l = n.Left
if l.Op == OTYPE {
if n.Isddd || l.Type.Bound == -100 {
- if l.Type.Broke == 0 {
+ if !l.Type.Broke {
Yyerror("invalid use of ... in type conversion to %v", l.Type)
}
n.Diag = 1
var why string
n.Op = uint8(convertop(t, n.Type, &why))
if (n.Op) == 0 {
- if n.Diag == 0 && n.Type.Broke == 0 {
+ if n.Diag == 0 && !n.Type.Broke {
Yyerror("cannot convert %v to type %v%s", Nconv(n.Left, obj.FmtLong), n.Type, why)
n.Diag = 1
}
// type is broken or missing, most likely a method call on a broken type
// we will warn about the broken type elsewhere. no need to emit a potentially confusing error
- if n.Left.Type == nil || n.Left.Type.Broke != 0 {
+ if n.Left.Type == nil || n.Left.Type.Broke {
return
}
lno := int(lineno)
- if tstruct.Broke != 0 {
+ if tstruct.Broke {
goto out
}
if n.Type.Etype == TFORW && nerrors > nerrors0 {
// Something went wrong during type-checking,
// but it was reported. Silence future errors.
- n.Type.Broke = 1
+ n.Type.Broke = true
}
if Curfn != nil {