aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iimport.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iimport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iimport.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go
index 17aa35549d..9355174da8 100644
--- a/src/cmd/compile/internal/typecheck/iimport.go
+++ b/src/cmd/compile/internal/typecheck/iimport.go
@@ -992,6 +992,11 @@ func (r *importReader) node() ir.Node {
r.funcBody(fn)
fn.Dcl = fn.Inl.Dcl
fn.Body = fn.Inl.Body
+ if len(fn.Body) == 0 {
+ // An empty closure must be represented as a single empty
+ // block statement, else it will be dropped.
+ fn.Body = []ir.Node{ir.NewBlockStmt(src.NoXPos, nil)}
+ }
fn.Inl = nil
ir.FinishCaptureNames(pos, r.curfn, fn)