@@ -53,8 +53,8 @@ CHAR_TEST(16, IsUnicodeSurrogateTrail, (ch & 0x400) != 0) |
53 | 53 |
|
54 | 54 | static void GetOwnNonIndexProperties( |
55 | 55 | 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(); |
58 | 58 |
|
59 | 59 | CHECK(args[0]->IsObject()); |
60 | 60 | CHECK(args[1]->IsUint32()); |
@@ -168,7 +168,7 @@ static void PreviewEntries(const FunctionCallbackInfo<Value>& args) { |
168 | 168 | if (!args[0]->IsObject()) |
169 | 169 | return; |
170 | 170 |
|
171 | | - Environment* env = Environment::GetCurrent(args); |
| 171 | + Isolate* isolate = args.GetIsolate(); |
172 | 172 | bool is_key_value; |
173 | 173 | Local<Array> entries; |
174 | 174 | if (!args[0].As<Object>()->PreviewEntries(&is_key_value).ToLocal(&entries)) |
@@ -177,12 +177,8 @@ static void PreviewEntries(const FunctionCallbackInfo<Value>& args) { |
177 | 177 | if (args.Length() == 1) |
178 | 178 | return args.GetReturnValue().Set(entries); |
179 | 179 |
|
180 | | - Local<Value> ret[] = { |
181 | | - entries, |
182 | | - Boolean::New(env->isolate(), is_key_value) |
183 | | - }; |
184 | | - return args.GetReturnValue().Set( |
185 | | - Array::New(env->isolate(), ret, arraysize(ret))); |
| 180 | + Local<Value> ret[] = {entries, Boolean::New(isolate, is_key_value)}; |
| 181 | + return args.GetReturnValue().Set(Array::New(isolate, ret, arraysize(ret))); |
186 | 182 | } |
187 | 183 |
|
188 | 184 | static void Sleep(const FunctionCallbackInfo<Value>& args) { |
@@ -222,9 +218,10 @@ static uint32_t GetUVHandleTypeCode(const uv_handle_type type) { |
222 | 218 | } |
223 | 219 |
|
224 | 220 | static void GuessHandleType(const FunctionCallbackInfo<Value>& args) { |
225 | | - Environment* env = Environment::GetCurrent(args); |
| 221 | + Isolate* isolate = args.GetIsolate(); |
| 222 | + Local<Context> context = isolate->GetCurrentContext(); |
226 | 223 | int fd; |
227 | | - if (!args[0]->Int32Value(env->context()).To(&fd)) return; |
| 224 | + if (!args[0]->Int32Value(context).To(&fd)) return; |
228 | 225 | CHECK_GE(fd, 0); |
229 | 226 |
|
230 | 227 | uv_handle_type t = uv_guess_handle(fd); |
@@ -239,10 +236,12 @@ static uint32_t FastGuessHandleType(Local<Value> receiver, const uint32_t fd) { |
239 | 236 | CFunction fast_guess_handle_type_(CFunction::Make(FastGuessHandleType)); |
240 | 237 |
|
241 | 238 | static void ParseEnv(const FunctionCallbackInfo<Value>& args) { |
242 | | - Environment* env = Environment::GetCurrent(args); |
| 239 | + Isolate* isolate = args.GetIsolate(); |
| 240 | + Local<Context> context = isolate->GetCurrentContext(); |
| 241 | + Environment* env = Environment::GetCurrent(context); |
243 | 242 | CHECK_EQ(args.Length(), 1); // content |
244 | 243 | CHECK(args[0]->IsString()); |
245 | | - Utf8Value content(env->isolate(), args[0]); |
| 244 | + Utf8Value content(isolate, args[0]); |
246 | 245 | Dotenv dotenv{}; |
247 | 246 | dotenv.ParseContent(content.ToStringView()); |
248 | 247 | Local<Object> obj; |
@@ -252,8 +251,9 @@ static void ParseEnv(const FunctionCallbackInfo<Value>& args) { |
252 | 251 | } |
253 | 252 |
|
254 | 253 | static void GetCallSites(const FunctionCallbackInfo<Value>& args) { |
255 | | - Environment* env = Environment::GetCurrent(args); |
256 | | - Isolate* isolate = env->isolate(); |
| 254 | + Isolate* isolate = args.GetIsolate(); |
| 255 | + Local<Context> context = isolate->GetCurrentContext(); |
| 256 | + Environment* env = Environment::GetCurrent(context); |
257 | 257 |
|
258 | 258 | CHECK_EQ(args.Length(), 1); |
259 | 259 | CHECK(args[0]->IsNumber()); |
@@ -306,8 +306,7 @@ static void GetCallSites(const FunctionCallbackInfo<Value>& args) { |
306 | 306 | }; |
307 | 307 |
|
308 | 308 | Local<Object> callsite; |
309 | | - if (!NewDictionaryInstanceNullProto( |
310 | | - env->context(), callsite_template, values) |
| 309 | + if (!NewDictionaryInstanceNullProto(context, callsite_template, values) |
311 | 310 | .ToLocal(&callsite)) { |
312 | 311 | return; |
313 | 312 | } |
|