fix: set type correctly for variable declaration with assignment (#59)

Do not ignore type node when used in a variable declaration with assign.
The source node in a assign node can be the 2nd or the 3rd (the 2nd being the type).
This commit is contained in:
Marc Vertes
2019-01-28 16:00:15 +01:00
committed by Ludovic Fernandez
parent 73afc090bb
commit 63732d4326
5 changed files with 74 additions and 35 deletions

View File

@@ -185,7 +185,7 @@ func assignX(n *Node) {
// assign implements single value assignment
func assign(n *Node) {
value := genValue(n)
value1 := genValue(n.child[1])
value1 := genValue(n.child[len(n.child)-1])
next := getExec(n.tnext)
if n.child[0].typ.cat == InterfaceT {