@@ -1876,12 +1876,13 @@ void Initialize(Local<Object> target,
18761876 Local<Context> context,
18771877 void * priv) {
18781878 Environment* env = Environment::GetCurrent (context);
1879+ Isolate* isolate = env->isolate ();
18791880
1880- env-> SetMethod (target, " getaddrinfo" , GetAddrInfo);
1881- env-> SetMethod (target, " getnameinfo" , GetNameInfo);
1882- env-> SetMethodNoSideEffect (target, " canonicalizeIP" , CanonicalizeIP);
1881+ SetMethod (context, target, " getaddrinfo" , GetAddrInfo);
1882+ SetMethod (context, target, " getnameinfo" , GetNameInfo);
1883+ SetMethodNoSideEffect (context, target, " canonicalizeIP" , CanonicalizeIP);
18831884
1884- env-> SetMethod (target, " strerror" , StrError);
1885+ SetMethod (context, target, " strerror" , StrError);
18851886
18861887 target->Set (env->context (), FIXED_ONE_BYTE_STRING (env->isolate (), " AF_INET" ),
18871888 Integer::New (env->isolate (), AF_INET)).Check ();
@@ -1903,44 +1904,45 @@ void Initialize(Local<Object> target,
19031904 Local<FunctionTemplate> aiw =
19041905 BaseObject::MakeLazilyInitializedJSTemplate (env);
19051906 aiw->Inherit (AsyncWrap::GetConstructorTemplate (env));
1906- env-> SetConstructorFunction (target, " GetAddrInfoReqWrap" , aiw);
1907+ SetConstructorFunction (context, target, " GetAddrInfoReqWrap" , aiw);
19071908
19081909 Local<FunctionTemplate> niw =
19091910 BaseObject::MakeLazilyInitializedJSTemplate (env);
19101911 niw->Inherit (AsyncWrap::GetConstructorTemplate (env));
1911- env-> SetConstructorFunction (target, " GetNameInfoReqWrap" , niw);
1912+ SetConstructorFunction (context, target, " GetNameInfoReqWrap" , niw);
19121913
19131914 Local<FunctionTemplate> qrw =
19141915 BaseObject::MakeLazilyInitializedJSTemplate (env);
19151916 qrw->Inherit (AsyncWrap::GetConstructorTemplate (env));
1916- env-> SetConstructorFunction (target, " QueryReqWrap" , qrw);
1917+ SetConstructorFunction (context, target, " QueryReqWrap" , qrw);
19171918
19181919 Local<FunctionTemplate> channel_wrap =
1919- env-> NewFunctionTemplate (ChannelWrap::New);
1920+ NewFunctionTemplate (isolate, ChannelWrap::New);
19201921 channel_wrap->InstanceTemplate ()->SetInternalFieldCount (
19211922 ChannelWrap::kInternalFieldCount );
19221923 channel_wrap->Inherit (AsyncWrap::GetConstructorTemplate (env));
19231924
1924- env->SetProtoMethod (channel_wrap, " queryAny" , Query<QueryAnyWrap>);
1925- env->SetProtoMethod (channel_wrap, " queryA" , Query<QueryAWrap>);
1926- env->SetProtoMethod (channel_wrap, " queryAaaa" , Query<QueryAaaaWrap>);
1927- env->SetProtoMethod (channel_wrap, " queryCaa" , Query<QueryCaaWrap>);
1928- env->SetProtoMethod (channel_wrap, " queryCname" , Query<QueryCnameWrap>);
1929- env->SetProtoMethod (channel_wrap, " queryMx" , Query<QueryMxWrap>);
1930- env->SetProtoMethod (channel_wrap, " queryNs" , Query<QueryNsWrap>);
1931- env->SetProtoMethod (channel_wrap, " queryTxt" , Query<QueryTxtWrap>);
1932- env->SetProtoMethod (channel_wrap, " querySrv" , Query<QuerySrvWrap>);
1933- env->SetProtoMethod (channel_wrap, " queryPtr" , Query<QueryPtrWrap>);
1934- env->SetProtoMethod (channel_wrap, " queryNaptr" , Query<QueryNaptrWrap>);
1935- env->SetProtoMethod (channel_wrap, " querySoa" , Query<QuerySoaWrap>);
1936- env->SetProtoMethod (channel_wrap, " getHostByAddr" , Query<GetHostByAddrWrap>);
1937-
1938- env->SetProtoMethodNoSideEffect (channel_wrap, " getServers" , GetServers);
1939- env->SetProtoMethod (channel_wrap, " setServers" , SetServers);
1940- env->SetProtoMethod (channel_wrap, " setLocalAddress" , SetLocalAddress);
1941- env->SetProtoMethod (channel_wrap, " cancel" , Cancel);
1942-
1943- env->SetConstructorFunction (target, " ChannelWrap" , channel_wrap);
1925+ SetProtoMethod (isolate, channel_wrap, " queryAny" , Query<QueryAnyWrap>);
1926+ SetProtoMethod (isolate, channel_wrap, " queryA" , Query<QueryAWrap>);
1927+ SetProtoMethod (isolate, channel_wrap, " queryAaaa" , Query<QueryAaaaWrap>);
1928+ SetProtoMethod (isolate, channel_wrap, " queryCaa" , Query<QueryCaaWrap>);
1929+ SetProtoMethod (isolate, channel_wrap, " queryCname" , Query<QueryCnameWrap>);
1930+ SetProtoMethod (isolate, channel_wrap, " queryMx" , Query<QueryMxWrap>);
1931+ SetProtoMethod (isolate, channel_wrap, " queryNs" , Query<QueryNsWrap>);
1932+ SetProtoMethod (isolate, channel_wrap, " queryTxt" , Query<QueryTxtWrap>);
1933+ SetProtoMethod (isolate, channel_wrap, " querySrv" , Query<QuerySrvWrap>);
1934+ SetProtoMethod (isolate, channel_wrap, " queryPtr" , Query<QueryPtrWrap>);
1935+ SetProtoMethod (isolate, channel_wrap, " queryNaptr" , Query<QueryNaptrWrap>);
1936+ SetProtoMethod (isolate, channel_wrap, " querySoa" , Query<QuerySoaWrap>);
1937+ SetProtoMethod (
1938+ isolate, channel_wrap, " getHostByAddr" , Query<GetHostByAddrWrap>);
1939+
1940+ SetProtoMethodNoSideEffect (isolate, channel_wrap, " getServers" , GetServers);
1941+ SetProtoMethod (isolate, channel_wrap, " setServers" , SetServers);
1942+ SetProtoMethod (isolate, channel_wrap, " setLocalAddress" , SetLocalAddress);
1943+ SetProtoMethod (isolate, channel_wrap, " cancel" , Cancel);
1944+
1945+ SetConstructorFunction (context, target, " ChannelWrap" , channel_wrap);
19441946}
19451947
19461948} // namespace cares_wrap
0 commit comments