Clean up empty logic
This commit is contained in:
parent
57f934a806
commit
bdbc6bb165
1 changed files with 4 additions and 9 deletions
|
@ -24,19 +24,14 @@ v8::Local<v8::Value> CallMethodWithArgs(v8::Isolate* isolate,
|
||||||
args->size(),
|
args->size(),
|
||||||
&args->front(), {0, 0});
|
&args->front(), {0, 0});
|
||||||
// If the JS function throws an exception (doesn't return a value) the result
|
// If the JS function throws an exception (doesn't return a value) the result
|
||||||
// of MakeCallback will be empty, in this case we need to return "false" as
|
// of MakeCallback will be empty and therefore ToLocal will be false, in this
|
||||||
// that indicates that the event emitter did not handle the event
|
// case we need to return "false" as that indicates that the event emitter did
|
||||||
if (ret.IsEmpty()) {
|
// not handle the event
|
||||||
return v8::Boolean::New(isolate, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
v8::Local<v8::Value> localRet;
|
v8::Local<v8::Value> localRet;
|
||||||
if (ret.ToLocal(&localRet)) {
|
if (ret.ToLocal(&localRet)) {
|
||||||
return localRet;
|
return localRet;
|
||||||
}
|
}
|
||||||
// Should be unreachable, but the compiler complains if we don't check
|
return v8::Boolean::New(isolate, false);
|
||||||
// the result of ToLocal
|
|
||||||
return v8::Undefined(isolate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
Loading…
Reference in a new issue