GeezerVison is showing github.com — src: cast v8::Object::GetInternalField() return value to v8::Value · nodejs/node@ff334cb
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/base_object-inl.h +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -127,7 +127,8 @@ template <int Field> |
127 | 127 | void BaseObject::InternalFieldGet( |
128 | 128 | v8::Local<v8::String> property, |
129 | 129 | 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>()); |
131 | 132 | } |
132 | 133 |
|
133 | 134 | template <int Field, bool (v8::Value::* typecheck)() const> |
|
Collapse file
Copy file name to clipboardExpand all lines: src/module_wrap.cc +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -78,7 +78,7 @@ ModuleWrap::~ModuleWrap() { |
78 | 78 | } |
79 | 79 |
|
80 | 80 | Local<Context> ModuleWrap::context() const { |
81 | | - Local<Value> obj = object()->GetInternalField(kContextObjectSlot); |
| 81 | + Local<Value> obj = object()->GetInternalField(kContextObjectSlot).As<Value>(); |
82 | 82 | if (obj.IsEmpty()) return {}; |
83 | 83 | return obj.As<Object>()->GetCreationContext().ToLocalChecked(); |
84 | 84 | } |
@@ -684,7 +684,9 @@ MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback( |
684 | 684 |
|
685 | 685 | TryCatchScope try_catch(env); |
686 | 686 | Local<Function> synthetic_evaluation_steps = |
687 | | - obj->object()->GetInternalField(kSyntheticEvaluationStepsSlot) |
| 687 | + obj->object() |
| 688 | + ->GetInternalField(kSyntheticEvaluationStepsSlot) |
| 689 | + .As<Value>() |
688 | 690 | .As<Function>(); |
689 | 691 | obj->object()->SetInternalField( |
690 | 692 | kSyntheticEvaluationStepsSlot, Undefined(isolate)); |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_file.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -438,7 +438,7 @@ MaybeLocal<Promise> FileHandle::ClosePromise() { |
438 | 438 | Local<Context> context = env()->context(); |
439 | 439 |
|
440 | 440 | Local<Value> close_resolver = |
441 | | - object()->GetInternalField(FileHandle::kClosingPromiseSlot); |
| 441 | + object()->GetInternalField(FileHandle::kClosingPromiseSlot).As<Value>(); |
442 | 442 | if (!close_resolver.IsEmpty() && !close_resolver->IsUndefined()) { |
443 | 443 | CHECK(close_resolver->IsPromise()); |
444 | 444 | return close_resolver.As<Promise>(); |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_task_queue.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,7 +50,7 @@ static Maybe<double> GetAssignedPromiseWrapAsyncId(Environment* env, |
50 | 50 | // be an object. If it's not, we just ignore it. Ideally v8 would |
51 | 51 | // have had GetInternalField returning a MaybeLocal but this works |
52 | 52 | // for now. |
53 | | - Local<Value> promiseWrap = promise->GetInternalField(0); |
| 53 | + Local<Value> promiseWrap = promise->GetInternalField(0).As<Value>(); |
54 | 54 | if (promiseWrap->IsObject()) { |
55 | 55 | Local<Value> maybe_async_id; |
56 | 56 | if (!promiseWrap.As<Object>()->Get(env->context(), id_symbol) |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_zlib.cc +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -423,7 +423,8 @@ class CompressionStream : public AsyncWrap, public ThreadPoolWork { |
423 | 423 | UpdateWriteResult(); |
424 | 424 |
|
425 | 425 | // call the write() cb |
426 | | - Local<Value> cb = object()->GetInternalField(kWriteJSCallback); |
| 426 | + Local<Value> cb = |
| 427 | + object()->GetInternalField(kWriteJSCallback).template As<Value>(); |
427 | 428 | MakeCallback(cb.As<Function>(), 0, nullptr); |
428 | 429 |
|
429 | 430 | if (pending_close_) |
|
Collapse file
Copy file name to clipboardExpand all lines: src/stream_base.cc +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -470,8 +470,9 @@ MaybeLocal<Value> StreamBase::CallJSOnreadMethod(ssize_t nread, |
470 | 470 |
|
471 | 471 | AsyncWrap* wrap = GetAsyncWrap(); |
472 | 472 | 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>(); |
475 | 476 | CHECK(onread->IsFunction()); |
476 | 477 | return wrap->MakeCallback(onread.As<Function>(), arraysize(argv), argv); |
477 | 478 | } |
|