aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/walk/closure.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/walk/closure.go')
-rw-r--r--src/cmd/compile/internal/walk/closure.go47
1 files changed, 2 insertions, 45 deletions
diff --git a/src/cmd/compile/internal/walk/closure.go b/src/cmd/compile/internal/walk/closure.go
index 590c9a3ad4..42750c2125 100644
--- a/src/cmd/compile/internal/walk/closure.go
+++ b/src/cmd/compile/internal/walk/closure.go
@@ -217,7 +217,6 @@ func methodValueWrapper(dot *ir.SelectorExpr) *ir.Name {
base.Fatalf("methodValueWrapper: unexpected %v (%v)", dot, dot.Op())
}
- t0 := dot.Type()
meth := dot.Sel
rcvrtype := dot.X.Type()
sym := ir.MethodSymSuffix(rcvrtype, meth, "-fm")
@@ -227,48 +226,6 @@ func methodValueWrapper(dot *ir.SelectorExpr) *ir.Name {
}
sym.SetUniq(true)
- if base.Debug.Unified != 0 {
- base.FatalfAt(dot.Pos(), "missing wrapper for %v", meth)
- }
-
- savecurfn := ir.CurFunc
- saveLineNo := base.Pos
- ir.CurFunc = nil
-
- base.Pos = base.AutogeneratedPos
-
- fn := typecheck.DeclFunc(sym, nil,
- typecheck.NewFuncParams(t0.Params(), true),
- typecheck.NewFuncParams(t0.Results(), false))
- fn.SetDupok(true)
- fn.SetWrapper(true)
-
- // Declare and initialize variable holding receiver.
- ptr := ir.NewHiddenParam(base.Pos, fn, typecheck.Lookup(".this"), rcvrtype)
-
- call := ir.NewCallExpr(base.Pos, ir.OCALL, ir.NewSelectorExpr(base.Pos, ir.OXDOT, ptr, meth), nil)
- call.Args = ir.ParamNames(fn.Type())
- call.IsDDD = fn.Type().IsVariadic()
-
- var body ir.Node = call
- if t0.NumResults() != 0 {
- ret := ir.NewReturnStmt(base.Pos, nil)
- ret.Results = []ir.Node{call}
- body = ret
- }
-
- fn.Body = []ir.Node{body}
- typecheck.FinishFuncBody()
-
- typecheck.Func(fn)
- // Need to typecheck the body of the just-generated wrapper.
- // typecheckslice() requires that Curfn is set when processing an ORETURN.
- ir.CurFunc = fn
- typecheck.Stmts(fn.Body)
- sym.Def = fn.Nname
- typecheck.Target.Decls = append(typecheck.Target.Decls, fn)
- ir.CurFunc = savecurfn
- base.Pos = saveLineNo
-
- return fn.Nname
+ base.FatalfAt(dot.Pos(), "missing wrapper for %v", meth)
+ panic("unreachable")
}