Commit d328756a authored by Dave Cheney's avatar Dave Cheney

cmd/internal/gc: make Node.Isddd boolean

Convert Node.Isddd to a boolean and simplify usage.

- Node.Isddd converted to bool
- Type.Isddd converted to bool
- mkinlcall converted to take isddd as a bool
- typecheckaste converted to take isddd as a bool
- ascompatte converted to take isddd as a bool

Change-Id: I52586145619c44182bb0c2c5d80a0a3fe3e50a07
Reviewed-on: https://go-review.googlesource.com/7172Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 402f71a8
...@@ -551,7 +551,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node { ...@@ -551,7 +551,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node {
i := 0 i := 0
var l *NodeList var l *NodeList
var callargs *NodeList var callargs *NodeList
ddd := 0 ddd := false
xfunc := Nod(ODCLFUNC, nil, nil) xfunc := Nod(ODCLFUNC, nil, nil)
Curfn = xfunc Curfn = xfunc
var fld *Node var fld *Node
...@@ -564,9 +564,9 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node { ...@@ -564,9 +564,9 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node {
xfunc.Dcl = list(xfunc.Dcl, n) xfunc.Dcl = list(xfunc.Dcl, n)
callargs = list(callargs, n) callargs = list(callargs, n)
fld = Nod(ODCLFIELD, n, typenod(t.Type)) fld = Nod(ODCLFIELD, n, typenod(t.Type))
if t.Isddd != 0 { if t.Isddd {
fld.Isddd = 1 fld.Isddd = true
ddd = 1 ddd = true
} }
l = list(l, fld) l = list(l, fld)
...@@ -623,7 +623,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node { ...@@ -623,7 +623,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node {
call := Nod(OCALL, Nod(OXDOT, ptr, meth), nil) call := Nod(OCALL, Nod(OXDOT, ptr, meth), nil)
call.List = callargs call.List = callargs
call.Isddd = uint8(ddd) call.Isddd = ddd
if t0.Outtuple == 0 { if t0.Outtuple == 0 {
body = list(body, call) body = list(body, call)
} else { } else {
......
...@@ -1150,9 +1150,9 @@ func checkarglist(all *NodeList, input int) *NodeList { ...@@ -1150,9 +1150,9 @@ func checkarglist(all *NodeList, input int) *NodeList {
n.Right.Op = OTARRAY n.Right.Op = OTARRAY
n.Right.Right = n.Right.Left n.Right.Right = n.Right.Left
n.Right.Left = nil n.Right.Left = nil
n.Isddd = 1 n.Isddd = true
if n.Left != nil { if n.Left != nil {
n.Left.Isddd = 1 n.Left.Isddd = true
} }
} }
......
...@@ -648,7 +648,7 @@ func esc(e *EscState, n *Node, up *Node) { ...@@ -648,7 +648,7 @@ func esc(e *EscState, n *Node, up *Node) {
escassign(e, &e.theSink, n.Left) escassign(e, &e.theSink, n.Left)
case OAPPEND: case OAPPEND:
if n.Isddd == 0 { if !n.Isddd {
for ll = n.List.Next; ll != nil; ll = ll.Next { for ll = n.List.Next; ll != nil; ll = ll.Next {
escassign(e, &e.theSink, ll.N) // lose track of assign to dereference escassign(e, &e.theSink, ll.N) // lose track of assign to dereference
} }
...@@ -1045,7 +1045,7 @@ func esccall(e *EscState, n *Node, up *Node) { ...@@ -1045,7 +1045,7 @@ func esccall(e *EscState, n *Node, up *Node) {
var src *Node var src *Node
for lr = fn.Ntype.List; ll != nil && lr != nil; (func() { ll = ll.Next; lr = lr.Next })() { for lr = fn.Ntype.List; ll != nil && lr != nil; (func() { ll = ll.Next; lr = lr.Next })() {
src = ll.N src = ll.N
if lr.N.Isddd != 0 && n.Isddd == 0 { if lr.N.Isddd && !n.Isddd {
// Introduce ODDDARG node to represent ... allocation. // Introduce ODDDARG node to represent ... allocation.
src = Nod(ODDDARG, nil, nil) src = Nod(ODDDARG, nil, nil)
...@@ -1114,7 +1114,7 @@ func esccall(e *EscState, n *Node, up *Node) { ...@@ -1114,7 +1114,7 @@ func esccall(e *EscState, n *Node, up *Node) {
var a *Node var a *Node
for t := getinargx(fntype).Type; ll != nil; ll = ll.Next { for t := getinargx(fntype).Type; ll != nil; ll = ll.Next {
src = ll.N src = ll.N
if t.Isddd != 0 && n.Isddd == 0 { if t.Isddd && !n.Isddd {
// Introduce ODDDARG node to represent ... allocation. // Introduce ODDDARG node to represent ... allocation.
src = Nod(ODDDARG, nil, nil) src = Nod(ODDDARG, nil, nil)
......
...@@ -269,8 +269,8 @@ func Jconv(n *Node, flag int) string { ...@@ -269,8 +269,8 @@ func Jconv(n *Node, flag int) string {
fp += fmt.Sprintf(" dd(%d)", n.Dodata) fp += fmt.Sprintf(" dd(%d)", n.Dodata)
} }
if n.Isddd != 0 { if n.Isddd {
fp += fmt.Sprintf(" isddd(%d)", n.Isddd) fp += fmt.Sprintf(" isddd(%v)", n.Isddd)
} }
if n.Implicit { if n.Implicit {
...@@ -749,7 +749,7 @@ func typefmt(t *Type, flag int) string { ...@@ -749,7 +749,7 @@ func typefmt(t *Type, flag int) string {
} }
} }
if t.Isddd != 0 { if t.Isddd {
fp += fmt.Sprintf("...%v", Tconv(t.Type.Type, 0)) fp += fmt.Sprintf("...%v", Tconv(t.Type.Type, 0))
} else { } else {
fp += fmt.Sprintf("%v", Tconv(t.Type, 0)) fp += fmt.Sprintf("%v", Tconv(t.Type, 0))
...@@ -1435,7 +1435,7 @@ func exprfmt(n *Node, prec int) string { ...@@ -1435,7 +1435,7 @@ func exprfmt(n *Node, prec int) string {
if n.Left != nil { if n.Left != nil {
return fmt.Sprintf("%v(%v)", Oconv(int(n.Op), obj.FmtSharp), Nconv(n.Left, 0)) return fmt.Sprintf("%v(%v)", Oconv(int(n.Op), obj.FmtSharp), Nconv(n.Left, 0))
} }
if n.Isddd != 0 { if n.Isddd {
return fmt.Sprintf("%v(%v...)", Oconv(int(n.Op), obj.FmtSharp), Hconv(n.List, obj.FmtComma)) return fmt.Sprintf("%v(%v...)", Oconv(int(n.Op), obj.FmtSharp), Hconv(n.List, obj.FmtComma))
} }
var f string var f string
...@@ -1448,7 +1448,7 @@ func exprfmt(n *Node, prec int) string { ...@@ -1448,7 +1448,7 @@ func exprfmt(n *Node, prec int) string {
OCALLMETH: OCALLMETH:
var f string var f string
f += exprfmt(n.Left, nprec) f += exprfmt(n.Left, nprec)
if n.Isddd != 0 { if n.Isddd {
f += fmt.Sprintf("(%v...)", Hconv(n.List, obj.FmtComma)) f += fmt.Sprintf("(%v...)", Hconv(n.List, obj.FmtComma))
return f return f
} }
......
...@@ -143,7 +143,7 @@ type Type struct { ...@@ -143,7 +143,7 @@ type Type struct {
Local uint8 // created in this file Local uint8 // created in this file
Deferwidth uint8 Deferwidth uint8
Broke uint8 // broken type definition. Broke uint8 // broken type definition.
Isddd uint8 // TFIELD is ... argument Isddd bool // TFIELD is ... argument
Align uint8 Align uint8
Haspointers uint8 // 0 unknown, 1 no, 2 yes Haspointers uint8 // 0 unknown, 1 no, 2 yes
......
...@@ -935,7 +935,7 @@ pseudocall: ...@@ -935,7 +935,7 @@ pseudocall:
{ {
$$ = Nod(OCALL, $1, nil); $$ = Nod(OCALL, $1, nil);
$$.List = $3; $$.List = $3;
$$.Isddd = 1; $$.Isddd = true;
} }
pexpr_no_paren: pexpr_no_paren:
...@@ -2103,7 +2103,7 @@ hidden_funarg: ...@@ -2103,7 +2103,7 @@ hidden_funarg:
if $1 != nil { if $1 != nil {
$$.Left = newname($1); $$.Left = newname($1);
} }
$$.Isddd = 1; $$.Isddd = true;
$$.Val = $4; $$.Val = $4;
} }
......
...@@ -118,7 +118,7 @@ func caninl(fn *Node) { ...@@ -118,7 +118,7 @@ func caninl(fn *Node) {
// can't handle ... args yet // can't handle ... args yet
if Debug['l'] < 3 { if Debug['l'] < 3 {
for t := fn.Type.Type.Down.Down.Type; t != nil; t = t.Down { for t := fn.Type.Type.Down.Down.Type; t != nil; t = t.Down {
if t.Isddd != 0 { if t.Isddd {
return return
} }
} }
...@@ -466,10 +466,10 @@ func inlnode(np **Node) { ...@@ -466,10 +466,10 @@ func inlnode(np **Node) {
fmt.Printf("%v:call to func %v\n", n.Line(), Nconv(n.Left, obj.FmtSign)) fmt.Printf("%v:call to func %v\n", n.Line(), Nconv(n.Left, obj.FmtSign))
} }
if n.Left.Inl != nil { // normal case if n.Left.Inl != nil { // normal case
mkinlcall(np, n.Left, int(n.Isddd)) mkinlcall(np, n.Left, n.Isddd)
} else if n.Left.Op == ONAME && n.Left.Left != nil && n.Left.Left.Op == OTYPE && n.Left.Right != nil && n.Left.Right.Op == ONAME { // methods called as functions } else if n.Left.Op == ONAME && n.Left.Left != nil && n.Left.Left.Op == OTYPE && n.Left.Right != nil && n.Left.Right.Op == ONAME { // methods called as functions
if n.Left.Sym.Def != nil { if n.Left.Sym.Def != nil {
mkinlcall(np, n.Left.Sym.Def, int(n.Isddd)) mkinlcall(np, n.Left.Sym.Def, n.Isddd)
} }
} }
...@@ -487,13 +487,13 @@ func inlnode(np **Node) { ...@@ -487,13 +487,13 @@ func inlnode(np **Node) {
Fatal("no function definition for [%p] %v\n", n.Left.Type, Tconv(n.Left.Type, obj.FmtSign)) Fatal("no function definition for [%p] %v\n", n.Left.Type, Tconv(n.Left.Type, obj.FmtSign))
} }
mkinlcall(np, n.Left.Type.Nname, int(n.Isddd)) mkinlcall(np, n.Left.Type.Nname, n.Isddd)
} }
lineno = int32(lno) lineno = int32(lno)
} }
func mkinlcall(np **Node, fn *Node, isddd int) { func mkinlcall(np **Node, fn *Node, isddd bool) {
save_safemode := safemode save_safemode := safemode
// imported functions may refer to unsafe as long as the // imported functions may refer to unsafe as long as the
...@@ -525,7 +525,7 @@ var inlgen int ...@@ -525,7 +525,7 @@ var inlgen int
// On return ninit has the parameter assignments, the nbody is the // On return ninit has the parameter assignments, the nbody is the
// inlined function body and list, rlist contain the input, output // inlined function body and list, rlist contain the input, output
// parameters. // parameters.
func mkinlcall1(np **Node, fn *Node, isddd int) { func mkinlcall1(np **Node, fn *Node, isddd bool) {
// For variadic fn. // For variadic fn.
if fn.Inl == nil { if fn.Inl == nil {
return return
...@@ -631,14 +631,14 @@ func mkinlcall1(np **Node, fn *Node, isddd int) { ...@@ -631,14 +631,14 @@ func mkinlcall1(np **Node, fn *Node, isddd int) {
var varargtype *Type var varargtype *Type
varargcount := 0 varargcount := 0
for t := fn.Type.Type.Down.Down.Type; t != nil; t = t.Down { for t := fn.Type.Type.Down.Down.Type; t != nil; t = t.Down {
if t.Isddd != 0 { if t.Isddd {
variadic = true variadic = true
varargtype = t.Type varargtype = t.Type
} }
} }
// but if argument is dotted too forget about variadicity. // but if argument is dotted too forget about variadicity.
if variadic && isddd != 0 { if variadic && isddd {
variadic = false variadic = false
} }
...@@ -700,7 +700,7 @@ func mkinlcall1(np **Node, fn *Node, isddd int) { ...@@ -700,7 +700,7 @@ func mkinlcall1(np **Node, fn *Node, isddd int) {
// 0 or 1 expression on RHS. // 0 or 1 expression on RHS.
var i int var i int
for t := getinargx(fn.Type).Type; t != nil; t = t.Down { for t := getinargx(fn.Type).Type; t != nil; t = t.Down {
if variadic && t.Isddd != 0 { if variadic && t.Isddd {
vararg = tinlvar(t) vararg = tinlvar(t)
for i = 0; i < varargcount && ll != nil; i++ { for i = 0; i < varargcount && ll != nil; i++ {
m = argvar(varargtype, i) m = argvar(varargtype, i)
...@@ -720,7 +720,7 @@ func mkinlcall1(np **Node, fn *Node, isddd int) { ...@@ -720,7 +720,7 @@ func mkinlcall1(np **Node, fn *Node, isddd int) {
if ll == nil { if ll == nil {
break break
} }
if variadic && t.Isddd != 0 { if variadic && t.Isddd {
break break
} }
as.List = list(as.List, tinlvar(t)) as.List = list(as.List, tinlvar(t))
...@@ -729,7 +729,7 @@ func mkinlcall1(np **Node, fn *Node, isddd int) { ...@@ -729,7 +729,7 @@ func mkinlcall1(np **Node, fn *Node, isddd int) {
} }
// match varargcount arguments with variadic parameters. // match varargcount arguments with variadic parameters.
if variadic && t != nil && t.Isddd != 0 { if variadic && t != nil && t.Isddd {
vararg = tinlvar(t) vararg = tinlvar(t)
var i int var i int
for i = 0; i < varargcount && ll != nil; i++ { for i = 0; i < varargcount && ll != nil; i++ {
......
...@@ -1051,9 +1051,9 @@ ok: ...@@ -1051,9 +1051,9 @@ ok:
for t1 = getthisx(t).Type; t1 != nil; t1 = t1.Down { for t1 = getthisx(t).Type; t1 != nil; t1 = t1.Down {
dtypesym(t1.Type) dtypesym(t1.Type)
} }
isddd := 0 isddd := false
for t1 = getinargx(t).Type; t1 != nil; t1 = t1.Down { for t1 = getinargx(t).Type; t1 != nil; t1 = t1.Down {
isddd = int(t1.Isddd) isddd = t1.Isddd
dtypesym(t1.Type) dtypesym(t1.Type)
} }
...@@ -1063,7 +1063,7 @@ ok: ...@@ -1063,7 +1063,7 @@ ok:
ot = dcommontype(s, ot, t) ot = dcommontype(s, ot, t)
xt = ot - 3*Widthptr xt = ot - 3*Widthptr
ot = duint8(s, ot, uint8(isddd)) ot = duint8(s, ot, uint8(bool2int(isddd)))
// two slice headers: in and out. // two slice headers: in and out.
ot = int(Rnd(int64(ot), int64(Widthptr))) ot = int(Rnd(int64(ot), int64(Widthptr)))
......
...@@ -2425,10 +2425,10 @@ func genwrapper(rcvr *Type, method *Type, newnam *Sym, iface int) { ...@@ -2425,10 +2425,10 @@ func genwrapper(rcvr *Type, method *Type, newnam *Sym, iface int) {
// arg list // arg list
var args *NodeList var args *NodeList
isddd := 0 isddd := false
for l := in; l != nil; l = l.Next { for l := in; l != nil; l = l.Next {
args = list(args, l.N.Left) args = list(args, l.N.Left)
isddd = int(l.N.Left.Isddd) isddd = l.N.Left.Isddd
} }
methodrcvr := getthisx(method.Type).Type.Type methodrcvr := getthisx(method.Type).Type.Type
...@@ -2477,7 +2477,7 @@ func genwrapper(rcvr *Type, method *Type, newnam *Sym, iface int) { ...@@ -2477,7 +2477,7 @@ func genwrapper(rcvr *Type, method *Type, newnam *Sym, iface int) {
fn.Wrapper = true // ignore frame for panic+recover matching fn.Wrapper = true // ignore frame for panic+recover matching
call := Nod(OCALL, dot, nil) call := Nod(OCALL, dot, nil)
call.List = args call.List = args
call.Isddd = uint8(isddd) call.Isddd = isddd
if method.Type.Outtuple > 0 { if method.Type.Outtuple > 0 {
n := Nod(ORETURN, nil, nil) n := Nod(ORETURN, nil, nil)
n.List = list1(call) n.List = list1(call)
......
...@@ -44,7 +44,7 @@ type Node struct { ...@@ -44,7 +44,7 @@ type Node struct {
Dodata uint8 Dodata uint8
Initorder uint8 Initorder uint8
Used bool Used bool
Isddd uint8 Isddd bool // is the argument variadic
Readonly bool Readonly bool
Implicit bool Implicit bool
Addrtaken bool // address taken, even if not moved to heap Addrtaken bool // address taken, even if not moved to heap
......
...@@ -1272,7 +1272,7 @@ OpSwitch: ...@@ -1272,7 +1272,7 @@ OpSwitch:
if l.Op == ONAME { if l.Op == ONAME {
r := unsafenmagic(n) r := unsafenmagic(n)
if r != nil { if r != nil {
if n.Isddd != 0 { if n.Isddd {
Yyerror("invalid use of ... with builtin %v", Nconv(l, 0)) Yyerror("invalid use of ... with builtin %v", Nconv(l, 0))
} }
n = r n = r
...@@ -1285,7 +1285,7 @@ OpSwitch: ...@@ -1285,7 +1285,7 @@ OpSwitch:
n.Diag |= n.Left.Diag n.Diag |= n.Left.Diag
l = n.Left l = n.Left
if l.Op == ONAME && l.Etype != 0 { if l.Op == ONAME && l.Etype != 0 {
if n.Isddd != 0 && l.Etype != OAPPEND { if n.Isddd && l.Etype != OAPPEND {
Yyerror("invalid use of ... with builtin %v", Nconv(l, 0)) Yyerror("invalid use of ... with builtin %v", Nconv(l, 0))
} }
...@@ -1301,7 +1301,7 @@ OpSwitch: ...@@ -1301,7 +1301,7 @@ OpSwitch:
defaultlit(&n.Left, nil) defaultlit(&n.Left, nil)
l = n.Left l = n.Left
if l.Op == OTYPE { if l.Op == OTYPE {
if n.Isddd != 0 || l.Type.Bound == -100 { if n.Isddd || l.Type.Bound == -100 {
if l.Type.Broke == 0 { if l.Type.Broke == 0 {
Yyerror("invalid use of ... in type conversion", l) Yyerror("invalid use of ... in type conversion", l)
} }
...@@ -1324,7 +1324,7 @@ OpSwitch: ...@@ -1324,7 +1324,7 @@ OpSwitch:
return return
} }
if count(n.List) == 1 && n.Isddd == 0 { if count(n.List) == 1 && !n.Isddd {
typecheck(&n.List.N, Erv|Efnstruct) typecheck(&n.List.N, Erv|Efnstruct)
} else { } else {
typechecklist(n.List, Erv) typechecklist(n.List, Erv)
...@@ -1364,7 +1364,7 @@ OpSwitch: ...@@ -1364,7 +1364,7 @@ OpSwitch:
descbuf := fmt.Sprintf("argument to %v", Nconv(n.Left, 0)) descbuf := fmt.Sprintf("argument to %v", Nconv(n.Left, 0))
desc := descbuf desc := descbuf
typecheckaste(OCALL, n.Left, int(n.Isddd), getinargx(t), n.List, desc) typecheckaste(OCALL, n.Left, n.Isddd, getinargx(t), n.List, desc)
ok |= Etop ok |= Etop
if t.Outtuple == 0 { if t.Outtuple == 0 {
break OpSwitch break OpSwitch
...@@ -1617,7 +1617,7 @@ OpSwitch: ...@@ -1617,7 +1617,7 @@ OpSwitch:
return return
} }
if count(args) == 1 && n.Isddd == 0 { if count(args) == 1 && !n.Isddd {
typecheck(&args.N, Erv|Efnstruct) typecheck(&args.N, Erv|Efnstruct)
} else { } else {
typechecklist(args, Erv) typechecklist(args, Erv)
...@@ -1650,7 +1650,7 @@ OpSwitch: ...@@ -1650,7 +1650,7 @@ OpSwitch:
return return
} }
if n.Isddd != 0 { if n.Isddd {
if args.Next == nil { if args.Next == nil {
Yyerror("cannot use ... on first argument to append") Yyerror("cannot use ... on first argument to append")
n.Type = nil n.Type = nil
...@@ -2127,7 +2127,7 @@ OpSwitch: ...@@ -2127,7 +2127,7 @@ OpSwitch:
if Curfn.Type.Outnamed != 0 && n.List == nil { if Curfn.Type.Outnamed != 0 && n.List == nil {
break OpSwitch break OpSwitch
} }
typecheckaste(ORETURN, nil, 0, getoutargx(Curfn.Type), n.List, "return argument") typecheckaste(ORETURN, nil, false, getoutargx(Curfn.Type), n.List, "return argument")
break OpSwitch break OpSwitch
case ORETJMP: case ORETJMP:
...@@ -2584,7 +2584,7 @@ func nokeys(l *NodeList) bool { ...@@ -2584,7 +2584,7 @@ func nokeys(l *NodeList) bool {
func hasddd(t *Type) bool { func hasddd(t *Type) bool {
for tl := t.Type; tl != nil; tl = tl.Down { for tl := t.Type; tl != nil; tl = tl.Down {
if tl.Isddd != 0 { if tl.Isddd {
return true return true
} }
} }
...@@ -2604,7 +2604,7 @@ func downcount(t *Type) int { ...@@ -2604,7 +2604,7 @@ func downcount(t *Type) int {
/* /*
* typecheck assignment: type list = expression list * typecheck assignment: type list = expression list
*/ */
func typecheckaste(op int, call *Node, isddd int, tstruct *Type, nl *NodeList, desc string) { func typecheckaste(op int, call *Node, isddd bool, tstruct *Type, nl *NodeList, desc string) {
var t *Type var t *Type
var n *Node var n *Node
var n1 int var n1 int
...@@ -2635,7 +2635,7 @@ func typecheckaste(op int, call *Node, isddd int, tstruct *Type, nl *NodeList, d ...@@ -2635,7 +2635,7 @@ func typecheckaste(op int, call *Node, isddd int, tstruct *Type, nl *NodeList, d
tn := n.Type.Type tn := n.Type.Type
var why string var why string
for tl := tstruct.Type; tl != nil; tl = tl.Down { for tl := tstruct.Type; tl != nil; tl = tl.Down {
if tl.Isddd != 0 { if tl.Isddd {
for ; tn != nil; tn = tn.Down { for ; tn != nil; tn = tn.Down {
if assignop(tn.Type, tl.Type.Type, &why) == 0 { if assignop(tn.Type, tl.Type.Type, &why) == 0 {
if call != nil { if call != nil {
...@@ -2681,7 +2681,7 @@ func typecheckaste(op int, call *Node, isddd int, tstruct *Type, nl *NodeList, d ...@@ -2681,7 +2681,7 @@ func typecheckaste(op int, call *Node, isddd int, tstruct *Type, nl *NodeList, d
goto notenough goto notenough
} }
} else { } else {
if isddd == 0 { if !isddd {
if n2 < n1-1 { if n2 < n1-1 {
goto notenough goto notenough
} }
...@@ -2697,8 +2697,8 @@ func typecheckaste(op int, call *Node, isddd int, tstruct *Type, nl *NodeList, d ...@@ -2697,8 +2697,8 @@ func typecheckaste(op int, call *Node, isddd int, tstruct *Type, nl *NodeList, d
for tl := tstruct.Type; tl != nil; tl = tl.Down { for tl := tstruct.Type; tl != nil; tl = tl.Down {
t = tl.Type t = tl.Type
if tl.Isddd != 0 { if tl.Isddd {
if isddd != 0 { if isddd {
if nl == nil { if nl == nil {
goto notenough goto notenough
} }
...@@ -2738,7 +2738,7 @@ func typecheckaste(op int, call *Node, isddd int, tstruct *Type, nl *NodeList, d ...@@ -2738,7 +2738,7 @@ func typecheckaste(op int, call *Node, isddd int, tstruct *Type, nl *NodeList, d
if nl != nil { if nl != nil {
goto toomany goto toomany
} }
if isddd != 0 { if isddd {
if call != nil { if call != nil {
Yyerror("invalid use of ... in call to %v", Nconv(call, 0)) Yyerror("invalid use of ... in call to %v", Nconv(call, 0))
} else { } else {
......
...@@ -326,7 +326,7 @@ func walkstmt(np **Node) { ...@@ -326,7 +326,7 @@ func walkstmt(np **Node) {
break break
} }
ll := ascompatte(int(n.Op), nil, 0, Getoutarg(Curfn.Type), n.List, 1, &n.Ninit) ll := ascompatte(int(n.Op), nil, false, Getoutarg(Curfn.Type), n.List, 1, &n.Ninit)
n.List = ll n.List = ll
case ORETJMP: case ORETJMP:
...@@ -594,7 +594,7 @@ func walkexpr(np **Node, init **NodeList) { ...@@ -594,7 +594,7 @@ func walkexpr(np **Node, init **NodeList) {
} }
walkexpr(&n.Left, init) walkexpr(&n.Left, init)
walkexprlist(n.List, init) walkexprlist(n.List, init)
ll := ascompatte(int(n.Op), n, int(n.Isddd), getinarg(t), n.List, 0, init) ll := ascompatte(int(n.Op), n, n.Isddd, getinarg(t), n.List, 0, init)
n.List = reorder1(ll) n.List = reorder1(ll)
goto ret goto ret
...@@ -632,7 +632,7 @@ func walkexpr(np **Node, init **NodeList) { ...@@ -632,7 +632,7 @@ func walkexpr(np **Node, init **NodeList) {
walkexpr(&n.Left, init) walkexpr(&n.Left, init)
walkexprlist(n.List, init) walkexprlist(n.List, init)
ll := ascompatte(int(n.Op), n, int(n.Isddd), getinarg(t), n.List, 0, init) ll := ascompatte(int(n.Op), n, n.Isddd, getinarg(t), n.List, 0, init)
n.List = reorder1(ll) n.List = reorder1(ll)
goto ret goto ret
...@@ -643,8 +643,8 @@ func walkexpr(np **Node, init **NodeList) { ...@@ -643,8 +643,8 @@ func walkexpr(np **Node, init **NodeList) {
} }
walkexpr(&n.Left, init) walkexpr(&n.Left, init)
walkexprlist(n.List, init) walkexprlist(n.List, init)
ll := ascompatte(int(n.Op), n, 0, getthis(t), list1(n.Left.Left), 0, init) ll := ascompatte(int(n.Op), n, false, getthis(t), list1(n.Left.Left), 0, init)
lr := ascompatte(int(n.Op), n, int(n.Isddd), getinarg(t), n.List, 0, init) lr := ascompatte(int(n.Op), n, n.Isddd, getinarg(t), n.List, 0, init)
ll = concat(ll, lr) ll = concat(ll, lr)
n.Left.Left = nil n.Left.Left = nil
ullmancalc(n.Left) ullmancalc(n.Left)
...@@ -1370,7 +1370,7 @@ func walkexpr(np **Node, init **NodeList) { ...@@ -1370,7 +1370,7 @@ func walkexpr(np **Node, init **NodeList) {
goto ret goto ret
case OAPPEND: case OAPPEND:
if n.Isddd != 0 { if n.Isddd {
n = appendslice(n, init) // also works for append(slice, string). n = appendslice(n, init) // also works for append(slice, string).
} else { } else {
n = walkappend(n, init) n = walkappend(n, init)
...@@ -1841,7 +1841,7 @@ func dumpnodetypes(l *NodeList, what string) string { ...@@ -1841,7 +1841,7 @@ func dumpnodetypes(l *NodeList, what string) string {
* return expr-list * return expr-list
* func(expr-list) * func(expr-list)
*/ */
func ascompatte(op int, call *Node, isddd int, nl **Type, lr *NodeList, fp int, init **NodeList) *NodeList { func ascompatte(op int, call *Node, isddd bool, nl **Type, lr *NodeList, fp int, init **NodeList) *NodeList {
var savel Iter var savel Iter
lr0 := lr lr0 := lr
...@@ -1888,7 +1888,7 @@ func ascompatte(op int, call *Node, isddd int, nl **Type, lr *NodeList, fp int, ...@@ -1888,7 +1888,7 @@ func ascompatte(op int, call *Node, isddd int, nl **Type, lr *NodeList, fp int,
} }
loop: loop:
if l != nil && l.Isddd != 0 { if l != nil && l.Isddd {
// the ddd parameter must be last // the ddd parameter must be last
ll = structnext(&savel) ll = structnext(&savel)
...@@ -1900,7 +1900,7 @@ loop: ...@@ -1900,7 +1900,7 @@ loop:
// only if we are assigning a single ddd // only if we are assigning a single ddd
// argument to a ddd parameter then it is // argument to a ddd parameter then it is
// passed thru unencapsulated // passed thru unencapsulated
if r != nil && lr.Next == nil && isddd != 0 && Eqtype(l.Type, r.Type) { if r != nil && lr.Next == nil && isddd && Eqtype(l.Type, r.Type) {
a = Nod(OAS, nodarg(l, fp), r) a = Nod(OAS, nodarg(l, fp), r)
a = convas(a, init) a = convas(a, init)
nn = list(nn, a) nn = list(nn, a)
......
...@@ -2052,7 +2052,7 @@ yydefault: ...@@ -2052,7 +2052,7 @@ yydefault:
{ {
yyVAL.node = Nod(OCALL, yyDollar[1].node, nil) yyVAL.node = Nod(OCALL, yyDollar[1].node, nil)
yyVAL.node.List = yyDollar[3].list yyVAL.node.List = yyDollar[3].list
yyVAL.node.Isddd = 1 yyVAL.node.Isddd = true
} }
case 126: case 126:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
...@@ -3379,7 +3379,7 @@ yydefault: ...@@ -3379,7 +3379,7 @@ yydefault:
if yyDollar[1].sym != nil { if yyDollar[1].sym != nil {
yyVAL.node.Left = newname(yyDollar[1].sym) yyVAL.node.Left = newname(yyDollar[1].sym)
} }
yyVAL.node.Isddd = 1 yyVAL.node.Isddd = true
yyVAL.node.Val = yyDollar[4].val yyVAL.node.Val = yyDollar[4].val
} }
case 332: case 332:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment