@@ -89,7 +89,7 @@ class AsyncHook {
8989 // enable()/disable() are run during their execution. The following
9090 // references are reassigned to the tmp arrays if a hook is currently being
9191 // processed.
92- const [ hooks_array , hook_fields ] = getHookArrays ( ) ;
92+ const { 0 : hooks_array , 1 : hook_fields } = getHookArrays ( ) ;
9393
9494 // Each hook is only allowed to be added once.
9595 if ( ArrayPrototypeIncludes ( hooks_array , this ) )
@@ -118,7 +118,7 @@ class AsyncHook {
118118 }
119119
120120 disable ( ) {
121- const [ hooks_array , hook_fields ] = getHookArrays ( ) ;
121+ const { 0 : hooks_array , 1 : hook_fields } = getHookArrays ( ) ;
122122
123123 const index = ArrayPrototypeIndexOf ( hooks_array , this ) ;
124124 if ( index === - 1 )
@@ -195,8 +195,7 @@ class AsyncResource {
195195 emitBefore ( asyncId , this [ trigger_async_id_symbol ] , this ) ;
196196
197197 try {
198- const ret = thisArg === undefined ?
199- fn ( ...args ) :
198+ const ret =
200199 ReflectApply ( fn , thisArg , args ) ;
201200
202201 return ret ;
@@ -303,25 +302,25 @@ class AsyncLocalStorage {
303302 run ( store , callback , ...args ) {
304303 // Avoid creation of an AsyncResource if store is already active
305304 if ( ObjectIs ( store , this . getStore ( ) ) ) {
306- return callback ( ... args ) ;
305+ return ReflectApply ( callback , null , args ) ;
307306 }
308307 const resource = new AsyncResource ( 'AsyncLocalStorage' ,
309308 defaultAlsResourceOpts ) ;
310309 // Calling emitDestroy before runInAsyncScope avoids a try/finally
311310 // It is ok because emitDestroy only schedules calling the hook
312311 return resource . emitDestroy ( ) . runInAsyncScope ( ( ) => {
313312 this . enterWith ( store ) ;
314- return callback ( ... args ) ;
313+ return ReflectApply ( callback , null , args ) ;
315314 } ) ;
316315 }
317316
318317 exit ( callback , ...args ) {
319318 if ( ! this . enabled ) {
320- return callback ( ... args ) ;
319+ return ReflectApply ( callback , null , args ) ;
321320 }
322321 this . disable ( ) ;
323322 try {
324- return callback ( ... args ) ;
323+ return ReflectApply ( callback , null , args ) ;
325324 } finally {
326325 this . _enable ( ) ;
327326 }
0 commit comments