@@ -169,6 +169,8 @@ public static BoundGlobalScope BindGlobalScope(bool isScript, BoundGlobalScope p
169169 else
170170 {
171171 mainFunction = new FunctionSymbol ( "main" , ImmutableArray < ParameterSymbol > . Empty , TypeSymbol . Void , null ) ;
172+ var bbs = new BoundBlockStatement ( statements . ToImmutable ( ) ) ;
173+ mainFunction . block = bbs ;
172174 }
173175 }
174176 }
@@ -209,7 +211,7 @@ public static BoundProgram BindProgram(bool isScript, BoundProgram previous, Bou
209211 var loweredBody = Lowerer . Lower ( fs , body ) ;
210212
211213 fs . scope = ( ( BoundBlockStatement ) body ) . Scope ;
212- fs . block = ( BoundBlockStatement ) body ;
214+ fs . block = body ;
213215
214216 if ( fs . Type != TypeSymbol . Void && ! ControlFlowGraph . AllPathsReturn ( loweredBody ) )
215217 Binder . _diagnostics . ReportAllPathsMustReturn ( fs . Declaration . Identifier . Location ) ;
@@ -227,7 +229,7 @@ public static BoundProgram BindProgram(bool isScript, BoundProgram previous, Bou
227229 var loweredBody = Lowerer . Lower ( function , body ) ;
228230
229231 function . scope = ( ( BoundBlockStatement ) body ) . Scope ;
230- function . block = ( BoundBlockStatement ) body ;
232+ function . block = body ;
231233
232234 if ( function . Type != TypeSymbol . Void && ! ControlFlowGraph . AllPathsReturn ( loweredBody ) )
233235 Binder . _diagnostics . ReportAllPathsMustReturn ( function . Declaration . Identifier . Location ) ;
@@ -244,7 +246,7 @@ public static BoundProgram BindProgram(bool isScript, BoundProgram previous, Bou
244246 var loweredBody = Lowerer . Lower ( function , body ) ;
245247
246248 function . scope = ( ( BoundBlockStatement ) body ) . Scope ;
247- function . block = ( BoundBlockStatement ) body ;
249+ function . block = body ;
248250
249251 if ( function . Type != TypeSymbol . Void && ! ControlFlowGraph . AllPathsReturn ( loweredBody ) )
250252 Binder . _diagnostics . ReportAllPathsMustReturn ( function . Declaration . Identifier . Location ) ;
0 commit comments