From 2afbf990417930e306be43052fccd683123f5014 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 26 Nov 2020 14:17:05 +0100 Subject: [PATCH] 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 Reviewed-By: Rich Trott Reviewed-By: Daijiro Wachi --- src/env.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/env.cc b/src/env.cc index eef024ab450097..eef0e9dc3001c6 100644 --- a/src/env.cc +++ b/src/env.cc @@ -96,12 +96,13 @@ void IsolateData::DeserializeProperties(const std::vector* indexes) { #define VS(PropertyName, StringValue) V(String, PropertyName) #define V(TypeName, PropertyName) \ do { \ - MaybeLocal field = \ + MaybeLocal maybe_field = \ isolate_->GetDataFromSnapshotOnce((*indexes)[i++]); \ - if (field.IsEmpty()) { \ + Local 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* indexes) { #undef VP for (size_t j = 0; j < AsyncWrap::PROVIDERS_LENGTH; j++) { - MaybeLocal field = + MaybeLocal maybe_field = isolate_->GetDataFromSnapshotOnce((*indexes)[i++]); - if (field.IsEmpty()) { + Local 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); } }