Now that GOEXPERIMENT=nounified is removed, we can assume InlineCall
and HaveInlineBody will always be overridden with the unified
frontend's implementations. Similarly, we can assume expandDecl will
never be called.
This CL changes the code paths into Fatalfs, so subsequent CLs can
remove all the unreachable code.
Updates #57410.
Change-Id: I2a0c3edb32916c30dd63c4dce4f1bd6f18e07468
Reviewed-on: https://go-review.googlesource.com/c/go/+/458618
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
// InlineCall allows the inliner implementation to be overridden.
// If it returns nil, the function will not be inlined.
-var InlineCall = oldInlineCall
+var InlineCall = func(call *ir.CallExpr, fn *ir.Func, inlIndex int) *ir.InlinedCallExpr {
+ base.Fatalf("inline.InlineCall not overridden")
+ panic("unreachable")
+}
// If n is a OCALLFUNC node, and fn is an ONAME node for a
// function with an inlinable body, return an OINLCALL node that can replace n.
// It's a function literal so that it can be overridden for
// GOEXPERIMENT=unified.
var HaveInlineBody = func(fn *ir.Func) bool {
- if fn.Inl == nil {
- return false
- }
-
- if fn.Inl.Body != nil {
- return true
- }
-
- _, ok := inlineImporter[fn.Nname.Sym()]
- return ok
+ base.Fatalf("HaveInlineBody not overridden")
+ panic("unreachable")
}
func importReaderFor(sym *types.Sym, importers map[*types.Sym]iimporterAndOffset) *importReader {
return n
}
- // only trace if there's work to do
- if base.EnableTrace && base.Flag.LowerT {
- defer tracePrint("resolve", n)(&res)
- }
-
- if sym := n.Sym(); sym.Pkg != types.LocalPkg {
- return expandDecl(n)
- }
-
- r := ir.AsNode(n.Sym().Def)
- if r == nil {
- return n
- }
-
- return r
+ base.Fatalf("unexpected NONAME node: %+v", n)
+ panic("unreachable")
}
func typecheckslice(l []ir.Node, top int) {