v8 12.4.254 (node 22.4.1)
V8 is Google's open source JavaScript engine
|
#include <v8-local-handle.h>
Public Member Functions | |
V8_INLINE | MaybeLocal () |
template<class S > | |
V8_INLINE | MaybeLocal (Local< S > that) |
V8_INLINE bool | IsEmpty () const |
template<class S > | |
V8_WARN_UNUSED_RESULT V8_INLINE bool | ToLocal (Local< S > *out) const |
V8_INLINE Local< T > | ToLocalChecked () |
template<class S > | |
V8_INLINE Local< S > | FromMaybe (Local< S > default_value) const |
template<class S > | |
V8_INLINE MaybeLocal< S > | As () const |
Static Public Member Functions | |
template<class S > | |
static V8_INLINE MaybeLocal< T > | Cast (MaybeLocal< S > that) |
Friends | |
template<typename S > | |
class | MaybeLocal |
A MaybeLocal<> is a wrapper around Local<> that enforces a check whether the Local<> is empty before it can be used.
If an API method returns a MaybeLocal<>, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a TerminateExecution exception was thrown. In that case, an empty MaybeLocal is returned.
Definition at line 616 of file v8-local-handle.h.
|
inline |
Definition at line 618 of file v8-local-handle.h.
Definition at line 620 of file v8-local-handle.h.
Calling this is equivalent to MaybeLocal<S>::Cast(). In particular, this is only valid if the handle actually refers to a value of the target type.
Definition at line 674 of file v8-local-handle.h.
References MaybeLocal< T >::Cast().
|
inlinestatic |
Cast a handle to a subclass, e.g. MaybeLocal<Value> to MaybeLocal<Object>. This is only valid if the handle actually refers to a value of the target type.
Definition at line 658 of file v8-local-handle.h.
References MaybeLocal< T >::IsEmpty().
Referenced by MaybeLocal< T >::As().
|
inline |
Converts this MaybeLocal<> to a Local<>, using a default value if this MaybeLocal<> is empty.
Definition at line 648 of file v8-local-handle.h.
References MaybeLocal< T >::IsEmpty().
Referenced by EscapableHandleScope::EscapeMaybe().
|
inline |
Definition at line 622 of file v8-local-handle.h.
Referenced by MaybeLocal< T >::Cast(), MaybeLocal< T >::FromMaybe(), MaybeLocal< T >::ToLocal(), and MaybeLocal< T >::ToLocalChecked().
|
inline |
Converts this MaybeLocal<> to a Local<>. If this MaybeLocal<> is empty, |false| is returned and |out| is assigned with nullptr.
Definition at line 629 of file v8-local-handle.h.
References MaybeLocal< T >::IsEmpty().
Converts this MaybeLocal<> to a Local<>. If this MaybeLocal<> is empty, V8 will crash the process.
Definition at line 638 of file v8-local-handle.h.
References MaybeLocal< T >::IsEmpty(), v8::api_internal::ToLocalEmpty(), and V8_UNLIKELY.
Definition at line 682 of file v8-local-handle.h.