Skip to content

Commit 685ed2c

Browse files
danbevtargos
authored andcommitted
src: use ToLocal in DeserializeProperties
This commit uses ToLocal to avoid having to call ToLocalChecked. PR-URL: #36279 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]>
1 parent 2183a2b commit 685ed2c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/env.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,13 @@ void IsolateData::DeserializeProperties(const std::vector<size_t>* indexes) {
9292
#define VS(PropertyName, StringValue) V(String, PropertyName)
9393
#define V(TypeName, PropertyName) \
9494
do { \
95-
MaybeLocal<TypeName> field = \
95+
MaybeLocal<TypeName> maybe_field = \
9696
isolate_->GetDataFromSnapshotOnce<TypeName>((*indexes)[i++]); \
97-
if (field.IsEmpty()) { \
97+
Local<TypeName> field; \
98+
if (!maybe_field.ToLocal(&field)) { \
9899
fprintf(stderr, "Failed to deserialize " #PropertyName "\n"); \
99100
} \
100-
PropertyName##_.Set(isolate_, field.ToLocalChecked()); \
101+
PropertyName##_.Set(isolate_, field); \
101102
} while (0);
102103
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
103104
PER_ISOLATE_SYMBOL_PROPERTIES(VY)
@@ -108,12 +109,13 @@ void IsolateData::DeserializeProperties(const std::vector<size_t>* indexes) {
108109
#undef VP
109110

110111
for (size_t j = 0; j < AsyncWrap::PROVIDERS_LENGTH; j++) {
111-
MaybeLocal<String> field =
112+
MaybeLocal<String> maybe_field =
112113
isolate_->GetDataFromSnapshotOnce<String>((*indexes)[i++]);
113-
if (field.IsEmpty()) {
114+
Local<String> field;
115+
if (!maybe_field.ToLocal(&field)) {
114116
fprintf(stderr, "Failed to deserialize AsyncWrap provider %zu\n", j);
115117
}
116-
async_wrap_providers_[j].Set(isolate_, field.ToLocalChecked());
118+
async_wrap_providers_[j].Set(isolate_, field);
117119
}
118120
}
119121

0 commit comments

Comments
 (0)