Commit 4a99e6f4 authored by dcarney's avatar dcarney Committed by Commit bot

add missing dcheck to ToLocalChecked

R=svenpanne@chromium.org
BUG=v8:3929
LOG=n

Review URL: https://codereview.chromium.org/1017663002

Cr-Commit-Position: refs/heads/master@{#27229}
parent 140b40c2
......@@ -429,10 +429,7 @@ class MaybeLocal {
return !IsEmpty();
}
V8_INLINE Local<T> ToLocalChecked() {
// TODO(dcarney): add DCHECK.
return Local<T>(val_);
}
V8_INLINE Local<T> ToLocalChecked();
template <class S>
V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
......@@ -5893,10 +5890,13 @@ class V8_EXPORT V8 {
static Local<Value> GetEternal(Isolate* isolate, int index);
static void CheckIsJust(bool is_just);
static void ToLocalEmpty();
template <class T> friend class Handle;
template <class T> friend class Local;
template <class T>
friend class MaybeLocal;
template <class T>
friend class Maybe;
template <class T> friend class Eternal;
template <class T> friend class PersistentBase;
......@@ -6725,6 +6725,15 @@ Local<T> Eternal<T>::Get(Isolate* isolate) {
}
template <class T>
Local<T> MaybeLocal<T>::ToLocalChecked() {
#ifdef V8_ENABLE_CHECKS
if (val_ == nullptr) V8::ToLocalEmpty();
#endif
return Local<T>(val_);
}
template <class T>
T* PersistentBase<T>::New(Isolate* isolate, T* that) {
if (that == NULL) return NULL;
......
......@@ -617,6 +617,11 @@ void V8::CheckIsJust(bool is_just) {
}
void V8::ToLocalEmpty() {
Utils::ApiCheck(false, "v8::ToLocalChecked", "Empty MaybeLocal.");
}
// --- H a n d l e s ---
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment