@auto_js/napi 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +1 -1
- package/README.md +8 -8
- package/_module.cc +3 -2
- package/api/finalizer.cc +1 -1
- package/api/threadsafe_function.cc +3 -6
- package/api/uv_scheduler.h.cc +1 -1
- package/handle/local.cc +112 -0
- package/handle/reference.cc +3 -3
- package/handle/remote.cc +10 -10
- package/handle/types.cc +9 -142
- package/handle/value.cc +122 -30
- package/package.json +4 -4
- package/support/callback.cc +12 -12
- package/support/callback_storage.cc +2 -2
- package/support/class_template_storage.cc +3 -3
- package/support/host.cc +41 -37
- package/support/host.h.cc +11 -11
- package/support/initialize.h.cc +3 -3
- package/support/promise.cc +2 -2
- package/support/string_table.cc +1 -1
- package/transfer/accept.cc +34 -34
- package/transfer/accept.h.cc +91 -75
- package/transfer/visit.cc +121 -78
- package/value/array.cc +5 -7
- package/value/array.h.cc +7 -7
- package/value/array_buffer.cc +26 -29
- package/value/array_buffer.h.cc +50 -52
- package/value/class.cc +9 -10
- package/value/class.h.cc +5 -5
- package/value/external.cc +9 -11
- package/value/function.cc +7 -7
- package/value/function.h.cc +2 -2
- package/value/object.cc +5 -8
- package/value/object.h.cc +8 -15
- package/value/primitive.cc +7 -10
- package/value/primitive.h.cc +15 -15
- package/value/record.cc +6 -8
- package/value/record.h.cc +8 -8
- package/value/value.cc +3 -1
- package/handle/bound_value.cc +0 -47
package/transfer/accept.h.cc
CHANGED
|
@@ -15,8 +15,8 @@ struct reaccept_napi_value {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
template <class Tag>
|
|
18
|
-
constexpr auto operator()(std::type_identity<
|
|
19
|
-
return
|
|
18
|
+
constexpr auto operator()(std::type_identity<local_of<Tag>> /*type*/, napi_value value) const -> local_of<Tag> {
|
|
19
|
+
return local_of<Tag>::from(value);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -29,112 +29,118 @@ struct accept_basic_napi_value {
|
|
|
29
29
|
using accept_reference_type = reaccept_napi_value;
|
|
30
30
|
|
|
31
31
|
// undefined & null
|
|
32
|
-
auto operator()(undefined_tag tag, visit_holder visit, std::monostate subject) const ->
|
|
33
|
-
auto operator()(undefined_tag tag, visit_holder visit, const auto& /*subject*/) const ->
|
|
32
|
+
auto operator()(undefined_tag tag, visit_holder visit, std::monostate subject) const -> local_of<undefined_tag>;
|
|
33
|
+
auto operator()(undefined_tag tag, visit_holder visit, const auto& /*subject*/) const -> local_of<undefined_tag> {
|
|
34
34
|
return (*this)(tag, visit, std::monostate{});
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
auto operator()(null_tag tag, visit_holder visit, std::nullptr_t subject) const ->
|
|
38
|
-
auto operator()(null_tag tag, visit_holder visit, const auto& /*subject*/) const ->
|
|
37
|
+
auto operator()(null_tag tag, visit_holder visit, std::nullptr_t subject) const -> local_of<null_tag>;
|
|
38
|
+
auto operator()(null_tag tag, visit_holder visit, const auto& /*subject*/) const -> local_of<null_tag> {
|
|
39
39
|
return (*this)(tag, visit, nullptr);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// boolean
|
|
43
|
-
auto operator()(boolean_tag tag, visit_holder visit, bool subject) const ->
|
|
43
|
+
auto operator()(boolean_tag tag, visit_holder visit, bool subject) const -> local_of<boolean_tag>;
|
|
44
44
|
|
|
45
45
|
// number
|
|
46
|
-
auto operator()(number_tag_of<double> tag, visit_holder visit, double subject) const ->
|
|
47
|
-
auto operator()(number_tag_of<std::int32_t> tag, visit_holder visit, std::int32_t subject) const ->
|
|
48
|
-
auto operator()(number_tag_of<std::uint32_t> tag, visit_holder visit, std::uint32_t subject) const ->
|
|
46
|
+
auto operator()(number_tag_of<double> tag, visit_holder visit, double subject) const -> local_of<number_tag_of<double>>;
|
|
47
|
+
auto operator()(number_tag_of<std::int32_t> tag, visit_holder visit, std::int32_t subject) const -> local_of<number_tag_of<std::int32_t>>;
|
|
48
|
+
auto operator()(number_tag_of<std::uint32_t> tag, visit_holder visit, std::uint32_t subject) const -> local_of<number_tag_of<std::uint32_t>>;
|
|
49
49
|
|
|
50
|
-
auto operator()(number_tag /*tag*/, visit_holder visit, auto&& subject) const ->
|
|
50
|
+
auto operator()(number_tag /*tag*/, visit_holder visit, auto&& subject) const -> local_of<number_tag> {
|
|
51
51
|
return (*this)(number_tag_of<double>{}, visit, double{std::forward<decltype(subject)>(subject)});
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
template <class Type>
|
|
55
|
-
auto operator()(number_tag_of<Type> tag, visit_holder visit,
|
|
55
|
+
auto operator()(number_tag_of<Type> tag, visit_holder visit, Type subject) const -> local_of<number_tag_of<Type>> {
|
|
56
|
+
auto value = (*this)(tag, visit, std::int32_t{std::forward<decltype(subject)>(subject)});
|
|
57
|
+
return local_of<number_tag_of<Type>>::from(value);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
template <class Type>
|
|
61
|
+
auto operator()(number_tag_of<Type> tag, visit_holder visit, auto&& subject) const -> local_of<number_tag_of<Type>> {
|
|
56
62
|
return (*this)(tag, visit, Type{std::forward<decltype(subject)>(subject)});
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
// string
|
|
60
66
|
auto operator()(string_tag_of<char> tag, visit_holder visit, std::string_view subject) const
|
|
61
|
-
-> js::referenceable_value<
|
|
67
|
+
-> js::referenceable_value<local_of<string_tag_of<char>>>;
|
|
62
68
|
auto operator()(string_tag_of<char8_t> tag, visit_holder visit, std::u8string_view subject) const
|
|
63
|
-
-> js::referenceable_value<
|
|
69
|
+
-> js::referenceable_value<local_of<string_tag_of<char8_t>>>;
|
|
64
70
|
auto operator()(string_tag_of<char16_t> tag, visit_holder visit, std::u16string_view subject) const
|
|
65
|
-
-> js::referenceable_value<
|
|
71
|
+
-> js::referenceable_value<local_of<string_tag_of<char16_t>>>;
|
|
66
72
|
|
|
67
73
|
auto operator()(string_tag /*tag*/, visit_holder visit, auto&& subject) const
|
|
68
|
-
-> js::referenceable_value<
|
|
74
|
+
-> js::referenceable_value<local_of<string_tag>> {
|
|
69
75
|
auto value = (*this)(string_tag_of<char16_t>{}, visit, std::u16string_view{std::forward<decltype(subject)>(subject)});
|
|
70
|
-
return js::referenceable_value{
|
|
76
|
+
return js::referenceable_value{local_of<string_tag>{*value}};
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
template <class Char>
|
|
74
80
|
auto operator()(string_tag_of<Char> tag, visit_holder visit, std::convertible_to<std::basic_string_view<Char>> auto&& subject) const
|
|
75
|
-
-> js::referenceable_value<
|
|
81
|
+
-> js::referenceable_value<local_of<string_tag_of<Char>>> {
|
|
76
82
|
return (*this)(tag, visit, std::basic_string_view<Char>{std::forward<decltype(subject)>(subject)});
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
template <class Char>
|
|
80
86
|
auto operator()(string_tag_of<Char> tag, visit_holder visit, auto&& subject) const
|
|
81
|
-
-> js::referenceable_value<
|
|
87
|
+
-> js::referenceable_value<local_of<string_tag_of<Char>>> {
|
|
82
88
|
return (*this)(tag, visit, std::basic_string<Char>{std::forward<decltype(subject)>(subject)});
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
// bigint
|
|
86
92
|
auto operator()(bigint_tag_of<std::int64_t> tag, visit_holder visit, std::int64_t subject) const
|
|
87
|
-
-> js::referenceable_value<
|
|
93
|
+
-> js::referenceable_value<local_of<bigint_tag_of<std::int64_t>>>;
|
|
88
94
|
auto operator()(bigint_tag_of<std::uint64_t> tag, visit_holder visit, std::uint64_t subject) const
|
|
89
|
-
-> js::referenceable_value<
|
|
95
|
+
-> js::referenceable_value<local_of<bigint_tag_of<std::uint64_t>>>;
|
|
90
96
|
auto operator()(bigint_tag_of<js::bigint> tag, visit_holder visit, const js::bigint& subject) const
|
|
91
|
-
-> js::referenceable_value<
|
|
97
|
+
-> js::referenceable_value<local_of<bigint_tag_of<js::bigint>>>;
|
|
92
98
|
auto operator()(bigint_tag_of<js::bigint> tag, visit_holder visit, js::bigint&& subject) const
|
|
93
|
-
-> js::referenceable_value<
|
|
99
|
+
-> js::referenceable_value<local_of<bigint_tag_of<js::bigint>>>;
|
|
94
100
|
|
|
95
101
|
auto operator()(bigint_tag /*tag*/, visit_holder visit, auto&& subject) const
|
|
96
|
-
-> js::referenceable_value<
|
|
102
|
+
-> js::referenceable_value<local_of<bigint_tag>> {
|
|
97
103
|
auto value = (*this)(bigint_tag_of<js::bigint>{}, visit, js::bigint{std::forward<decltype(subject)>(subject)});
|
|
98
|
-
return js::referenceable_value{
|
|
104
|
+
return js::referenceable_value{local_of<bigint_tag>{*value}};
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
template <class Type>
|
|
102
108
|
auto operator()(bigint_tag_of<Type> tag, visit_holder visit, auto&& subject) const
|
|
103
|
-
-> js::referenceable_value<
|
|
109
|
+
-> js::referenceable_value<local_of<bigint_tag_of<Type>>> {
|
|
104
110
|
return (*this)(tag, visit, Type{std::forward<decltype(subject)>(subject)});
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
// date
|
|
108
114
|
auto operator()(date_tag tag, visit_holder /*visit*/, js_clock::time_point subject) const
|
|
109
|
-
-> js::referenceable_value<
|
|
115
|
+
-> js::referenceable_value<local_of<date_tag>>;
|
|
110
116
|
|
|
111
117
|
// error
|
|
112
118
|
auto operator()(error_tag /*tag*/, visit_holder visit, const js::error_value& subject) const
|
|
113
|
-
-> js::referenceable_value<
|
|
119
|
+
-> js::referenceable_value<local_of<error_tag>>;
|
|
114
120
|
|
|
115
121
|
auto operator()(error_tag tag, visit_holder visit, const auto& subject) const
|
|
116
|
-
-> js::referenceable_value<
|
|
122
|
+
-> js::referenceable_value<local_of<error_tag>> {
|
|
117
123
|
return (*this)(tag, visit, js::error_value{subject});
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
// data blocks (array buffer, shared array buffer)
|
|
121
127
|
auto operator()(array_buffer_tag tag, visit_holder visit, const js::array_buffer& subject) const
|
|
122
|
-
-> js::referenceable_value<
|
|
128
|
+
-> js::referenceable_value<local_of<array_buffer_tag>>;
|
|
123
129
|
auto operator()(shared_array_buffer_tag tag, visit_holder visit, js::shared_array_buffer&& subject) const
|
|
124
|
-
-> js::referenceable_value<
|
|
130
|
+
-> js::referenceable_value<local_of<shared_array_buffer_tag>>;
|
|
125
131
|
auto operator()(shared_array_buffer_tag tag, visit_holder visit, const js::shared_array_buffer& subject) const
|
|
126
|
-
-> js::referenceable_value<
|
|
132
|
+
-> js::referenceable_value<local_of<shared_array_buffer_tag>>;
|
|
127
133
|
|
|
128
134
|
// typed arrays & data view
|
|
129
135
|
template <std::convertible_to<array_buffer_view_tag> Tag>
|
|
130
136
|
auto operator()(this const auto& self, Tag /*tag*/, auto& visit, auto&& subject)
|
|
131
|
-
-> js::referenceable_value<
|
|
137
|
+
-> js::referenceable_value<local_of<Tag>> {
|
|
132
138
|
auto byte_offset = subject.byte_offset();
|
|
133
139
|
auto length = subject.size();
|
|
134
140
|
// TODO: We accept the nested `buffer` property as a `data_block` which means `make` needs to
|
|
135
141
|
// invoke `is_arraybuffer` on it again even though we knew what it was a moment ago.
|
|
136
|
-
auto buffer =
|
|
137
|
-
return js::referenceable_value{
|
|
142
|
+
auto buffer = local_of<data_block_tag>::from(visit(std::forward<decltype(subject)>(subject).buffer(), self));
|
|
143
|
+
return js::referenceable_value{local_of<Tag>::make(self.environment(), buffer, byte_offset, length)};
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
// extras
|
|
@@ -161,18 +167,18 @@ struct accept_napi_value : accept_basic_napi_value {
|
|
|
161
167
|
|
|
162
168
|
// function
|
|
163
169
|
template <class Callback>
|
|
164
|
-
auto operator()(function_prototype_tag /*tag*/, visit_holder /*visit*/, js::free_function<Callback> subject) const ->
|
|
165
|
-
return
|
|
170
|
+
auto operator()(function_prototype_tag /*tag*/, visit_holder /*visit*/, js::free_function<Callback> subject) const -> local_of<function_tag> {
|
|
171
|
+
return local_of<function_tag>::make(environment(), std::forward<decltype(subject)>(subject));
|
|
166
172
|
}
|
|
167
173
|
|
|
168
174
|
// vectors
|
|
169
175
|
auto operator()(this const auto& self, vector_tag /*tag*/, auto& visit, auto&& subject)
|
|
170
|
-
-> js::deferred_receiver<
|
|
176
|
+
-> js::deferred_receiver<local_of<vector_tag>, decltype(self), decltype(visit), decltype(subject)> {
|
|
171
177
|
auto [... size ] = util::maybe_range_size(subject, 0);
|
|
172
178
|
return {
|
|
173
|
-
|
|
179
|
+
local_of<vector_tag>::from(napi::invoke(napi_create_array_with_length, napi_env{self}, size...)),
|
|
174
180
|
std::forward_as_tuple(self, visit, std::forward<decltype(subject)>(subject)),
|
|
175
|
-
[](
|
|
181
|
+
[](local_of<vector_tag> array, auto& self, auto& visit, auto /*&&*/ subject) -> void {
|
|
176
182
|
int ii = 0;
|
|
177
183
|
auto&& range = util::into_range(std::forward<decltype(subject)>(subject));
|
|
178
184
|
for (auto&& element : util::forward_range(std::forward<decltype(range)>(range))) {
|
|
@@ -185,13 +191,13 @@ struct accept_napi_value : accept_basic_napi_value {
|
|
|
185
191
|
|
|
186
192
|
template <std::size_t Size>
|
|
187
193
|
auto operator()(this const auto& self, tuple_tag<Size> /*tag*/, auto& visit, auto&& subject)
|
|
188
|
-
-> js::deferred_receiver<
|
|
194
|
+
-> js::deferred_receiver<local_of<vector_tag>, decltype(self), decltype(visit), decltype(subject)> {
|
|
189
195
|
return {
|
|
190
|
-
|
|
196
|
+
local_of<vector_tag>::from(napi::invoke(napi_create_array_with_length, napi_env{self}, Size)),
|
|
191
197
|
std::forward_as_tuple(self, visit, std::forward<decltype(subject)>(subject)),
|
|
192
|
-
[](
|
|
193
|
-
|
|
194
|
-
(..., [ & ]
|
|
198
|
+
[](local_of<vector_tag> array, auto& self, auto& visit, auto /*&&*/ tuple) -> void {
|
|
199
|
+
constexpr auto [... indices ] = util::sequence<Size>;
|
|
200
|
+
(..., [ & ] -> void {
|
|
195
201
|
// nb: This is forwarded to *each* visitor. The visitor should be aware and only lvalue
|
|
196
202
|
// reference members one at a time.
|
|
197
203
|
auto* element = napi_value{visit(indices, std::forward<decltype(tuple)>(tuple), self)};
|
|
@@ -203,28 +209,28 @@ struct accept_napi_value : accept_basic_napi_value {
|
|
|
203
209
|
|
|
204
210
|
// arrays & dictionaries
|
|
205
211
|
auto operator()(this const auto& self, list_tag /*tag*/, auto& visit, auto&& subject)
|
|
206
|
-
-> js::deferred_receiver<
|
|
212
|
+
-> js::deferred_receiver<local_of<list_tag>, decltype(self), decltype(visit), decltype(subject)> {
|
|
207
213
|
return {
|
|
208
|
-
|
|
214
|
+
local_of<list_tag>::from(napi::invoke(napi_create_array, napi_env{self})),
|
|
209
215
|
std::forward_as_tuple(self, visit, std::forward<decltype(subject)>(subject)),
|
|
210
|
-
[](
|
|
216
|
+
[](local_of<list_tag> array, auto& self, auto& visit, auto /*&&*/ subject) -> void {
|
|
211
217
|
self.accept_entry_pair_vector(visit, array, std::forward<decltype(subject)>(subject));
|
|
212
218
|
}
|
|
213
219
|
};
|
|
214
220
|
}
|
|
215
221
|
|
|
216
222
|
auto operator()(this const auto& self, dictionary_tag /*tag*/, auto& visit, auto&& subject)
|
|
217
|
-
-> js::deferred_receiver<
|
|
223
|
+
-> js::deferred_receiver<local_of<dictionary_tag>, decltype(self), decltype(visit), decltype(subject)> {
|
|
218
224
|
return {
|
|
219
|
-
|
|
225
|
+
local_of<dictionary_tag>::from(napi::invoke(napi_create_object, napi_env{self})),
|
|
220
226
|
std::forward_as_tuple(self, visit, std::forward<decltype(subject)>(subject)),
|
|
221
|
-
[](
|
|
227
|
+
[](local_of<dictionary_tag> object, auto& self, auto& visit, auto /*&&*/ subject) -> void {
|
|
222
228
|
self.accept_entry_pair_vector(visit, object, std::forward<decltype(subject)>(subject));
|
|
223
229
|
}
|
|
224
230
|
};
|
|
225
231
|
}
|
|
226
232
|
|
|
227
|
-
auto accept_entry_pair_vector(this const auto& self, auto& visit,
|
|
233
|
+
auto accept_entry_pair_vector(this const auto& self, auto& visit, local_of<object_tag> target, auto&& subject) -> void {
|
|
228
234
|
std::vector<napi_property_descriptor> properties;
|
|
229
235
|
auto&& range = util::into_range(std::forward<decltype(subject)>(subject));
|
|
230
236
|
properties.reserve(std::size(range));
|
|
@@ -234,7 +240,7 @@ struct accept_napi_value : accept_basic_napi_value {
|
|
|
234
240
|
.utf8name{},
|
|
235
241
|
// TODO: `napi_define_properties` only works with string keys but the nested acceptor will
|
|
236
242
|
// accept indexed properties as numeric napi values. `visit.first` should be invoked
|
|
237
|
-
// against something that maybe resolves to `std::variant<int32_t,
|
|
243
|
+
// against something that maybe resolves to `std::variant<int32_t, local_of<name_tag>>`.
|
|
238
244
|
.name = napi::invoke(napi_coerce_to_string, napi_env{self}, name),
|
|
239
245
|
|
|
240
246
|
.method{},
|
|
@@ -253,22 +259,22 @@ struct accept_napi_value : accept_basic_napi_value {
|
|
|
253
259
|
// structs
|
|
254
260
|
template <std::size_t Size>
|
|
255
261
|
auto operator()(this const auto& self, struct_tag<Size> /*tag*/, auto& visit, auto&& subject)
|
|
256
|
-
-> js::deferred_receiver<
|
|
262
|
+
-> js::deferred_receiver<local_of<dictionary_tag>, decltype(self), decltype(visit), decltype(subject)> {
|
|
257
263
|
return {
|
|
258
|
-
|
|
264
|
+
local_of<dictionary_tag>::from(napi::invoke(napi_create_object, napi_env{self})),
|
|
259
265
|
std::forward_as_tuple(self, visit, std::forward<decltype(subject)>(subject)),
|
|
260
|
-
[](
|
|
266
|
+
[](local_of<dictionary_tag> object, auto& self, auto& visit, auto /*&&*/ subject) -> void {
|
|
261
267
|
self.template accept_entry_pair_struct<Size>(visit, object, std::forward<decltype(subject)>(subject));
|
|
262
268
|
}
|
|
263
269
|
};
|
|
264
270
|
}
|
|
265
271
|
|
|
266
272
|
template <std::size_t Size>
|
|
267
|
-
auto accept_entry_pair_struct(this const auto& self, auto& visit,
|
|
273
|
+
auto accept_entry_pair_struct(this const auto& self, auto& visit, local_of<object_tag> target, auto&& subject) -> void {
|
|
268
274
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
|
269
275
|
std::array<napi_property_descriptor, Size> properties;
|
|
270
|
-
|
|
271
|
-
(..., [ & ]
|
|
276
|
+
constexpr auto [... indices ] = util::sequence<Size>;
|
|
277
|
+
(..., [ & ] -> void {
|
|
272
278
|
// nb: This is forwarded to *each* visitor. The visitor should be aware and only lvalue
|
|
273
279
|
// reference members one at a time.
|
|
274
280
|
auto accept_entry = accept_entry_pair<decltype(self), decltype(self)>{self};
|
|
@@ -299,18 +305,32 @@ struct accept_napi_value : accept_basic_napi_value {
|
|
|
299
305
|
consteval static auto types(auto /*recursive*/) { return util::type_pack{}; }
|
|
300
306
|
};
|
|
301
307
|
|
|
302
|
-
// `value_of<
|
|
308
|
+
// Forward `value_of<T>`
|
|
309
|
+
template <class Tag>
|
|
310
|
+
struct accept_napi_value_of {
|
|
311
|
+
public:
|
|
312
|
+
explicit accept_napi_value_of(auto* /*transfer*/) {}
|
|
313
|
+
|
|
314
|
+
auto operator()(Tag /*tag*/, visit_holder /*visit*/, value_of<Tag> subject) const -> value_of<Tag> {
|
|
315
|
+
return subject;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
consteval static auto accept_tags_of() { return std::tuple{Tag{}}; }
|
|
319
|
+
consteval static auto types(auto /*recursive*/) { return util::type_pack{}; }
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// `local_of<object_tag>{}->assign(...)` implementation
|
|
303
323
|
struct object_assign_delegate {
|
|
304
324
|
public:
|
|
305
|
-
explicit object_assign_delegate(
|
|
325
|
+
explicit object_assign_delegate(local_of<object_tag> object) : object_{object} {}
|
|
306
326
|
auto operator*() const { return object_; }
|
|
307
327
|
|
|
308
328
|
private:
|
|
309
|
-
|
|
329
|
+
local_of<object_tag> object_;
|
|
310
330
|
};
|
|
311
331
|
|
|
312
|
-
auto
|
|
313
|
-
js::transfer_in<object_assign_delegate>(std::move(source), env, object_assign_delegate{
|
|
332
|
+
auto local_for_object::assign(auto_environment auto& env, auto source) const -> void {
|
|
333
|
+
js::transfer_in<object_assign_delegate>(std::move(source), env, object_assign_delegate{local_of{*this}});
|
|
314
334
|
}
|
|
315
335
|
|
|
316
336
|
} // namespace js::napi
|
|
@@ -327,24 +347,20 @@ struct accept<Meta, napi_value> : napi::accept_napi_value_with<Meta> {
|
|
|
327
347
|
using accept_type::accept_type;
|
|
328
348
|
};
|
|
329
349
|
|
|
330
|
-
// Tagged `
|
|
350
|
+
// Tagged `local_of<T>` acceptor
|
|
331
351
|
template <>
|
|
332
|
-
struct accept_property_subject<napi::
|
|
352
|
+
struct accept_property_subject<napi::local_of<value_tag>> : std::type_identity<napi_value> {};
|
|
333
353
|
|
|
334
354
|
template <class Meta, class Tag>
|
|
335
|
-
struct accept<Meta, napi::
|
|
355
|
+
struct accept<Meta, napi::local_of<Tag>> : napi::accept_napi_value_with<Meta> {
|
|
336
356
|
using accept_type = napi::accept_napi_value_with<Meta>;
|
|
337
357
|
using accept_type::accept_type;
|
|
338
358
|
};
|
|
339
359
|
|
|
340
|
-
//
|
|
341
|
-
template <class Tag>
|
|
342
|
-
struct accept<
|
|
343
|
-
|
|
344
|
-
return js::forward{napi::value_of<Tag>{subject}, Tag{}};
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
consteval static auto types(auto /*recursive*/) { return util::type_pack{}; }
|
|
360
|
+
// Forward `value_of<T>`
|
|
361
|
+
template <class Meta, class Tag>
|
|
362
|
+
struct accept<Meta, napi::value_of<Tag>> : napi::accept_napi_value_of<Tag> {
|
|
363
|
+
using napi::accept_napi_value_of<Tag>::accept_napi_value_of;
|
|
348
364
|
};
|
|
349
365
|
|
|
350
366
|
// Object key lookup via napi
|