// Lazy typechecking of imported bodies. For local functions, CanInline will set ->typecheck
// because they're a copy of an already checked body.
func ImportedBody(fn *ir.Func) {
+ if fn.Inl.Body != nil {
+ return
+ }
lno := ir.SetPos(fn.Nname)
// When we load an inlined body, we need to allow OADDR
inTypeCheckInl = false
ir.CurFunc = savefn
- // During ImportBody (which imports fn.Func.Inl.Body),
- // declarations are added to fn.Func.Dcl by funcBody(). Move them
- // to fn.Func.Inl.Dcl for consistency with how local functions
- // behave. (Append because ImportedBody may be called multiple
- // times on same fn.)
- fn.Inl.Dcl = append(fn.Inl.Dcl, fn.Dcl...)
- fn.Dcl = nil
-
base.Pos = lno
}