◐ Shell
clean mode source ↗

src: cast v8::Object::GetInternalField() return value to v8::Value · nodejs/node@ff334cb

Original file line numberDiff line numberDiff line change

@@ -127,7 +127,8 @@ template <int Field>

127127

void BaseObject::InternalFieldGet(

128128

v8::Local<v8::String> property,

129129

const v8::PropertyCallbackInfo<v8::Value>& info) {

130-

info.GetReturnValue().Set(info.This()->GetInternalField(Field));

130+

info.GetReturnValue().Set(

131+

info.This()->GetInternalField(Field).As<v8::Value>());

131132

}

132133
133134

template <int Field, bool (v8::Value::* typecheck)() const>

Original file line numberDiff line numberDiff line change

@@ -78,7 +78,7 @@ ModuleWrap::~ModuleWrap() {

7878

}

7979
8080

Local<Context> ModuleWrap::context() const {

81-

Local<Value> obj = object()->GetInternalField(kContextObjectSlot);

81+

Local<Value> obj = object()->GetInternalField(kContextObjectSlot).As<Value>();

8282

if (obj.IsEmpty()) return {};

8383

return obj.As<Object>()->GetCreationContext().ToLocalChecked();

8484

}

@@ -684,7 +684,9 @@ MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback(

684684
685685

TryCatchScope try_catch(env);

686686

Local<Function> synthetic_evaluation_steps =

687-

obj->object()->GetInternalField(kSyntheticEvaluationStepsSlot)

687+

obj->object()

688+

->GetInternalField(kSyntheticEvaluationStepsSlot)

689+

.As<Value>()

688690

.As<Function>();

689691

obj->object()->SetInternalField(

690692

kSyntheticEvaluationStepsSlot, Undefined(isolate));

Original file line numberDiff line numberDiff line change

@@ -438,7 +438,7 @@ MaybeLocal<Promise> FileHandle::ClosePromise() {

438438

Local<Context> context = env()->context();

439439
440440

Local<Value> close_resolver =

441-

object()->GetInternalField(FileHandle::kClosingPromiseSlot);

441+

object()->GetInternalField(FileHandle::kClosingPromiseSlot).As<Value>();

442442

if (!close_resolver.IsEmpty() && !close_resolver->IsUndefined()) {

443443

CHECK(close_resolver->IsPromise());

444444

return close_resolver.As<Promise>();

Original file line numberDiff line numberDiff line change

@@ -50,7 +50,7 @@ static Maybe<double> GetAssignedPromiseWrapAsyncId(Environment* env,

5050

// be an object. If it's not, we just ignore it. Ideally v8 would

5151

// have had GetInternalField returning a MaybeLocal but this works

5252

// for now.

53-

Local<Value> promiseWrap = promise->GetInternalField(0);

53+

Local<Value> promiseWrap = promise->GetInternalField(0).As<Value>();

5454

if (promiseWrap->IsObject()) {

5555

Local<Value> maybe_async_id;

5656

if (!promiseWrap.As<Object>()->Get(env->context(), id_symbol)

Original file line numberDiff line numberDiff line change

@@ -423,7 +423,8 @@ class CompressionStream : public AsyncWrap, public ThreadPoolWork {

423423

UpdateWriteResult();

424424
425425

// call the write() cb

426-

Local<Value> cb = object()->GetInternalField(kWriteJSCallback);

426+

Local<Value> cb =

427+

object()->GetInternalField(kWriteJSCallback).template As<Value>();

427428

MakeCallback(cb.As<Function>(), 0, nullptr);

428429
429430

if (pending_close_)

Original file line numberDiff line numberDiff line change

@@ -470,8 +470,9 @@ MaybeLocal<Value> StreamBase::CallJSOnreadMethod(ssize_t nread,

470470
471471

AsyncWrap* wrap = GetAsyncWrap();

472472

CHECK_NOT_NULL(wrap);

473-

Local<Value> onread = wrap->object()->GetInternalField(

474-

StreamBase::kOnReadFunctionField);

473+

Local<Value> onread = wrap->object()

474+

->GetInternalField(StreamBase::kOnReadFunctionField)

475+

.As<Value>();

475476

CHECK(onread->IsFunction());

476477

return wrap->MakeCallback(onread.As<Function>(), arraysize(argv), argv);

477478

}