@@ -53,8 +53,8 @@ CHAR_TEST(16, IsUnicodeSurrogateTrail, (ch & 0x400) != 0)
5353
5454static void GetOwnNonIndexProperties (
5555 const FunctionCallbackInfo<Value>& args) {
56- Environment* env = Environment::GetCurrent ( args);
57- Local<Context> context = env-> context ();
56+ Isolate* isolate = args. GetIsolate ( );
57+ Local<Context> context = isolate-> GetCurrentContext ();
5858
5959 CHECK (args[0 ]->IsObject ());
6060 CHECK (args[1 ]->IsUint32 ());
@@ -168,7 +168,7 @@ static void PreviewEntries(const FunctionCallbackInfo<Value>& args) {
168168 if (!args[0 ]->IsObject ())
169169 return ;
170170
171- Environment* env = Environment::GetCurrent ( args);
171+ Isolate* isolate = args. GetIsolate ( );
172172 bool is_key_value;
173173 Local<Array> entries;
174174 if (!args[0 ].As <Object>()->PreviewEntries (&is_key_value).ToLocal (&entries))
@@ -179,10 +179,10 @@ static void PreviewEntries(const FunctionCallbackInfo<Value>& args) {
179179
180180 Local<Value> ret[] = {
181181 entries,
182- Boolean::New (env-> isolate () , is_key_value)
182+ Boolean::New (isolate, is_key_value)
183183 };
184184 return args.GetReturnValue ().Set (
185- Array::New (env-> isolate () , ret, arraysize (ret)));
185+ Array::New (isolate, ret, arraysize (ret)));
186186}
187187
188188static void Sleep (const FunctionCallbackInfo<Value>& args) {
@@ -222,9 +222,10 @@ static uint32_t GetUVHandleTypeCode(const uv_handle_type type) {
222222}
223223
224224static void GuessHandleType (const FunctionCallbackInfo<Value>& args) {
225- Environment* env = Environment::GetCurrent (args);
225+ Isolate* isolate = args.GetIsolate ();
226+ Local<Context> context = isolate->GetCurrentContext ();
226227 int fd;
227- if (!args[0 ]->Int32Value (env-> context () ).To (&fd)) return ;
228+ if (!args[0 ]->Int32Value (context).To (&fd)) return ;
228229 CHECK_GE (fd, 0 );
229230
230231 uv_handle_type t = uv_guess_handle (fd);
@@ -239,10 +240,12 @@ static uint32_t FastGuessHandleType(Local<Value> receiver, const uint32_t fd) {
239240CFunction fast_guess_handle_type_ (CFunction::Make(FastGuessHandleType));
240241
241242static void ParseEnv (const FunctionCallbackInfo<Value>& args) {
242- Environment* env = Environment::GetCurrent (args);
243+ Isolate* isolate = args.GetIsolate ();
244+ Local<Context> context = isolate->GetCurrentContext ();
245+ Environment* env = Environment::GetCurrent (context);
243246 CHECK_EQ (args.Length (), 1 ); // content
244247 CHECK (args[0 ]->IsString ());
245- Utf8Value content (env-> isolate () , args[0 ]);
248+ Utf8Value content (isolate, args[0 ]);
246249 Dotenv dotenv{};
247250 dotenv.ParseContent (content.ToStringView ());
248251 Local<Object> obj;
@@ -252,8 +255,9 @@ static void ParseEnv(const FunctionCallbackInfo<Value>& args) {
252255}
253256
254257static void GetCallSites (const FunctionCallbackInfo<Value>& args) {
255- Environment* env = Environment::GetCurrent (args);
256- Isolate* isolate = env->isolate ();
258+ Isolate* isolate = args.GetIsolate ();
259+ Local<Context> context = isolate->GetCurrentContext ();
260+ Environment* env = Environment::GetCurrent (context);
257261
258262 CHECK_EQ (args.Length (), 1 );
259263 CHECK (args[0 ]->IsNumber ());
@@ -307,7 +311,7 @@ static void GetCallSites(const FunctionCallbackInfo<Value>& args) {
307311
308312 Local<Object> callsite;
309313 if (!NewDictionaryInstanceNullProto (
310- env-> context () , callsite_template, values)
314+ context, callsite_template, values)
311315 .ToLocal (&callsite)) {
312316 return ;
313317 }
0 commit comments