Skip to content

Commit 6ebb98a

Browse files
danbevdanielleadams
authored andcommitted
src: use ToLocal in DeserializeProperties
This commit uses ToLocal to avoid having to call ToLocalChecked. PR-URL: #36279 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent 8cf1add commit 6ebb98a

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
@@ -96,12 +96,13 @@ void IsolateData::DeserializeProperties(const std::vector<size_t>* indexes) {
9696
#define VS(PropertyName, StringValue) V(String, PropertyName)
9797
#define V(TypeName, PropertyName) \
9898
do { \
99-
MaybeLocal<TypeName> field = \
99+
MaybeLocal<TypeName> maybe_field = \
100100
isolate_->GetDataFromSnapshotOnce<TypeName>((*indexes)[i++]); \
101-
if (field.IsEmpty()) { \
101+
Local<TypeName> field; \
102+
if (!maybe_field.ToLocal(&field)) { \
102103
fprintf(stderr, "Failed to deserialize " #PropertyName "\n"); \
103104
} \
104-
PropertyName##_.Set(isolate_, field.ToLocalChecked()); \
105+
PropertyName##_.Set(isolate_, field); \
105106
} while (0);
106107
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
107108
PER_ISOLATE_SYMBOL_PROPERTIES(VY)
@@ -112,12 +113,13 @@ void IsolateData::DeserializeProperties(const std::vector<size_t>* indexes) {
112113
#undef VP
113114

114115
for (size_t j = 0; j < AsyncWrap::PROVIDERS_LENGTH; j++) {
115-
MaybeLocal<String> field =
116+
MaybeLocal<String> maybe_field =
116117
isolate_->GetDataFromSnapshotOnce<String>((*indexes)[i++]);
117-
if (field.IsEmpty()) {
118+
Local<String> field;
119+
if (!maybe_field.ToLocal(&field)) {
118120
fprintf(stderr, "Failed to deserialize AsyncWrap provider %zu\n", j);
119121
}
120-
async_wrap_providers_[j].Set(isolate_, field.ToLocalChecked());
122+
async_wrap_providers_[j].Set(isolate_, field);
121123
}
122124
}
123125

0 commit comments

Comments
 (0)