Coverage Report

Created: 2025-10-31 09:06

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/node/deps/v8/include/v8-maybe.h
Line
Count
Source
1
// Copyright 2021 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef INCLUDE_V8_MAYBE_H_
6
#define INCLUDE_V8_MAYBE_H_
7
8
#include <type_traits>
9
#include <utility>
10
11
#include "cppgc/internal/conditional-stack-allocated.h"  // NOLINT(build/include_directory)
12
#include "v8-internal.h"  // NOLINT(build/include_directory)
13
#include "v8config.h"     // NOLINT(build/include_directory)
14
15
namespace v8 {
16
17
namespace internal {
18
struct NullMaybeType {};
19
20
constexpr NullMaybeType kNullMaybe;
21
}  // namespace internal
22
23
namespace api_internal {
24
// Called when ToChecked is called on an empty Maybe.
25
V8_EXPORT void FromJustIsNothing();
26
}  // namespace api_internal
27
28
/**
29
 * A simple Maybe type, representing an object which may or may not have a
30
 * value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html.
31
 *
32
 * If an API method returns a Maybe<>, the API method can potentially fail
33
 * either because an exception is thrown, or because an exception is pending,
34
 * e.g. because a previous API call threw an exception that hasn't been caught
35
 * yet, or because a TerminateExecution exception was thrown. In that case, a
36
 * "Nothing" value is returned.
37
 */
38
template <class T>
39
class Maybe : public cppgc::internal::ConditionalStackAllocatedBase<T> {
40
 public:
41
0
  constexpr Maybe() = default;
Unexecuted instantiation: v8::Maybe<bool>::Maybe()
Unexecuted instantiation: v8::Maybe<node::ExitCode>::Maybe()
Unexecuted instantiation: v8::Maybe<int>::Maybe()
Unexecuted instantiation: v8::Maybe<node::loader::ModuleWrap*>::Maybe()
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::Maybe()
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Maybe()
Unexecuted instantiation: v8::Maybe<unsigned int>::Maybe()
Unexecuted instantiation: v8::Maybe<uv_stream_s*>::Maybe()
Unexecuted instantiation: v8::Maybe<node::StreamPipe*>::Maybe()
Unexecuted instantiation: v8::Maybe<unsigned long>::Maybe()
Unexecuted instantiation: v8::Maybe<double>::Maybe()
Unexecuted instantiation: v8::Maybe<ncrypto::EVPKeyPointer::PrivateKeyEncodingConfig>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options>::Maybe()
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo>::Maybe()
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::Store>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options>::Maybe()
42
43
  V8_INLINE Maybe(internal::NullMaybeType) {}
44
45
83.4k
  V8_INLINE bool IsNothing() const { return !has_value_; }
v8::Maybe<bool>::IsNothing() const
Line
Count
Source
45
83.4k
  V8_INLINE bool IsNothing() const { return !has_value_; }
Unexecuted instantiation: v8::Maybe<node::ExitCode>::IsNothing() const
Unexecuted instantiation: v8::Maybe<int>::IsNothing() const
Unexecuted instantiation: v8::Maybe<node::StreamPipe*>::IsNothing() const
46
32.2k
  V8_INLINE bool IsJust() const { return has_value_; }
v8::Maybe<bool>::IsJust() const
Line
Count
Source
46
32.0k
  V8_INLINE bool IsJust() const { return has_value_; }
Unexecuted instantiation: v8::Maybe<unsigned long>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::ExitCode>::IsJust() const
Unexecuted instantiation: v8::Maybe<double>::IsJust() const
Unexecuted instantiation: v8::Maybe<unsigned int>::IsJust() const
v8::Maybe<long>::IsJust() const
Line
Count
Source
46
140
  V8_INLINE bool IsJust() const { return has_value_; }
Unexecuted instantiation: v8::Maybe<node::loader::ModuleWrap*>::IsJust() const
Unexecuted instantiation: v8::Maybe<int>::IsJust() const
Unexecuted instantiation: v8::Maybe<v8::PropertyAttribute>::IsJust() const
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::IsJust() const
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::IsJust() const
Unexecuted instantiation: v8::Maybe<uv_stream_s*>::IsJust() const
Unexecuted instantiation: v8::Maybe<ncrypto::EVPKeyPointer::AsymmetricKeyEncodingConfig>::IsJust() const
Unexecuted instantiation: v8::Maybe<ncrypto::EVPKeyPointer::PrivateKeyEncodingConfig>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::Store>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::PreferredAddress::Policy>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo>::IsJust() const
47
48
  /**
49
   * Same as IsNothing(). It's useful for unified handling of empty states
50
   * with v8::MaybeLocal<T>.
51
   */
52
  V8_INLINE bool IsEmpty() const { return IsNothing(); }
53
54
  /**
55
   * An alias for |FromJust|. Will crash if the Maybe<> is nothing.
56
   */
57
70
  V8_INLINE T ToChecked() const { return FromJust(); }
v8::Maybe<bool>::ToChecked() const
Line
Count
Source
57
70
  V8_INLINE T ToChecked() const { return FromJust(); }
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::ToChecked() const
Unexecuted instantiation: v8::Maybe<long>::ToChecked() const
58
59
  /**
60
   * Short-hand for ToChecked(), which doesn't return a value. To be used, where
61
   * the actual value of the Maybe is not needed like Object::Set.
62
   */
63
27.7k
  V8_INLINE void Check() const {
64
27.7k
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
65
27.7k
  }
66
67
  /**
68
   * Converts this Maybe<> to a value of type T. If this Maybe<> is
69
   * nothing (empty), |false| is returned and |out| is left untouched.
70
   */
71
70
  V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
72
70
    if (V8_LIKELY(IsJust())) *out = value_;
73
70
    return IsJust();
74
70
  }
Unexecuted instantiation: v8::Maybe<unsigned long>::To(unsigned long*) const
Unexecuted instantiation: v8::Maybe<unsigned int>::To(unsigned int*) const
v8::Maybe<long>::To(long*) const
Line
Count
Source
71
70
  V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
72
70
    if (V8_LIKELY(IsJust())) *out = value_;
73
70
    return IsJust();
74
70
  }
Unexecuted instantiation: v8::Maybe<node::loader::ModuleWrap*>::To(node::loader::ModuleWrap**) const
Unexecuted instantiation: v8::Maybe<int>::To(int*) const
Unexecuted instantiation: v8::Maybe<v8::PropertyAttribute>::To(v8::PropertyAttribute*) const
Unexecuted instantiation: v8::Maybe<bool>::To(bool*) const
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::To(std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > >*) const
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::To(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) const
Unexecuted instantiation: v8::Maybe<double>::To(double*) const
Unexecuted instantiation: v8::Maybe<uv_stream_s*>::To(uv_stream_s**) const
Unexecuted instantiation: v8::Maybe<ncrypto::EVPKeyPointer::AsymmetricKeyEncodingConfig>::To(ncrypto::EVPKeyPointer::AsymmetricKeyEncodingConfig*) const
Unexecuted instantiation: v8::Maybe<ncrypto::EVPKeyPointer::PrivateKeyEncodingConfig>::To(ncrypto::EVPKeyPointer::PrivateKeyEncodingConfig*) const
Unexecuted instantiation: v8::Maybe<node::quic::Store>::To(node::quic::Store*) const
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options>::To(node::quic::Endpoint::Options*) const
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options>::To(node::quic::Session::Options*) const
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket>::To(node::quic::SessionTicket*) const
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options>::To(node::quic::Session::Application_Options*) const
Unexecuted instantiation: v8::Maybe<node::quic::PreferredAddress::Policy>::To(node::quic::PreferredAddress::Policy*) const
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options>::To(node::quic::TransportParams::Options*) const
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options>::To(node::quic::TLSContext::Options*) const
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo>::To(ngtcp2_cc_algo*) const
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::To(std::__1::shared_ptr<node::DataQueue>*) const
75
76
  /**
77
   * Converts this Maybe<> to a value of type T, moving out of it. If this
78
   * Maybe<> is nothing (empty), |false| is returned and |out| is left
79
   * untouched.
80
   */
81
  V8_WARN_UNUSED_RESULT V8_INLINE bool MoveTo(T* out) && {
82
    if (V8_LIKELY(IsJust())) *out = std::move(value_);
83
    return IsJust();
84
  }
85
86
  /**
87
   * Converts this Maybe<> to a value of type T. If this Maybe<> is
88
   * nothing (empty), V8 will crash the process.
89
   */
90
140
  V8_INLINE T FromJust() const& {
91
140
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
92
140
    return value_;
93
140
  }
v8::Maybe<bool>::FromJust() const &
Line
Count
Source
90
140
  V8_INLINE T FromJust() const& {
91
140
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
92
140
    return value_;
93
140
  }
Unexecuted instantiation: v8::Maybe<node::ExitCode>::FromJust() const &
Unexecuted instantiation: v8::Maybe<int>::FromJust() const &
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::FromJust() const &
Unexecuted instantiation: v8::Maybe<unsigned int>::FromJust() const &
Unexecuted instantiation: v8::Maybe<long>::FromJust() const &
94
95
  /**
96
   * Converts this Maybe<> to a value of type T. If this Maybe<> is
97
   * nothing (empty), V8 will crash the process.
98
   */
99
4.02k
  V8_INLINE T FromJust() && {
100
4.02k
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
101
4.02k
    return std::move(value_);
102
4.02k
  }
v8::Maybe<bool>::FromJust() &&
Line
Count
Source
99
4.02k
  V8_INLINE T FromJust() && {
100
4.02k
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
101
4.02k
    return std::move(value_);
102
4.02k
  }
Unexecuted instantiation: v8::Maybe<double>::FromJust() &&
Unexecuted instantiation: v8::Maybe<long>::FromJust() &&
Unexecuted instantiation: v8::Maybe<int>::FromJust() &&
Unexecuted instantiation: v8::Maybe<unsigned int>::FromJust() &&
103
104
  /**
105
   * Converts this Maybe<> to a value of type T, using a default value if this
106
   * Maybe<> is nothing (empty).
107
   */
108
188k
  V8_INLINE T FromMaybe(const T& default_value) const {
109
188k
    return has_value_ ? value_ : default_value;
110
188k
  }
v8::Maybe<bool>::FromMaybe(bool const&) const
Line
Count
Source
108
188k
  V8_INLINE T FromMaybe(const T& default_value) const {
109
188k
    return has_value_ ? value_ : default_value;
110
188k
  }
Unexecuted instantiation: v8::Maybe<int>::FromMaybe(int const&) const
Unexecuted instantiation: v8::Maybe<node::ExitCode>::FromMaybe(node::ExitCode const&) const
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::FromMaybe(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
Unexecuted instantiation: v8::Maybe<long>::FromMaybe(long const&) const
Unexecuted instantiation: v8::Maybe<unsigned long>::FromMaybe(unsigned long const&) const
111
112
  V8_INLINE bool operator==(const Maybe& other) const {
113
    return (IsJust() == other.IsJust()) &&
114
           (!IsJust() || FromJust() == other.FromJust());
115
  }
116
117
  V8_INLINE bool operator!=(const Maybe& other) const {
118
    return !operator==(other);
119
  }
120
121
 private:
122
0
  explicit Maybe(const T& t) : has_value_(true), value_(t) {}
Unexecuted instantiation: v8::Maybe<node::loader::ModuleWrap*>::Maybe(node::loader::ModuleWrap* const&)
Unexecuted instantiation: v8::Maybe<int>::Maybe(int const&)
Unexecuted instantiation: v8::Maybe<unsigned int>::Maybe(unsigned int const&)
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::Maybe(std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > const&)
Unexecuted instantiation: v8::Maybe<double>::Maybe(double const&)
Unexecuted instantiation: v8::Maybe<uv_stream_s*>::Maybe(uv_stream_s* const&)
Unexecuted instantiation: v8::Maybe<unsigned long>::Maybe(unsigned long const&)
Unexecuted instantiation: v8::Maybe<ncrypto::EVPKeyPointer::AsymmetricKeyEncodingConfig>::Maybe(ncrypto::EVPKeyPointer::AsymmetricKeyEncodingConfig const&)
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options>::Maybe(node::quic::Endpoint::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options>::Maybe(node::quic::Session::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options>::Maybe(node::quic::TLSContext::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options>::Maybe(node::quic::TransportParams::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options>::Maybe(node::quic::Session::Application_Options const&)
123
105
  explicit Maybe(T&& t) : has_value_(true), value_(std::move(t)) {}
v8::Maybe<bool>::Maybe(bool&&)
Line
Count
Source
123
105
  explicit Maybe(T&& t) : has_value_(true), value_(std::move(t)) {}
Unexecuted instantiation: v8::Maybe<node::ExitCode>::Maybe(node::ExitCode&&)
Unexecuted instantiation: v8::Maybe<int>::Maybe(int&&)
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::Maybe(std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > >&&)
Unexecuted instantiation: v8::Maybe<unsigned int>::Maybe(unsigned int&&)
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Maybe(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&)
Unexecuted instantiation: v8::Maybe<node::StreamPipe*>::Maybe(node::StreamPipe*&&)
Unexecuted instantiation: v8::Maybe<unsigned long>::Maybe(unsigned long&&)
Unexecuted instantiation: v8::Maybe<double>::Maybe(double&&)
Unexecuted instantiation: v8::Maybe<ncrypto::EVPKeyPointer::PrivateKeyEncodingConfig>::Maybe(ncrypto::EVPKeyPointer::PrivateKeyEncodingConfig&&)
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options>::Maybe(node::quic::Endpoint::Options&&)
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo>::Maybe(ngtcp2_cc_algo&&)
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::Maybe(std::__1::shared_ptr<node::DataQueue>&&)
Unexecuted instantiation: v8::Maybe<node::quic::Store>::Maybe(node::quic::Store&&)
Unexecuted instantiation: v8::Maybe<node::quic::PreferredAddress::Policy>::Maybe(node::quic::PreferredAddress::Policy&&)
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket>::Maybe(node::quic::SessionTicket&&)
124
125
  bool has_value_ = false;
126
  T value_;
127
128
  template <class U>
129
  friend Maybe<U> Just(const U& u);
130
  template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
131
  friend Maybe<U> Just(U&& u);
132
};
133
134
template <class T>
135
0
inline constexpr Maybe<T> Nothing() {
136
0
  return {};
137
0
}
Unexecuted instantiation: v8::Maybe<void> v8::Nothing<void>()
Unexecuted instantiation: v8::Maybe<bool> v8::Nothing<bool>()
Unexecuted instantiation: v8::Maybe<node::ExitCode> v8::Nothing<node::ExitCode>()
Unexecuted instantiation: v8::Maybe<int> v8::Nothing<int>()
Unexecuted instantiation: v8::Maybe<node::loader::ModuleWrap*> v8::Nothing<node::loader::ModuleWrap*>()
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > > v8::Nothing<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >()
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > v8::Nothing<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >()
Unexecuted instantiation: v8::Maybe<unsigned int> v8::Nothing<unsigned int>()
Unexecuted instantiation: v8::Maybe<uv_stream_s*> v8::Nothing<uv_stream_s*>()
Unexecuted instantiation: v8::Maybe<node::StreamPipe*> v8::Nothing<node::StreamPipe*>()
Unexecuted instantiation: v8::Maybe<unsigned long> v8::Nothing<unsigned long>()
Unexecuted instantiation: v8::Maybe<double> v8::Nothing<double>()
Unexecuted instantiation: v8::Maybe<ncrypto::EVPKeyPointer::PrivateKeyEncodingConfig> v8::Nothing<ncrypto::EVPKeyPointer::PrivateKeyEncodingConfig>()
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options> v8::Nothing<node::quic::Endpoint::Options>()
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options> v8::Nothing<node::quic::Session::Options>()
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo> v8::Nothing<ngtcp2_cc_algo>()
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> > v8::Nothing<std::__1::shared_ptr<node::DataQueue> >()
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options> v8::Nothing<node::quic::TLSContext::Options>()
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options> v8::Nothing<node::quic::TransportParams::Options>()
Unexecuted instantiation: v8::Maybe<node::quic::Store> v8::Nothing<node::quic::Store>()
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket> v8::Nothing<node::quic::SessionTicket>()
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options> v8::Nothing<node::quic::Session::Application_Options>()
138
139
template <class T>
140
0
inline Maybe<T> Just(const T& t) {
141
0
  return Maybe<T>(t);
142
0
}
Unexecuted instantiation: v8::Maybe<node::loader::ModuleWrap*> v8::Just<node::loader::ModuleWrap*>(node::loader::ModuleWrap* const&)
Unexecuted instantiation: v8::Maybe<int> v8::Just<int>(int const&)
Unexecuted instantiation: v8::Maybe<unsigned int> v8::Just<unsigned int>(unsigned int const&)
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > > v8::Just<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >(std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > const&)
Unexecuted instantiation: v8::Maybe<double> v8::Just<double>(double const&)
Unexecuted instantiation: v8::Maybe<uv_stream_s*> v8::Just<uv_stream_s*>(uv_stream_s* const&)
Unexecuted instantiation: v8::Maybe<unsigned long> v8::Just<unsigned long>(unsigned long const&)
Unexecuted instantiation: v8::Maybe<ncrypto::EVPKeyPointer::AsymmetricKeyEncodingConfig> v8::Just<ncrypto::EVPKeyPointer::AsymmetricKeyEncodingConfig>(ncrypto::EVPKeyPointer::AsymmetricKeyEncodingConfig const&)
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options> v8::Just<node::quic::Endpoint::Options>(node::quic::Endpoint::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options> v8::Just<node::quic::Session::Options>(node::quic::Session::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options> v8::Just<node::quic::TLSContext::Options>(node::quic::TLSContext::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options> v8::Just<node::quic::TransportParams::Options>(node::quic::TransportParams::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options> v8::Just<node::quic::Session::Application_Options>(node::quic::Session::Application_Options const&)
143
144
// Don't use forwarding references here but instead use two overloads.
145
// Forwarding references only work when type deduction takes place, which is not
146
// the case for callsites such as Just<Type>(t).
147
template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
148
105
inline Maybe<T> Just(T&& t) {
149
105
  return Maybe<T>(std::move(t));
150
105
}
_ZN2v84JustIbTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS3_EEOS3_
Line
Count
Source
148
105
inline Maybe<T> Just(T&& t) {
149
105
  return Maybe<T>(std::move(t));
150
105
}
Unexecuted instantiation: _ZN2v84JustIN4node8ExitCodeETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS5_EEOS5_
Unexecuted instantiation: _ZN2v84JustIiTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS3_EEOS3_
Unexecuted instantiation: _ZN2v84JustINSt3__16vectorIN4node17BaseObjectPtrImplINS3_10BaseObjectELb0EEENS1_9allocatorIS6_EEEETnPNS1_9enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeISB_EEOSB_
Unexecuted instantiation: _ZN2v84JustIjTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS3_EEOS3_
Unexecuted instantiation: _ZN2v84JustINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEETnPNS1_9enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS9_EEOS9_
Unexecuted instantiation: _ZN2v84JustIPN4node10StreamPipeETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS6_EEOS6_
Unexecuted instantiation: _ZN2v84JustImTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS3_EEOS3_
Unexecuted instantiation: _ZN2v84JustIdTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS3_EEOS3_
Unexecuted instantiation: _ZN2v84JustIN7ncrypto13EVPKeyPointer24PrivateKeyEncodingConfigETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS6_EEOS6_
Unexecuted instantiation: _ZN2v84JustIN4node4quic8Endpoint7OptionsETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS7_EEOS7_
Unexecuted instantiation: _ZN2v84JustI14ngtcp2_cc_algoTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS4_EEOS4_
Unexecuted instantiation: _ZN2v84JustINSt3__110shared_ptrIN4node9DataQueueEEETnPNS1_9enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS7_EEOS7_
Unexecuted instantiation: _ZN2v84JustIN4node4quic5StoreETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS6_EEOS6_
Unexecuted instantiation: _ZN2v84JustIN4node4quic16PreferredAddress6PolicyETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS7_EEOS7_
Unexecuted instantiation: _ZN2v84JustIN4node4quic13SessionTicketETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS6_EEOS6_
151
152
// A template specialization of Maybe<T> for the case of T = void.
153
template <>
154
class Maybe<void> {
155
 public:
156
0
  constexpr Maybe() = default;
157
0
  constexpr Maybe(internal::NullMaybeType) {}
158
159
140
  V8_INLINE bool IsNothing() const { return !is_valid_; }
160
0
  V8_INLINE bool IsEmpty() const { return IsNothing(); }
161
0
  V8_INLINE bool IsJust() const { return is_valid_; }
162
163
0
  V8_INLINE bool operator==(const Maybe& other) const {
164
0
    return IsJust() == other.IsJust();
165
0
  }
166
167
0
  V8_INLINE bool operator!=(const Maybe& other) const {
168
0
    return !operator==(other);
169
0
  }
170
171
 private:
172
  struct JustTag {};
173
174
140
  explicit Maybe(JustTag) : is_valid_(true) {}
175
176
  bool is_valid_ = false;
177
178
  friend Maybe<void> JustVoid();
179
};
180
181
140
inline Maybe<void> JustVoid() { return Maybe<void>(Maybe<void>::JustTag()); }
182
183
}  // namespace v8
184
185
#endif  // INCLUDE_V8_MAYBE_H_