From 98218388321c0c48a4b955792b8d1e3db63a140d Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Tue, 5 Jan 2021 08:20:11 -0800 Subject: [dev.regabi] cmd/compile: remove CaptureVars Capture analysis is now part of escape analysis. Passes toolstash -cmp. Change-Id: Ifcd3ecc342074c590e0db1ff0646dfa1ea2ff57b Reviewed-on: https://go-review.googlesource.com/c/go/+/281543 Trust: Matthew Dempsky Reviewed-by: Cuong Manh Le --- src/cmd/compile/internal/typecheck/typecheck.go | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'src/cmd/compile/internal/typecheck/typecheck.go') diff --git a/src/cmd/compile/internal/typecheck/typecheck.go b/src/cmd/compile/internal/typecheck/typecheck.go index c3a5a3c40f..07bbd25105 100644 --- a/src/cmd/compile/internal/typecheck/typecheck.go +++ b/src/cmd/compile/internal/typecheck/typecheck.go @@ -21,8 +21,6 @@ var InitTodoFunc = ir.NewFunc(base.Pos) var inimport bool // set during import -var decldepth int32 - var TypecheckAllowed bool var ( @@ -58,7 +56,6 @@ func Callee(n ir.Node) ir.Node { func FuncBody(n *ir.Func) { ir.CurFunc = n - decldepth = 1 errorsBefore := base.Errors() Stmts(n.Body) CheckUnused(n) @@ -506,9 +503,6 @@ func typecheck1(n ir.Node, top int) ir.Node { case ir.ONAME: n := n.(*ir.Name) - if n.Decldepth == 0 { - n.Decldepth = decldepth - } if n.BuiltinOp != 0 { if top&ctxCallee == 0 { base.Errorf("use of builtin %v not in function call", n.Sym()) @@ -839,7 +833,6 @@ func typecheck1(n ir.Node, top int) ir.Node { return n case ir.OLABEL: - decldepth++ if n.Sym().IsBlank() { // Empty identifier is valid but useless. // Eliminate now to simplify life later. @@ -1620,18 +1613,6 @@ func checkassign(stmt ir.Node, n ir.Node) { return } - // Variables declared in ORANGE are assigned on every iteration. - if !ir.DeclaredBy(n, stmt) || stmt.Op() == ir.ORANGE { - r := ir.OuterValue(n) - if r.Op() == ir.ONAME { - r := r.(*ir.Name) - r.SetAssigned(true) - if r.IsClosureVar() { - r.Defn.Name().SetAssigned(true) - } - } - } - if ir.IsAddressable(n) { return } -- cgit v1.2.3-54-g00ecf