Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index db625eeb4242be3d594628fdf8f2f450d0ef894e..10152f60e93eb51cf487522c1f65a156f9e48070 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -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; |
@@ -6726,6 +6726,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; |
internal::Object** p = reinterpret_cast<internal::Object**>(that); |