mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: use ToLocal in DeserializeProperties
This commit uses ToLocal to avoid having to call ToLocalChecked. PR-URL: https://github.com/nodejs/node/pull/36279 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
This commit is contained in:
14
src/env.cc
14
src/env.cc
@@ -96,12 +96,13 @@ void IsolateData::DeserializeProperties(const std::vector<size_t>* indexes) {
|
||||
#define VS(PropertyName, StringValue) V(String, PropertyName)
|
||||
#define V(TypeName, PropertyName) \
|
||||
do { \
|
||||
MaybeLocal<TypeName> field = \
|
||||
MaybeLocal<TypeName> maybe_field = \
|
||||
isolate_->GetDataFromSnapshotOnce<TypeName>((*indexes)[i++]); \
|
||||
if (field.IsEmpty()) { \
|
||||
Local<TypeName> field; \
|
||||
if (!maybe_field.ToLocal(&field)) { \
|
||||
fprintf(stderr, "Failed to deserialize " #PropertyName "\n"); \
|
||||
} \
|
||||
PropertyName##_.Set(isolate_, field.ToLocalChecked()); \
|
||||
PropertyName##_.Set(isolate_, field); \
|
||||
} while (0);
|
||||
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
|
||||
PER_ISOLATE_SYMBOL_PROPERTIES(VY)
|
||||
@@ -112,12 +113,13 @@ void IsolateData::DeserializeProperties(const std::vector<size_t>* indexes) {
|
||||
#undef VP
|
||||
|
||||
for (size_t j = 0; j < AsyncWrap::PROVIDERS_LENGTH; j++) {
|
||||
MaybeLocal<String> field =
|
||||
MaybeLocal<String> maybe_field =
|
||||
isolate_->GetDataFromSnapshotOnce<String>((*indexes)[i++]);
|
||||
if (field.IsEmpty()) {
|
||||
Local<String> field;
|
||||
if (!maybe_field.ToLocal(&field)) {
|
||||
fprintf(stderr, "Failed to deserialize AsyncWrap provider %zu\n", j);
|
||||
}
|
||||
async_wrap_providers_[j].Set(isolate_, field.ToLocalChecked());
|
||||
async_wrap_providers_[j].Set(isolate_, field);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user