@@ -27,7 +27,6 @@ if (ENVIRONMENT_IS_WORKER) {
2727{ { { exportRuntime ( ) } } }
2828
2929var calledRun ;
30- var calledPrerun ;
3130
3231#if STANDALONE_WASM && MAIN_READS_PARAMS
3332var mainArgs = undefined ;
@@ -47,7 +46,7 @@ function callMain() {
4746#endif
4847#if ASSERTIONS
4948 assert ( runDependencies == 0 , 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])' ) ;
50- assert ( calledPrerun , 'cannot call main without calling preRun first ' ) ;
49+ assert ( __ATPRERUN__ . length == 0 , 'cannot call main when preRun functions remain to be called ' ) ;
5150#endif
5251
5352 var entryFunction = { { { getEntryFunction( ) } } } ;
@@ -189,25 +188,22 @@ function run() {
189188 stackCheckInit ( ) ;
190189#endif
191190
192- if ( ! calledPrerun ) {
193- calledPrerun = 1 ;
194- preRun ( ) ;
191+ preRun ( ) ;
195192
196- // a preRun added a dependency, run will be called later
197- if ( runDependencies > 0 ) {
193+ // a preRun added a dependency, run will be called later
194+ if ( runDependencies > 0 ) {
198195#if RUNTIME_DEBUG
199- dbg ( 'run() called, but dependencies remain, so not running' ) ;
196+ dbg ( 'run() called, but dependencies remain, so not running' ) ;
200197#endif
201- return ;
202- }
198+ return ;
203199 }
204200
205201 function doRun ( ) {
206202 // run may have just been called through dependencies being fulfilled just in this very frame,
207203 // or while the async setStatus time below was happening
208204 if ( calledRun ) return ;
209- calledRun = 1 ;
210- Module [ 'calledRun' ] = 1 ;
205+ calledRun = true ;
206+ Module [ 'calledRun' ] = true ;
211207
212208 if ( ABORT ) return ;
213209
0 commit comments