refactor: replace v8::Local<T>::Cast() with As<T>() (#29097)

This commit is contained in:
Milan Burda 2021-05-12 09:38:21 +02:00 committed by GitHub
parent e01faedaa5
commit a51aaeb28f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 31 additions and 34 deletions

View file

@ -20,7 +20,7 @@ ObjectCache::~ObjectCache() = default;
void ObjectCache::CacheProxiedObject(v8::Local<v8::Value> from,
v8::Local<v8::Value> proxy_value) {
if (from->IsObject() && !from->IsNullOrUndefined()) {
auto obj = v8::Local<v8::Object>::Cast(from);
auto obj = from.As<v8::Object>();
int hash = obj->GetIdentityHash();
proxy_map_[hash].push_front(std::make_pair(from, proxy_value));
@ -32,7 +32,7 @@ v8::MaybeLocal<v8::Value> ObjectCache::GetCachedProxiedObject(
if (!from->IsObject() || from->IsNullOrUndefined())
return v8::MaybeLocal<v8::Value>();
auto obj = v8::Local<v8::Object>::Cast(from);
auto obj = from.As<v8::Object>();
int hash = obj->GetIdentityHash();
auto iter = proxy_map_.find(hash);
if (iter == proxy_map_.end())