GeezerVison is showing github.com — src: use `args.This()` instead of `Holder` · nodejs/node@87167fa
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/addons.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -923,7 +923,7 @@ void MyObject::New(const FunctionCallbackInfo<Value>& args) { | 923 | 923 | void MyObject::PlusOne(const FunctionCallbackInfo<Value>& args) { | 924 | 924 | Isolate* isolate = args.GetIsolate(); | 925 | 925 |
| 926 | | - MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.Holder()); | | 926 | + MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.This()); | 927 | 927 | obj->value_ += 1; | 928 | 928 |
| 929 | 929 | args.GetReturnValue().Set(Number::New(isolate, obj->value_)); | @@ -1138,7 +1138,7 @@ void MyObject::NewInstance(const FunctionCallbackInfo<Value>& args) { | 1138 | 1138 | void MyObject::PlusOne(const FunctionCallbackInfo<Value>& args) { | 1139 | 1139 | Isolate* isolate = args.GetIsolate(); | 1140 | 1140 |
| 1141 | | - MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.Holder()); | | 1141 | + MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.This()); | 1142 | 1142 | obj->value_ += 1; | 1143 | 1143 |
| 1144 | 1144 | args.GetReturnValue().Set(Number::New(isolate, obj->value_)); | |
Collapse file Copy file name to clipboardExpand all lines: src/README.md +2-4Lines changed: 2 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -418,8 +418,6 @@ Node.js source code.) | 418 | 418 |
| 419 | 419 | `args[n]` is a `Local<Value>` that represents the n-th argument passed to the | 420 | 420 | function. `args.This()` is the `this` value inside this function call. | 421 | | -`args.Holder()` is equivalent to `args.This()` in all use cases inside of | 422 | | -Node.js. | 423 | 421 |
| 424 | 422 | `args.GetReturnValue()` is a placeholder for the return value of the function, | 425 | 423 | and provides a `.Set()` method that can be called with a boolean, integer, | @@ -829,7 +827,7 @@ The JavaScript object can be accessed as a `v8::Local<v8::Object>` by using | 829 | 827 | `self->object()`, given a `BaseObject` named `self`. | 830 | 828 |
| 831 | 829 | Accessing a `BaseObject` from a `v8::Local<v8::Object>` (frequently that is | 832 | | -`args.This()` or `args.Holder()` in a [binding function][]) can be done using | | 830 | +`args.This()` in a [binding function][]) can be done using | 833 | 831 | the `Unwrap<T>(obj)` function, where `T` is a subclass of `BaseObject`. | 834 | 832 | A helper for this is the `ASSIGN_OR_RETURN_UNWRAP` macro that returns from the | 835 | 833 | current function if unwrapping fails (typically that means that the `BaseObject` | @@ -838,7 +836,7 @@ has been deleted earlier). | 838 | 836 | ```cpp | 839 | 837 | void Http2Session::Request(const FunctionCallbackInfo<Value>& args) { | 840 | 838 | Http2Session* session; | 841 | | - ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder()); | | 839 | + ASSIGN_OR_RETURN_UNWRAP(&session, args.This()); | 842 | 840 | Environment* env = session->env(); | 843 | 841 | Local<Context> context = env->context(); | 844 | 842 | Isolate* isolate = env->isolate(); | |
Collapse file Copy file name to clipboardExpand all lines: src/async_wrap.cc +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -254,7 +254,7 @@ static void RegisterDestroyHook(const FunctionCallbackInfo<Value>& args) { | 254 | 254 | void AsyncWrap::GetAsyncId(const FunctionCallbackInfo<Value>& args) { | 255 | 255 | AsyncWrap* wrap; | 256 | 256 | args.GetReturnValue().Set(kInvalidAsyncId); | 257 | | - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); | | 257 | + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); | 258 | 258 | args.GetReturnValue().Set(wrap->get_async_id()); | 259 | 259 | } | 260 | 260 |
| @@ -296,7 +296,7 @@ void AsyncWrap::AsyncReset(const FunctionCallbackInfo<Value>& args) { | 296 | 296 | CHECK(args[0]->IsObject()); | 297 | 297 |
| 298 | 298 | AsyncWrap* wrap; | 299 | | - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); | | 299 | + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); | 300 | 300 |
| 301 | 301 | Local<Object> resource = args[0].As<Object>(); | 302 | 302 | double execution_async_id = | @@ -308,7 +308,7 @@ void AsyncWrap::AsyncReset(const FunctionCallbackInfo<Value>& args) { | 308 | 308 | void AsyncWrap::GetProviderType(const FunctionCallbackInfo<Value>& args) { | 309 | 309 | AsyncWrap* wrap; | 310 | 310 | args.GetReturnValue().Set(AsyncWrap::PROVIDER_NONE); | 311 | | - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); | | 311 | + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); | 312 | 312 | args.GetReturnValue().Set(wrap->provider_type()); | 313 | 313 | } | 314 | 314 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/cares_wrap.cc +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1404,7 +1404,7 @@ template <class Wrap> | 1404 | 1404 | static void Query(const FunctionCallbackInfo<Value>& args) { | 1405 | 1405 | Environment* env = Environment::GetCurrent(args); | 1406 | 1406 | ChannelWrap* channel; | 1407 | | - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); | | 1407 | + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); | 1408 | 1408 |
| 1409 | 1409 | CHECK_EQ(false, args.IsConstructCall()); | 1410 | 1410 | CHECK(args[0]->IsObject()); | @@ -1664,7 +1664,7 @@ void GetNameInfo(const FunctionCallbackInfo<Value>& args) { | 1664 | 1664 | void GetServers(const FunctionCallbackInfo<Value>& args) { | 1665 | 1665 | Environment* env = Environment::GetCurrent(args); | 1666 | 1666 | ChannelWrap* channel; | 1667 | | - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); | | 1667 | + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); | 1668 | 1668 |
| 1669 | 1669 | Local<Array> server_array = Array::New(env->isolate()); | 1670 | 1670 |
| @@ -1702,7 +1702,7 @@ void GetServers(const FunctionCallbackInfo<Value>& args) { | 1702 | 1702 | void SetServers(const FunctionCallbackInfo<Value>& args) { | 1703 | 1703 | Environment* env = Environment::GetCurrent(args); | 1704 | 1704 | ChannelWrap* channel; | 1705 | | - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); | | 1705 | + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); | 1706 | 1706 |
| 1707 | 1707 | if (channel->active_query_count()) { | 1708 | 1708 | return args.GetReturnValue().Set(DNS_ESETSRVPENDING); | @@ -1783,7 +1783,7 @@ void SetServers(const FunctionCallbackInfo<Value>& args) { | 1783 | 1783 | void SetLocalAddress(const FunctionCallbackInfo<Value>& args) { | 1784 | 1784 | Environment* env = Environment::GetCurrent(args); | 1785 | 1785 | ChannelWrap* channel; | 1786 | | - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); | | 1786 | + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); | 1787 | 1787 |
| 1788 | 1788 | CHECK_EQ(args.Length(), 2); | 1789 | 1789 | CHECK(args[0]->IsString()); | @@ -1846,7 +1846,7 @@ void SetLocalAddress(const FunctionCallbackInfo<Value>& args) { | 1846 | 1846 |
| 1847 | 1847 | void Cancel(const FunctionCallbackInfo<Value>& args) { | 1848 | 1848 | ChannelWrap* channel; | 1849 | | - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); | | 1849 | + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); | 1850 | 1850 |
| 1851 | 1851 | TRACE_EVENT_INSTANT0(TRACING_CATEGORY_NODE2(dns, native), | 1852 | 1852 | "cancel", TRACE_EVENT_SCOPE_THREAD); | |
Collapse file Copy file name to clipboardExpand all lines: src/crypto/crypto_cipher.cc +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -448,7 +448,7 @@ void CipherBase::Init(const char* cipher_type, | 448 | 448 |
| 449 | 449 | void CipherBase::Init(const FunctionCallbackInfo<Value>& args) { | 450 | 450 | CipherBase* cipher; | 451 | | - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); | | 451 | + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); | 452 | 452 | Environment* env = Environment::GetCurrent(args); | 453 | 453 |
| 454 | 454 | CHECK_GE(args.Length(), 3); | @@ -520,7 +520,7 @@ void CipherBase::InitIv(const char* cipher_type, | 520 | 520 |
| 521 | 521 | void CipherBase::InitIv(const FunctionCallbackInfo<Value>& args) { | 522 | 522 | CipherBase* cipher; | 523 | | - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); | | 523 | + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); | 524 | 524 | Environment* env = cipher->env(); | 525 | 525 |
| 526 | 526 | CHECK_GE(args.Length(), 4); | @@ -655,7 +655,7 @@ bool CipherBase::IsAuthenticatedMode() const { | 655 | 655 | void CipherBase::GetAuthTag(const FunctionCallbackInfo<Value>& args) { | 656 | 656 | Environment* env = Environment::GetCurrent(args); | 657 | 657 | CipherBase* cipher; | 658 | | - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); | | 658 | + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); | 659 | 659 |
| 660 | 660 | // Only callable after Final and if encrypting. | 661 | 661 | if (cipher->ctx_ || | @@ -671,7 +671,7 @@ void CipherBase::GetAuthTag(const FunctionCallbackInfo<Value>& args) { | 671 | 671 |
| 672 | 672 | void CipherBase::SetAuthTag(const FunctionCallbackInfo<Value>& args) { | 673 | 673 | CipherBase* cipher; | 674 | | - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); | | 674 | + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); | 675 | 675 | Environment* env = Environment::GetCurrent(args); | 676 | 676 |
| 677 | 677 | if (!cipher->ctx_ || | @@ -784,7 +784,7 @@ bool CipherBase::SetAAD( | 784 | 784 |
| 785 | 785 | void CipherBase::SetAAD(const FunctionCallbackInfo<Value>& args) { | 786 | 786 | CipherBase* cipher; | 787 | | - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); | | 787 | + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); | 788 | 788 | Environment* env = Environment::GetCurrent(args); | 789 | 789 |
| 790 | 790 | CHECK_EQ(args.Length(), 2); | @@ -897,7 +897,7 @@ bool CipherBase::SetAutoPadding(bool auto_padding) { | 897 | 897 |
| 898 | 898 | void CipherBase::SetAutoPadding(const FunctionCallbackInfo<Value>& args) { | 899 | 899 | CipherBase* cipher; | 900 | | - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); | | 900 | + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); | 901 | 901 |
| 902 | 902 | bool b = cipher->SetAutoPadding(args.Length() < 1 || args[0]->IsTrue()); | 903 | 903 | args.GetReturnValue().Set(b); // Possibly report invalid state failure | @@ -972,7 +972,7 @@ void CipherBase::Final(const FunctionCallbackInfo<Value>& args) { | 972 | 972 | Environment* env = Environment::GetCurrent(args); | 973 | 973 |
| 974 | 974 | CipherBase* cipher; | 975 | | - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); | | 975 | + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); | 976 | 976 | if (cipher->ctx_ == nullptr) | 977 | 977 | return THROW_ERR_CRYPTO_INVALID_STATE(env); | 978 | 978 |
| |
|