Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: avoid ReflectApply ugliness
  • Loading branch information
apapirovski committed Jun 6, 2019
commit dcb367596cdc310376c9f629de2c782576438fc9
5 changes: 3 additions & 2 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const { Reflect } = primordials;
const ReflectApply = Reflect.apply;

const {
ERR_ASYNC_CALLBACK,
Expand Down Expand Up @@ -169,7 +168,9 @@ class AsyncResource {
const asyncId = this[async_id_symbol];
emitBefore(asyncId, this[trigger_async_id_symbol]);
try {
return ReflectApply(fn, thisArg, args);
if (thisArg === undefined)
return fn(...args);
return Reflect.apply(fn, thisArg, args);
} finally {
emitAfter(asyncId);
}
Expand Down