diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2020-11-26 16:17:05 +0300 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2020-12-01 07:46:27 +0300 |
commit | 2dc6bf0d121dcad48382f075bb3877aa9dc25936 (patch) | |
tree | e05972f3b6fb7c3585700cb24a25a6cc870196e4 /src/env.cc | |
parent | cb023a3e7078e03bbb7881e98eb250aaca82ae55 (diff) |
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>
Diffstat (limited to 'src/env.cc')
-rw-r--r-- | src/env.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/env.cc b/src/env.cc index eef024ab450..eef0e9dc300 100644 --- a/src/env.cc +++ b/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); } } |