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}
|
||||
}
|
||||
|
||||
ret := arrayVar + ` = append(` + arrayVar + `, ` + rvalue + `)`
|
||||
ret := arrayVar + ` = append(` + arrayVar + `, ` + removeParens(rvalue) + `)`
|
||||
if isTopLevelStatement {
|
||||
ret += "\n"
|
||||
}
|
||||
@ -1559,6 +1559,7 @@ func (this *conversionState) convertAssignment(n *assign.Assign, isTopLevelState
|
||||
// TODO this may need to use `:=`
|
||||
|
||||
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
|
||||
// we need to propagate errors
|
||||
|
Loading…
Reference in New Issue
Block a user