Commit 06f32922 authored by Keith Randall's avatar Keith Randall

[dev.ssa] cmd/compile/internal/ssa: Use Ninit from expressions

If an expression has an Ninit list, generate code for it.
Required for (at least) OANDAND.

Change-Id: I94c9e22e2a76955736f4a8e574d92711419c5e5c
Reviewed-on: https://go-review.googlesource.com/12072Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 9b048527
...@@ -393,7 +393,6 @@ func (s *state) stmt(n *Node) { ...@@ -393,7 +393,6 @@ func (s *state) stmt(n *Node) {
s.startBlock(bCond) s.startBlock(bCond)
var cond *ssa.Value var cond *ssa.Value
if n.Left != nil { if n.Left != nil {
s.stmtList(n.Left.Ninit)
cond = s.expr(n.Left) cond = s.expr(n.Left)
} else { } else {
cond = s.entryNewValue0A(ssa.OpConst, Types[TBOOL], true) cond = s.entryNewValue0A(ssa.OpConst, Types[TBOOL], true)
...@@ -453,6 +452,7 @@ func (s *state) expr(n *Node) *ssa.Value { ...@@ -453,6 +452,7 @@ func (s *state) expr(n *Node) *ssa.Value {
s.pushLine(n.Lineno) s.pushLine(n.Lineno)
defer s.popLine() defer s.popLine()
s.stmtList(n.Ninit)
switch n.Op { switch n.Op {
case ONAME: case ONAME:
if n.Class == PFUNC { if n.Class == PFUNC {
......
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