@@ -87,7 +87,7 @@ class AsyncHook {
8787 // enable()/disable() are run during their execution. The following
8888 // references are reassigned to the tmp arrays if a hook is currently being
8989 // processed.
90- const [ hooks_array , hook_fields ] = getHookArrays ( ) ;
90+ const { 0 : hooks_array , 1 : hook_fields } = getHookArrays ( ) ;
9191
9292 // Each hook is only allowed to be added once.
9393 if ( ArrayPrototypeIncludes ( hooks_array , this ) )
@@ -116,7 +116,7 @@ class AsyncHook {
116116 }
117117
118118 disable ( ) {
119- const [ hooks_array , hook_fields ] = getHookArrays ( ) ;
119+ const { 0 : hooks_array , 1 : hook_fields } = getHookArrays ( ) ;
120120
121121 const index = ArrayPrototypeIndexOf ( hooks_array , this ) ;
122122 if ( index === - 1 )
@@ -193,8 +193,7 @@ class AsyncResource {
193193 emitBefore ( asyncId , this [ trigger_async_id_symbol ] , this ) ;
194194
195195 try {
196- const ret = thisArg === undefined ?
197- fn ( ...args ) :
196+ const ret =
198197 ReflectApply ( fn , thisArg , args ) ;
199198
200199 return ret ;
@@ -302,25 +301,25 @@ class AsyncLocalStorage {
302301 run ( store , callback , ...args ) {
303302 // Avoid creation of an AsyncResource if store is already active
304303 if ( ObjectIs ( store , this . getStore ( ) ) ) {
305- return callback ( ... args ) ;
304+ return ReflectApply ( callback , null , args ) ;
306305 }
307306 const resource = new AsyncResource ( 'AsyncLocalStorage' ,
308307 defaultAlsResourceOpts ) ;
309308 // Calling emitDestroy before runInAsyncScope avoids a try/finally
310309 // It is ok because emitDestroy only schedules calling the hook
311310 return resource . emitDestroy ( ) . runInAsyncScope ( ( ) => {
312311 this . enterWith ( store ) ;
313- return callback ( ... args ) ;
312+ return ReflectApply ( callback , null , args ) ;
314313 } ) ;
315314 }
316315
317316 exit ( callback , ...args ) {
318317 if ( ! this . enabled ) {
319- return callback ( ... args ) ;
318+ return ReflectApply ( callback , null , args ) ;
320319 }
321320 this . disable ( ) ;
322321 try {
323- return callback ( ... args ) ;
322+ return ReflectApply ( callback , null , args ) ;
324323 } finally {
325324 this . _enable ( ) ;
326325 }
0 commit comments