cmd/compile: cleanups for Node trimming sequence

Suggested during code reviews of last 15 CLs (or so).

Change-Id: If780f6eb47a7a31df133c64d5dcf0eaf04d8447b
Reviewed-on: https://go-review.googlesource.com/10675
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Russ Cox 2015-06-03 14:16:01 -04:00
parent ca19e55f9a
commit a53710ffcb
9 changed files with 43 additions and 26 deletions

View file

@ -18,9 +18,11 @@ const (
InitPending = 2
)
var initlist *NodeList
var initplans = make(map[*Node]*InitPlan)
var inittemps = make(map[*Node]*Node)
var (
initlist *NodeList
initplans map[*Node]*InitPlan
inittemps = make(map[*Node]*Node)
)
// init1 walks the AST starting at n, and accumulates in out
// the list of definitions needing init code in dependency order.
@ -255,9 +257,11 @@ func initreorder(l *NodeList, out **NodeList) {
// to include in the init() function body.
func initfix(l *NodeList) *NodeList {
var lout *NodeList
initplans = make(map[*Node]*InitPlan)
lno := int(lineno)
initreorder(l, &lout)
lineno = int32(lno)
initplans = nil
return lout
}