node: elide some more parens in assignment expressions
This commit is contained in:
parent
5105293ce6
commit
71a4efbbda
3
node.go
3
node.go
@ -1541,7 +1541,7 @@ func (this *conversionState) convertAssignment(n *assign.Assign, isTopLevelState
|
|||||||
return "", parseErr{dimf, err}
|
return "", parseErr{dimf, err}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret := arrayVar + ` = append(` + arrayVar + `, ` + rvalue + `)`
|
ret := arrayVar + ` = append(` + arrayVar + `, ` + removeParens(rvalue) + `)`
|
||||||
if isTopLevelStatement {
|
if isTopLevelStatement {
|
||||||
ret += "\n"
|
ret += "\n"
|
||||||
}
|
}
|
||||||
@ -1559,6 +1559,7 @@ func (this *conversionState) convertAssignment(n *assign.Assign, isTopLevelState
|
|||||||
// TODO this may need to use `:=`
|
// TODO this may need to use `:=`
|
||||||
|
|
||||||
if isTopLevelStatement {
|
if isTopLevelStatement {
|
||||||
|
rvalue = removeParens(rvalue) // safe in top-level assignment context
|
||||||
|
|
||||||
// If this is a simple expression (func call; indirect/method call; assignment of func/method call) then
|
// If this is a simple expression (func call; indirect/method call; assignment of func/method call) then
|
||||||
// we need to propagate errors
|
// we need to propagate errors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user