@@ -1886,12 +1886,13 @@ void Initialize(Local<Object> target,
18861886 Local<Context> context,
18871887 void * priv) {
18881888 Environment* env = Environment::GetCurrent (context);
1889+ Isolate* isolate = env->isolate ();
18891890
1890- env-> SetMethod (target, " getaddrinfo" , GetAddrInfo);
1891- env-> SetMethod (target, " getnameinfo" , GetNameInfo);
1892- env-> SetMethodNoSideEffect (target, " canonicalizeIP" , CanonicalizeIP);
1891+ SetMethod (context, target, " getaddrinfo" , GetAddrInfo);
1892+ SetMethod (context, target, " getnameinfo" , GetNameInfo);
1893+ SetMethodNoSideEffect (context, target, " canonicalizeIP" , CanonicalizeIP);
18931894
1894- env-> SetMethod (target, " strerror" , StrError);
1895+ SetMethod (context, target, " strerror" , StrError);
18951896
18961897 target->Set (env->context (), FIXED_ONE_BYTE_STRING (env->isolate (), " AF_INET" ),
18971898 Integer::New (env->isolate (), AF_INET)).Check ();
@@ -1913,44 +1914,45 @@ void Initialize(Local<Object> target,
19131914 Local<FunctionTemplate> aiw =
19141915 BaseObject::MakeLazilyInitializedJSTemplate (env);
19151916 aiw->Inherit (AsyncWrap::GetConstructorTemplate (env));
1916- env-> SetConstructorFunction (target, " GetAddrInfoReqWrap" , aiw);
1917+ SetConstructorFunction (context, target, " GetAddrInfoReqWrap" , aiw);
19171918
19181919 Local<FunctionTemplate> niw =
19191920 BaseObject::MakeLazilyInitializedJSTemplate (env);
19201921 niw->Inherit (AsyncWrap::GetConstructorTemplate (env));
1921- env-> SetConstructorFunction (target, " GetNameInfoReqWrap" , niw);
1922+ SetConstructorFunction (context, target, " GetNameInfoReqWrap" , niw);
19221923
19231924 Local<FunctionTemplate> qrw =
19241925 BaseObject::MakeLazilyInitializedJSTemplate (env);
19251926 qrw->Inherit (AsyncWrap::GetConstructorTemplate (env));
1926- env-> SetConstructorFunction (target, " QueryReqWrap" , qrw);
1927+ SetConstructorFunction (context, target, " QueryReqWrap" , qrw);
19271928
19281929 Local<FunctionTemplate> channel_wrap =
1929- env-> NewFunctionTemplate (ChannelWrap::New);
1930+ NewFunctionTemplate (isolate, ChannelWrap::New);
19301931 channel_wrap->InstanceTemplate ()->SetInternalFieldCount (
19311932 ChannelWrap::kInternalFieldCount );
19321933 channel_wrap->Inherit (AsyncWrap::GetConstructorTemplate (env));
19331934
1934- env->SetProtoMethod (channel_wrap, " queryAny" , Query<QueryAnyWrap>);
1935- env->SetProtoMethod (channel_wrap, " queryA" , Query<QueryAWrap>);
1936- env->SetProtoMethod (channel_wrap, " queryAaaa" , Query<QueryAaaaWrap>);
1937- env->SetProtoMethod (channel_wrap, " queryCaa" , Query<QueryCaaWrap>);
1938- env->SetProtoMethod (channel_wrap, " queryCname" , Query<QueryCnameWrap>);
1939- env->SetProtoMethod (channel_wrap, " queryMx" , Query<QueryMxWrap>);
1940- env->SetProtoMethod (channel_wrap, " queryNs" , Query<QueryNsWrap>);
1941- env->SetProtoMethod (channel_wrap, " queryTxt" , Query<QueryTxtWrap>);
1942- env->SetProtoMethod (channel_wrap, " querySrv" , Query<QuerySrvWrap>);
1943- env->SetProtoMethod (channel_wrap, " queryPtr" , Query<QueryPtrWrap>);
1944- env->SetProtoMethod (channel_wrap, " queryNaptr" , Query<QueryNaptrWrap>);
1945- env->SetProtoMethod (channel_wrap, " querySoa" , Query<QuerySoaWrap>);
1946- env->SetProtoMethod (channel_wrap, " getHostByAddr" , Query<GetHostByAddrWrap>);
1947-
1948- env->SetProtoMethodNoSideEffect (channel_wrap, " getServers" , GetServers);
1949- env->SetProtoMethod (channel_wrap, " setServers" , SetServers);
1950- env->SetProtoMethod (channel_wrap, " setLocalAddress" , SetLocalAddress);
1951- env->SetProtoMethod (channel_wrap, " cancel" , Cancel);
1952-
1953- env->SetConstructorFunction (target, " ChannelWrap" , channel_wrap);
1935+ SetProtoMethod (isolate, channel_wrap, " queryAny" , Query<QueryAnyWrap>);
1936+ SetProtoMethod (isolate, channel_wrap, " queryA" , Query<QueryAWrap>);
1937+ SetProtoMethod (isolate, channel_wrap, " queryAaaa" , Query<QueryAaaaWrap>);
1938+ SetProtoMethod (isolate, channel_wrap, " queryCaa" , Query<QueryCaaWrap>);
1939+ SetProtoMethod (isolate, channel_wrap, " queryCname" , Query<QueryCnameWrap>);
1940+ SetProtoMethod (isolate, channel_wrap, " queryMx" , Query<QueryMxWrap>);
1941+ SetProtoMethod (isolate, channel_wrap, " queryNs" , Query<QueryNsWrap>);
1942+ SetProtoMethod (isolate, channel_wrap, " queryTxt" , Query<QueryTxtWrap>);
1943+ SetProtoMethod (isolate, channel_wrap, " querySrv" , Query<QuerySrvWrap>);
1944+ SetProtoMethod (isolate, channel_wrap, " queryPtr" , Query<QueryPtrWrap>);
1945+ SetProtoMethod (isolate, channel_wrap, " queryNaptr" , Query<QueryNaptrWrap>);
1946+ SetProtoMethod (isolate, channel_wrap, " querySoa" , Query<QuerySoaWrap>);
1947+ SetProtoMethod (
1948+ isolate, channel_wrap, " getHostByAddr" , Query<GetHostByAddrWrap>);
1949+
1950+ SetProtoMethodNoSideEffect (isolate, channel_wrap, " getServers" , GetServers);
1951+ SetProtoMethod (isolate, channel_wrap, " setServers" , SetServers);
1952+ SetProtoMethod (isolate, channel_wrap, " setLocalAddress" , SetLocalAddress);
1953+ SetProtoMethod (isolate, channel_wrap, " cancel" , Cancel);
1954+
1955+ SetConstructorFunction (context, target, " ChannelWrap" , channel_wrap);
19541956}
19551957
19561958} // namespace cares_wrap
0 commit comments